playbook_ui 16.1.0.pre.alpha.play264213818 → 16.1.0.pre.alpha.play274314102
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +12 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_custom.jsx +71 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_custom.md +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_light.html.erb +3 -35
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +1 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +17 -0
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +10 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +2 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.html.erb +6 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.jsx +17 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +14 -5
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.md +1 -0
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +8 -6
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +6 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +83 -13
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_rails.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_react.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.html.erb +52 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.jsx +72 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height.jsx +33 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.html.erb +20 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.md +8 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_react.md +8 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +6 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +3 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.html.erb +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.jsx +33 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +11 -5
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +15 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +94 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +5 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +7 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +4 -0
- data/app/pb_kits/playbook/pb_dropdown/index.js +184 -77
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +3 -0
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +18 -1
- data/app/pb_kits/playbook/pb_dropdown/utilities/clickOutsideHelper.tsx +6 -0
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +2 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +16 -9
- data/app/pb_kits/playbook/pb_filter/filter.rb +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +6 -2
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +9 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +5 -5
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +4 -4
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +4 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +7 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +638 -549
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +3 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +4 -7
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.test.jsx +4 -4
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +40 -7
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +1 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.html.erb +7 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.jsx +24 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +2 -0
- data/app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx +30 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.html.erb +5 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.jsx +14 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +34 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +71 -34
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.jsx +44 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_required_indicator.jsx +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.jsx +4 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +4 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.jsx +5 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.jsx +4 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +33 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.jsx +4 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +5 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.jsx +4 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.jsx +4 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.jsx +4 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +23 -20
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_table/index.ts +29 -27
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +10 -10
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +10 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.html.erb +3 -3
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.jsx +3 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.md +1 -0
- data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +25 -9
- data/app/pb_kits/playbook/pb_textarea/textarea.rb +7 -1
- data/app/pb_kits/playbook/pb_time_picker/_time_picker.tsx +97 -11
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.jsx +5 -2
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.html.erb +6 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.jsx +16 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_time_picker/time_picker.rb +3 -0
- data/app/pb_kits/playbook/pb_time_picker/time_picker.test.jsx +47 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +24 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +412 -324
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +2 -0
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +4 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.html.erb +16 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.jsx +23 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +22 -21
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +3 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +7 -1
- data/dist/chunks/{_pb_line_graph-BgKF_zz1.js → _pb_line_graph-DuJNCf7N.js} +1 -1
- data/dist/chunks/_typeahead-Cx2lp7TD.js +1 -0
- data/dist/chunks/{globalProps-BhVYCqRf.js → globalProps-Bc-FVsRt.js} +1 -1
- data/dist/chunks/lib-BwX82vim.js +29 -0
- data/dist/chunks/vendor.js +3 -3
- data/dist/menu.yml +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/forms/builder/form_field_builder.rb +1 -1
- data/lib/playbook/forms/builder/phone_number_field.rb +9 -0
- data/lib/playbook/forms/builder/typeahead_field.rb +15 -1
- data/lib/playbook/forms/builder.rb +2 -2
- data/lib/playbook/truncate.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +42 -19
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_attributes.html.erb +0 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +0 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline.html.erb +0 -6
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +0 -35
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.html.erb +0 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.html.erb +0 -115
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.html.erb +0 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_toolbar_bottom.jsx +0 -14
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +0 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +0 -63
- data/dist/chunks/_typeahead-B9a6ZsEP.js +0 -1
- data/dist/chunks/lib-DD34ZrWL.js +0 -29
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The optional `label` prop adds a visible label to the advanced editor. Passing in the `id` prop associates the `label` with the editor for accessibility, enabling screen reader support and label-based focus behavior.
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
|
+
import { TrixEditor } from 'react-trix'
|
|
4
|
+
// eslint-disable-next-line no-unused-vars
|
|
5
|
+
import Trix from 'trix'
|
|
3
6
|
|
|
4
7
|
const RichTextEditorAttributes = (props) => (
|
|
5
8
|
<div>
|
|
6
9
|
<RichTextEditor
|
|
10
|
+
TrixEditor={TrixEditor}
|
|
7
11
|
aria={{ label: 'rich textarea' }}
|
|
8
12
|
data={{ key: 'value', key2: 'value2' }}
|
|
9
13
|
name="name-attribute"
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
|
+
import { TrixEditor } from 'react-trix'
|
|
4
|
+
// eslint-disable-next-line no-unused-vars
|
|
5
|
+
import Trix from 'trix'
|
|
3
6
|
|
|
4
7
|
const RichTextEditorDefault = (props) => {
|
|
5
8
|
const [value, setValue] = useState('Add your text here. You can format your text, add links, quotes, and bullets.'),
|
|
@@ -8,6 +11,7 @@ const RichTextEditorDefault = (props) => {
|
|
|
8
11
|
return (
|
|
9
12
|
<div>
|
|
10
13
|
<RichTextEditor
|
|
14
|
+
TrixEditor={TrixEditor}
|
|
11
15
|
onChange={handleOnChange}
|
|
12
16
|
value={value}
|
|
13
17
|
{...props}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
|
+
import { TrixEditor } from 'react-trix'
|
|
4
|
+
// eslint-disable-next-line no-unused-vars
|
|
5
|
+
import Trix from 'trix'
|
|
3
6
|
|
|
4
7
|
const RichTextEditorFocus = (props) => (
|
|
5
8
|
<>
|
|
6
9
|
<RichTextEditor
|
|
10
|
+
TrixEditor={TrixEditor}
|
|
7
11
|
focus
|
|
8
12
|
{...props}
|
|
9
13
|
/>
|
|
10
14
|
<br />
|
|
11
15
|
<RichTextEditor
|
|
16
|
+
TrixEditor={TrixEditor}
|
|
12
17
|
focus
|
|
13
18
|
{...props}
|
|
14
19
|
/>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
|
+
import { TrixEditor } from 'react-trix'
|
|
4
|
+
// eslint-disable-next-line no-unused-vars
|
|
5
|
+
import Trix from 'trix'
|
|
3
6
|
|
|
4
7
|
const RichTextEditorInline = (props) => (
|
|
5
8
|
<div>
|
|
6
9
|
<RichTextEditor
|
|
10
|
+
TrixEditor={TrixEditor}
|
|
7
11
|
id="inline"
|
|
8
12
|
inline
|
|
9
13
|
toolbarBottom
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
|
+
import { TrixEditor } from 'react-trix'
|
|
4
|
+
// eslint-disable-next-line no-unused-vars
|
|
5
|
+
import Trix from 'trix'
|
|
6
|
+
|
|
7
|
+
const RichTextEditorLabel = (props) => {
|
|
8
|
+
const [value, setValue] = useState(''),
|
|
9
|
+
handleOnChange = (html) => setValue(html)
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div>
|
|
13
|
+
<RichTextEditor
|
|
14
|
+
TrixEditor={TrixEditor}
|
|
15
|
+
id="example"
|
|
16
|
+
label="Example Label"
|
|
17
|
+
onChange={handleOnChange}
|
|
18
|
+
value={value}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
<br/>
|
|
22
|
+
<RichTextEditor
|
|
23
|
+
TrixEditor={TrixEditor}
|
|
24
|
+
label="Example Label No ID"
|
|
25
|
+
onChange={handleOnChange}
|
|
26
|
+
value={value}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default RichTextEditorLabel
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The optional `label` prop adds a visible label to the editor. Passing in the `id` prop associates the `label` with the editor for accessibility, enabling screen reader support and label-based focus behavior.
|
|
@@ -2,6 +2,9 @@ import React, { useState } from 'react'
|
|
|
2
2
|
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
3
|
import Button from '../../pb_button/_button'
|
|
4
4
|
import Card from '../../pb_card/_card'
|
|
5
|
+
import { TrixEditor } from 'react-trix'
|
|
6
|
+
// eslint-disable-next-line no-unused-vars
|
|
7
|
+
import Trix from 'trix'
|
|
5
8
|
|
|
6
9
|
const RichTextEditorPreview = (props) => {
|
|
7
10
|
const [showPreview, setShowPreview] = useState(false)
|
|
@@ -15,6 +18,7 @@ const RichTextEditorPreview = (props) => {
|
|
|
15
18
|
return (
|
|
16
19
|
<div>
|
|
17
20
|
<RichTextEditor
|
|
21
|
+
TrixEditor={TrixEditor}
|
|
18
22
|
id="content-preview-editor"
|
|
19
23
|
onChange={handleChange}
|
|
20
24
|
{...props}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
|
+
import { TrixEditor } from 'react-trix'
|
|
4
|
+
// eslint-disable-next-line no-unused-vars
|
|
5
|
+
import Trix from 'trix'
|
|
3
6
|
|
|
4
7
|
const RichTextEditorRequiredIndicator = (props) => {
|
|
5
8
|
const [value, setValue] = useState('Add your text here. You can format your text, add links, quotes, and bullets.'),
|
|
@@ -8,6 +11,8 @@ const RichTextEditorRequiredIndicator = (props) => {
|
|
|
8
11
|
return (
|
|
9
12
|
<div>
|
|
10
13
|
<RichTextEditor
|
|
14
|
+
TrixEditor={TrixEditor}
|
|
15
|
+
inputOptions = {{ id: "required" }}
|
|
11
16
|
label="Label"
|
|
12
17
|
onChange={handleOnChange}
|
|
13
18
|
requiredIndicator
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
|
+
import { TrixEditor } from 'react-trix'
|
|
4
|
+
// eslint-disable-next-line no-unused-vars
|
|
5
|
+
import Trix from 'trix'
|
|
3
6
|
|
|
4
7
|
const RichTextEditorSimple = (props) => (
|
|
5
8
|
<div>
|
|
6
9
|
<RichTextEditor
|
|
10
|
+
TrixEditor={TrixEditor}
|
|
7
11
|
simple
|
|
8
12
|
{...props}
|
|
9
13
|
/>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
|
+
import { TrixEditor } from 'react-trix'
|
|
4
|
+
// eslint-disable-next-line no-unused-vars
|
|
5
|
+
import Trix from 'trix'
|
|
3
6
|
|
|
4
7
|
const RichTextEditorSticky = (props) => (
|
|
5
8
|
<div>
|
|
6
9
|
<RichTextEditor
|
|
10
|
+
TrixEditor={TrixEditor}
|
|
7
11
|
id="sticky"
|
|
8
12
|
sticky
|
|
9
13
|
value="In this example, when you scroll down, the rich text editor's toolbar will scroll along with the page and it will no longer be visible at the top of the page. Dummy text to enable scroll.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis.sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ornare lorem ut pellentesque tempor. Vivamus ut ex vestibulum velit rich text editor eleifend fringilla. Sed non metus dictum, elementum mauris wysiwyg html editor non, sagittis odio. Nullam pellentesque leo sit amet ante suscipit wysiwyg html editor sagittis. Donec tempus vulputate suscipit. Ut non felis rich text editor ac dolor pulvinar lacinia eu eget urna. Sed tincidunt sapien vulputate tellus fringilla sodales. Morbi accumsan dui wysiwyg html editor sed massa pellentesque, quis vestibulum lectus scelerisque. Nulla ultrices mi id felis luctus aliquet. Donec nec ligula wysiwyg html editor pretium sapien semper dictum eu id quam. Etiam ut sollicitudin nibh. Quisque eu ultrices dui. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus rich text editor mi eu consequat. Nullam tincidunt erat et placerat mattis. Nunc rich text editor congue, enim vitae dictum dignissim, libero nisl sagittis augue, non aliquet nibh tortor sit amet ex. Aliquam cursus maximus mi eu consequat. Nullam tincidunt erat et placerat mattis."
|
|
@@ -2,6 +2,9 @@ import React, { useState } from 'react'
|
|
|
2
2
|
import RichTextEditor from '../../pb_rich_text_editor/_rich_text_editor'
|
|
3
3
|
import Select from '../../pb_select/_select'
|
|
4
4
|
import { changelog, release } from './templates.js'
|
|
5
|
+
import { TrixEditor } from 'react-trix'
|
|
6
|
+
// eslint-disable-next-line no-unused-vars
|
|
7
|
+
import Trix from 'trix'
|
|
5
8
|
|
|
6
9
|
const RichTextEditorTemplates = (props) => {
|
|
7
10
|
const [editorContent, setEditorContent] = useState('')
|
|
@@ -31,6 +34,7 @@ const RichTextEditorTemplates = (props) => {
|
|
|
31
34
|
{...props}
|
|
32
35
|
/>
|
|
33
36
|
<RichTextEditor
|
|
37
|
+
TrixEditor={TrixEditor}
|
|
34
38
|
id="template"
|
|
35
39
|
template={editorContent}
|
|
36
40
|
{...props}
|
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
examples:
|
|
2
2
|
|
|
3
3
|
rails:
|
|
4
|
-
- rich_text_editor_default: Default
|
|
5
|
-
- rich_text_editor_simple: Simple
|
|
6
|
-
- rich_text_editor_attributes: Attributes
|
|
7
|
-
- rich_text_editor_focus: Focus
|
|
8
|
-
- rich_text_editor_sticky: Sticky
|
|
9
|
-
- rich_text_editor_templates: Templates
|
|
10
|
-
# - rich_text_editor_toolbar_bottom: Toolbar Bottom
|
|
11
|
-
- rich_text_editor_inline: Inline
|
|
12
|
-
- rich_text_editor_required_indicator: Required Indicator
|
|
13
|
-
- rich_text_editor_preview: Preview
|
|
14
4
|
|
|
15
5
|
react:
|
|
16
|
-
- rich_text_editor_default: Default
|
|
17
6
|
- rich_text_editor_advanced_default: Advanced Default
|
|
18
7
|
- rich_text_editor_more_extensions: Advanced (Extra Extensions)
|
|
19
8
|
- rich_text_editor_toolbar_disabled: Advanced (Toolbar disabled)
|
|
20
|
-
- rich_text_editor_simple: Simple
|
|
21
9
|
- rich_text_editor_advanced_simple: Advanced (Simple)
|
|
22
|
-
- rich_text_editor_attributes: Attributes
|
|
23
10
|
- rich_text_editor_advanced_attributes: Advanced (Attributes)
|
|
24
|
-
- rich_text_editor_focus: Focus
|
|
25
11
|
- rich_text_editor_advanced_focus: Advanced (Focus)
|
|
26
|
-
- rich_text_editor_sticky: Sticky
|
|
27
12
|
- rich_text_editor_advanced_sticky: Advanced (Sticky)
|
|
28
|
-
- rich_text_editor_templates: Templates
|
|
29
13
|
- rich_text_editor_advanced_templates: Advanced (Templates)
|
|
30
|
-
# - rich_text_editor_toolbar_bottom: Toolbar Bottom
|
|
31
|
-
- rich_text_editor_inline: Inline
|
|
32
14
|
- rich_text_editor_advanced_inline: Advanced (Inline)
|
|
33
15
|
- rich_text_editor_advanced_height: Advanced Height
|
|
34
16
|
- rich_text_editor_advanced_min_height: Advanced Min Height
|
|
35
|
-
-
|
|
17
|
+
- rich_text_editor_advanced_label: Advanced (Label)
|
|
36
18
|
- rich_text_editor_advanced_required_indicator: Advanced Required Indicator
|
|
37
|
-
- rich_text_editor_preview: Preview
|
|
38
19
|
- rich_text_editor_advanced_preview: Advanced Preview
|
|
20
|
+
- rich_text_editor_default: Legacy Default (Trix)
|
|
21
|
+
- rich_text_editor_simple: Legacy Simple (Trix)
|
|
22
|
+
- rich_text_editor_attributes: Legacy Attributes (Trix)
|
|
23
|
+
- rich_text_editor_focus: Legacy Focus (Trix)
|
|
24
|
+
- rich_text_editor_sticky: Legacy Sticky (Trix)
|
|
25
|
+
- rich_text_editor_templates: Legacy Templates (Trix)
|
|
26
|
+
- rich_text_editor_inline: Legacy Inline (Trix)
|
|
27
|
+
- rich_text_editor_label: Legacy Label (Trix)
|
|
28
|
+
- rich_text_editor_required_indicator: Legacy Required Indicator (Trix)
|
|
29
|
+
- rich_text_editor_preview: Legacy Preview (Trix)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
@@ -4,7 +4,6 @@ export { default as RichTextEditorAttributes } from './_rich_text_editor_attribu
|
|
|
4
4
|
export { default as RichTextEditorFocus } from './_rich_text_editor_focus.jsx'
|
|
5
5
|
export { default as RichTextEditorSticky } from './_rich_text_editor_sticky.jsx'
|
|
6
6
|
export { default as RichTextEditorTemplates } from './_rich_text_editor_templates.jsx'
|
|
7
|
-
export { default as RichTextEditorToolbarBottom } from './_rich_text_editor_toolbar_bottom.jsx'
|
|
8
7
|
export { default as RichTextEditorInline } from './_rich_text_editor_inline.jsx'
|
|
9
8
|
export { default as RichTextEditorPreview } from './_rich_text_editor_preview.jsx'
|
|
10
9
|
export { default as RichTextEditorAdvancedDefault } from './_rich_text_editor_advanced_default.jsx'
|
|
@@ -21,3 +20,5 @@ export { default as RichTextEditorAdvancedHeight } from './_rich_text_editor_adv
|
|
|
21
20
|
export { default as RichTextEditorAdvancedMinHeight } from './_rich_text_editor_advanced_min_height.jsx'
|
|
22
21
|
export { default as RichTextEditorRequiredIndicator } from './_rich_text_editor_required_indicator.jsx'
|
|
23
22
|
export { default as RichTextEditorAdvancedRequiredIndicator } from './_rich_text_editor_advanced_required_indicator.jsx'
|
|
23
|
+
export { default as RichTextEditorLabel } from './_rich_text_editor_label.jsx'
|
|
24
|
+
export { default as RichTextEditorAdvancedLabel } from './_rich_text_editor_advanced_label.jsx'
|
|
@@ -79,21 +79,22 @@ export default class PbTable extends PbEnhancedElement {
|
|
|
79
79
|
header.classList.add('sticky-left-shadow');
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
const headerWidth = (header as HTMLElement).offsetWidth;
|
|
83
|
+
accumulatedWidth += headerWidth;
|
|
84
|
+
|
|
85
|
+
cells.forEach((cell) => {
|
|
86
|
+
cell.classList.add('sticky');
|
|
87
|
+
(cell as HTMLElement).style.left = `${accumulatedWidth - headerWidth}px`;
|
|
88
|
+
|
|
89
|
+
if (!isLastColumn) {
|
|
90
|
+
cell.classList.add('with-border-right');
|
|
91
|
+
cell.classList.remove('sticky-left-shadow');
|
|
92
|
+
} else {
|
|
93
|
+
cell.classList.remove('with-border-right');
|
|
94
|
+
cell.classList.add('sticky-left-shadow');
|
|
95
|
+
}
|
|
96
|
+
});
|
|
83
97
|
}
|
|
84
|
-
|
|
85
|
-
cells.forEach((cell) => {
|
|
86
|
-
cell.classList.add('sticky');
|
|
87
|
-
(cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
|
88
|
-
|
|
89
|
-
if (!isLastColumn) {
|
|
90
|
-
cell.classList.add('with-border-right');
|
|
91
|
-
cell.classList.remove('sticky-left-shadow');
|
|
92
|
-
} else {
|
|
93
|
-
cell.classList.remove('with-border-right');
|
|
94
|
-
cell.classList.add('sticky-left-shadow');
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -140,21 +141,22 @@ export default class PbTable extends PbEnhancedElement {
|
|
|
140
141
|
header.classList.add('sticky-right-shadow');
|
|
141
142
|
}
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
const headerWidth = (header as HTMLElement).offsetWidth;
|
|
145
|
+
accumulatedWidth += headerWidth;
|
|
145
146
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
cells.forEach((cell) => {
|
|
148
|
+
cell.classList.add('sticky');
|
|
149
|
+
(cell as HTMLElement).style.right = `${accumulatedWidth - headerWidth}px`;
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
if (!isLastColumn) {
|
|
152
|
+
cell.classList.add('with-border-left');
|
|
153
|
+
cell.classList.remove('sticky-right-shadow');
|
|
154
|
+
} else {
|
|
155
|
+
cell.classList.remove('with-border-left');
|
|
156
|
+
cell.classList.add('sticky-right-shadow');
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
158
160
|
});
|
|
159
161
|
}
|
|
160
162
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
<%= pb_content_tag(:div, id: nil
|
|
1
|
+
<%= pb_content_tag(:div, id: nil) do %>
|
|
2
2
|
<% if object.label.present? %>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
<label for="<%= object.input_options[:id] || object.id %>">
|
|
4
|
+
<% if object.required_indicator %>
|
|
5
|
+
<%= pb_rails("caption", props: { dark: object.dark, classname: "pb_text_input_kit_label" }) do %>
|
|
6
|
+
<%= object.label %><span style="color: #DA0014;"> *</span>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% else %>
|
|
9
|
+
<%= pb_rails("caption", props: { text: object.label, dark: object.dark, classname: "pb_text_input_kit_label" }) %>
|
|
7
10
|
<% end %>
|
|
8
|
-
|
|
9
|
-
<%= pb_rails("caption", props: { text: object.label, dark: object.dark, classname: "pb_text_input_kit_label" }) %>
|
|
10
|
-
<% end %>
|
|
11
|
-
</label>
|
|
11
|
+
</label>
|
|
12
12
|
<% end %>
|
|
13
|
+
|
|
13
14
|
<%= content_tag(:div, class: "#{add_on_class} text_input_wrapper") do %>
|
|
14
15
|
<% if content.present? %>
|
|
15
16
|
<%= content %>
|
|
@@ -26,4 +27,3 @@
|
|
|
26
27
|
<%= pb_rails("body", props: {dark: object.dark, status: "negative", text: object.error, id: object.error_id, aria: { atomic: "true", live: "polite" }, html_options: { role: "alert" }}) if object.error %>
|
|
27
28
|
<% end %>
|
|
28
29
|
<% end %>
|
|
29
|
-
|
|
@@ -120,6 +120,7 @@ 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
|
|
123
124
|
|
|
124
125
|
return (
|
|
125
126
|
<div
|
|
@@ -145,7 +146,10 @@ const Textarea = ({
|
|
|
145
146
|
)}
|
|
146
147
|
{children || (
|
|
147
148
|
<textarea
|
|
149
|
+
aria-describedby={errorId}
|
|
150
|
+
aria-invalid={!!error}
|
|
148
151
|
disabled={disabled}
|
|
152
|
+
id={id}
|
|
149
153
|
name={name}
|
|
150
154
|
onChange={emojiMask ? handleChange : onChange}
|
|
151
155
|
onPaste={emojiMask ? handlePaste : undefined}
|
|
@@ -167,6 +171,9 @@ const Textarea = ({
|
|
|
167
171
|
>
|
|
168
172
|
<FlexItem>
|
|
169
173
|
<Body
|
|
174
|
+
aria={{ atomic: "true", live: "polite" }}
|
|
175
|
+
htmlOptions={{ role: "alert" }}
|
|
176
|
+
id={errorId}
|
|
170
177
|
margin="none"
|
|
171
178
|
status="negative"
|
|
172
179
|
text={error}
|
|
@@ -182,6 +189,9 @@ const Textarea = ({
|
|
|
182
189
|
</Flex>
|
|
183
190
|
) : (
|
|
184
191
|
<Body
|
|
192
|
+
aria={{ atomic: "true", live: "polite" }}
|
|
193
|
+
htmlOptions={{ role: "alert" }}
|
|
194
|
+
id={errorId}
|
|
185
195
|
status="negative"
|
|
186
196
|
text={error}
|
|
187
197
|
/>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<%= pb_rails("textarea", props: { label: "Label", rows: 4}) %>
|
|
1
|
+
<%= pb_rails("textarea", props: { label: "Label", rows: 4, id: "default-example-1" }) %>
|
|
2
2
|
|
|
3
3
|
<br/>
|
|
4
4
|
|
|
5
|
-
<%= pb_rails("textarea", props: { label: "Label", placeholder: "Placeholder text" }) %>
|
|
5
|
+
<%= pb_rails("textarea", props: { label: "Label", placeholder: "Placeholder text", id: "default-example-2" }) %>
|
|
6
6
|
|
|
7
7
|
<br/>
|
|
8
8
|
|
|
9
|
-
<%= pb_rails("textarea", props: { label: "Label", name: "comment", value: "Default value text" }) %>
|
|
9
|
+
<%= pb_rails("textarea", props: { label: "Label", name: "comment", value: "Default value text", id: "default-example-3" }) %>
|
|
@@ -13,6 +13,7 @@ const TextareaDefault = (props) => {
|
|
|
13
13
|
label="Label"
|
|
14
14
|
rows={4}
|
|
15
15
|
{...props}
|
|
16
|
+
id="default-example-1"
|
|
16
17
|
/>
|
|
17
18
|
|
|
18
19
|
<br />
|
|
@@ -21,6 +22,7 @@ const TextareaDefault = (props) => {
|
|
|
21
22
|
label="Label"
|
|
22
23
|
placeholder="Placeholder text"
|
|
23
24
|
{...props}
|
|
25
|
+
id="default-example-2"
|
|
24
26
|
/>
|
|
25
27
|
|
|
26
28
|
<br />
|
|
@@ -32,6 +34,7 @@ const TextareaDefault = (props) => {
|
|
|
32
34
|
placeholder="Placeholder text"
|
|
33
35
|
value={value}
|
|
34
36
|
{...props}
|
|
37
|
+
id="default-example-3"
|
|
35
38
|
/>
|
|
36
39
|
|
|
37
40
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Add an `id` to your Textarea so that clicking the label will move focus directly to the input.
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
<%= pb_content_tag do %>
|
|
1
|
+
<%= pb_content_tag(:div, id: nil) do %>
|
|
2
2
|
<% if object.label.present? %>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<%= object.label
|
|
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}) %>
|
|
6
10
|
<% end %>
|
|
7
|
-
|
|
8
|
-
<%= pb_rails("caption", props: {text: object.label, dark: object.dark}) %>
|
|
9
|
-
<% end %>
|
|
11
|
+
</label>
|
|
10
12
|
<% end %>
|
|
11
13
|
<% if content.present? %>
|
|
12
14
|
<%= content %>
|
|
@@ -22,14 +24,28 @@
|
|
|
22
24
|
<% if object.character_count %>
|
|
23
25
|
<%= pb_rails("flex", props: { spacing: "between", vertical: "center" }) do %>
|
|
24
26
|
<%= pb_rails("flex/flex_item") do %>
|
|
25
|
-
|
|
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
|
+
}) %>
|
|
26
35
|
<% end %>
|
|
27
36
|
<%= pb_rails("flex/flex_item") do %>
|
|
28
37
|
<%= pb_rails("caption", props: { margin: "none", size: "xs", text: object.character_counter }) %>
|
|
29
38
|
<% end %>
|
|
30
39
|
<% end %>
|
|
31
40
|
<% else %>
|
|
32
|
-
<%= pb_rails("body", props: {
|
|
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
|
+
}) %>
|
|
33
49
|
<% end %>
|
|
34
50
|
<% else %>
|
|
35
51
|
<%= pb_rails("caption", props: { margin: "none", size: "xs", text: object.character_counter }) %>
|
|
@@ -47,7 +47,9 @@ module Playbook
|
|
|
47
47
|
merged_data = data_attrs.merge(input_data)
|
|
48
48
|
|
|
49
49
|
base_attributes = {
|
|
50
|
-
|
|
50
|
+
'aria-describedby': error.present? ? error_id : nil,
|
|
51
|
+
'aria-invalid': error.present?,
|
|
52
|
+
id: input_options[:id] || id || "object_method",
|
|
51
53
|
max_characters: max_characters,
|
|
52
54
|
name: name,
|
|
53
55
|
onkeyup: onkeyup,
|
|
@@ -66,6 +68,10 @@ module Playbook
|
|
|
66
68
|
result
|
|
67
69
|
end
|
|
68
70
|
|
|
71
|
+
def error_id
|
|
72
|
+
"#{id}-error" if error.present?
|
|
73
|
+
end
|
|
74
|
+
|
|
69
75
|
private
|
|
70
76
|
|
|
71
77
|
def error_class
|