playbook_ui 10.21.0 → 10.21.1.pre.alpha1
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/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +3 -3
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/card.rb +88 -0
- data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
- data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -24
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
- data/app/pb_kits/playbook/pb_image/docs/{_default_image.jsx → _default_image.tsx} +1 -1
- data/app/pb_kits/playbook/pb_image/docs/index.js +4 -4
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +81 -96
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +15 -8
- data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +3 -0
- data/app/pb_kits/playbook/utilities/_align_content.scss +29 -0
- data/app/pb_kits/playbook/utilities/_align_items.scss +35 -0
- data/app/pb_kits/playbook/utilities/_align_self.scss +29 -0
- data/app/pb_kits/playbook/utilities/_flex.scss +15 -0
- data/app/pb_kits/playbook/utilities/_flex_direction.scss +19 -0
- data/app/pb_kits/playbook/utilities/_flex_grow.scss +9 -0
- data/app/pb_kits/playbook/utilities/_flex_shrink.scss +9 -0
- data/app/pb_kits/playbook/utilities/_flex_wrap.scss +14 -0
- data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -0
- data/app/pb_kits/playbook/utilities/_justify_content.scss +23 -0
- data/app/pb_kits/playbook/utilities/_justify_self.scss +19 -0
- data/app/pb_kits/playbook/utilities/_order.scss +55 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +121 -3
- data/lib/playbook/align_content.rb +29 -0
- data/lib/playbook/align_items.rb +29 -0
- data/lib/playbook/align_self.rb +29 -0
- data/lib/playbook/classnames.rb +11 -0
- data/lib/playbook/flex.rb +29 -0
- data/lib/playbook/flex_direction.rb +29 -0
- data/lib/playbook/flex_grow.rb +29 -0
- data/lib/playbook/flex_shrink.rb +29 -0
- data/lib/playbook/flex_wrap.rb +29 -0
- data/lib/playbook/justify_content.rb +29 -0
- data/lib/playbook/justify_self.rb +29 -0
- data/lib/playbook/kit_base.rb +22 -0
- data/lib/playbook/order.rb +29 -0
- data/lib/playbook/version.rb +2 -2
- metadata +28 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 90a49eef5f7ef47b1e7921d940c7d1e6d56c7c11971e0612f88cd9aa6202079d
|
|
4
|
+
data.tar.gz: '0068f6fa35d25227519e9400cfc73fe66755f07c8e2521170829ff47e3926231'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9e65e6665780627141458de4acdb6e73e827ffe7f426cc4e0ce7ee71f40fd024d4c263c7c8fb126d88ea256b19d9a576914f60a075521959e5d2d196ec6dc10
|
|
7
|
+
data.tar.gz: f38dcd80a6acc7940e961c3f25bae68f70cf204cce40cdbed752222c2e762cf388e1aff147f6e9ee0218eefae3bbf342c96defb1e2ec01ef33d6412c64543020
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
class: object.classname,
|
|
5
5
|
aria: object.aria,
|
|
6
6
|
dark: object.dark) do %>
|
|
7
|
-
<%= pb_rails("card/card_body", props: { padding: object.body_padding }) do %>
|
|
7
|
+
<%= pb_rails("card/card_body", props: { padding: object.body_padding, flex_direction: object.body_flex_direction, flex_wrap: object.body_flex_wrap, justify_content: object.body_justify_content, justify_self: object.body_justify_self, align_items: object.body_align_items, align_content: object.body_align_content, align_self: object.body_align_self, flex: object.body_flex, flex_grow: object.body_flex_grow, flex_shrink: object.body_flex_shrink, order: object.body_order }) do %>
|
|
8
8
|
<%= content %>
|
|
9
9
|
<% end if content.present? %>
|
|
10
10
|
<% end %>
|
|
@@ -36,6 +36,94 @@ module Playbook
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
def body_flex_direction
|
|
40
|
+
if flex_direction.present?
|
|
41
|
+
"flex_direction_#{flex_direction}"
|
|
42
|
+
else
|
|
43
|
+
""
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def body_flex_wrap
|
|
48
|
+
if flex_wrap.present?
|
|
49
|
+
"flex_wrap_#{flex_wrap}"
|
|
50
|
+
else
|
|
51
|
+
""
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def body_justify_content
|
|
56
|
+
if justify_content.present?
|
|
57
|
+
"justify_content_#{justify_content}"
|
|
58
|
+
else
|
|
59
|
+
""
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def body_justify_self
|
|
64
|
+
if justify_self.present?
|
|
65
|
+
"justify_self_#{justify_self}"
|
|
66
|
+
else
|
|
67
|
+
""
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def body_align_items
|
|
72
|
+
if align_items.present?
|
|
73
|
+
"align_items_#{align_items}"
|
|
74
|
+
else
|
|
75
|
+
""
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def body_align_content
|
|
80
|
+
if align_content.present?
|
|
81
|
+
"align_content_#{align_content}"
|
|
82
|
+
else
|
|
83
|
+
""
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def body_align_self
|
|
88
|
+
if align_self.present?
|
|
89
|
+
"align_self_#{align_self}"
|
|
90
|
+
else
|
|
91
|
+
""
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def body_flex
|
|
96
|
+
if flex.present?
|
|
97
|
+
"flex_#{flex}"
|
|
98
|
+
else
|
|
99
|
+
""
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def body_flex_grow
|
|
104
|
+
if flex_grow.present?
|
|
105
|
+
"flex_grow_#{flex_grow}"
|
|
106
|
+
else
|
|
107
|
+
""
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def body_flex_shrink
|
|
112
|
+
if flex_shrink.present?
|
|
113
|
+
"flex_shrink_#{flex_shrink}"
|
|
114
|
+
else
|
|
115
|
+
""
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def body_order
|
|
120
|
+
if order.present?
|
|
121
|
+
"order_#{order}"
|
|
122
|
+
else
|
|
123
|
+
""
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
39
127
|
private
|
|
40
128
|
|
|
41
129
|
def selected_class
|
|
@@ -4,7 +4,7 @@ module Playbook
|
|
|
4
4
|
module PbCard
|
|
5
5
|
class CardBody < Playbook::KitBase
|
|
6
6
|
def classname
|
|
7
|
-
generate_classname("pb_card_body_kit", padding, separator: " ")
|
|
7
|
+
generate_classname("pb_card_body_kit", padding, flex_direction, justify_content, flex_wrap, justify_self, align_items, align_content, align_self, flex, flex_grow, flex_shrink, order, separator: " ")
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -8,17 +8,11 @@ module Playbook
|
|
|
8
8
|
default: false
|
|
9
9
|
prop :shrink, type: Playbook::Props::Boolean,
|
|
10
10
|
default: false
|
|
11
|
-
|
|
12
|
-
values: %w[0 1 2 3 4 5 6 7 8 9 10 11 12 none],
|
|
13
|
-
default: "none"
|
|
11
|
+
|
|
14
12
|
prop :overflow, type: Playbook::Props::Enum,
|
|
15
13
|
values: %w[auto hidden inherit initial scroll visible] + [nil],
|
|
16
14
|
default: nil
|
|
17
15
|
|
|
18
|
-
prop :order, type: Playbook::Props::Enum,
|
|
19
|
-
values: %w[1 2 3 4 5 6 7 8 9 10 11 12 first none],
|
|
20
|
-
default: "none"
|
|
21
|
-
|
|
22
16
|
prop :align_self, type: Playbook::Props::Enum,
|
|
23
17
|
values: %w[start center end stretch] + [nil],
|
|
24
18
|
default: nil
|
|
@@ -27,7 +21,7 @@ module Playbook
|
|
|
27
21
|
default: false
|
|
28
22
|
|
|
29
23
|
def classname
|
|
30
|
-
generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class,
|
|
24
|
+
generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, display_flex_class) + overflow_class + align_self_class
|
|
31
25
|
end
|
|
32
26
|
|
|
33
27
|
def style_value
|
|
@@ -59,22 +53,6 @@ module Playbook
|
|
|
59
53
|
def shrink_class
|
|
60
54
|
shrink ? "shrink" : nil
|
|
61
55
|
end
|
|
62
|
-
|
|
63
|
-
def flex_class
|
|
64
|
-
if flex == "none"
|
|
65
|
-
nil
|
|
66
|
-
else
|
|
67
|
-
"flex_#{flex}"
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def order_class
|
|
72
|
-
if order == "none"
|
|
73
|
-
""
|
|
74
|
-
else
|
|
75
|
-
"order_#{order}"
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
56
|
end
|
|
79
57
|
end
|
|
80
58
|
end
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
border-bottom-right-radius: 0;
|
|
42
42
|
border-top-right-radius: 0;
|
|
43
43
|
min-height: 45px;
|
|
44
|
+
margin-bottom: 16px;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
& > [class^=pb_button_kit]:not(:first-child) {
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
border-top-left-radius: 0;
|
|
49
50
|
border-left-width: 0;
|
|
50
51
|
min-height: 45px;
|
|
52
|
+
margin-bottom: 16px;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
& > [class^=pb_date_picker_kit]:not(:last-child) {
|
|
@@ -73,7 +73,7 @@ module Playbook
|
|
|
73
73
|
|
|
74
74
|
def render_svg(path)
|
|
75
75
|
if File.extname(path) == ".svg"
|
|
76
|
-
doc = Nokogiri::XML(open(path)) # rubocop:disable Security/Open
|
|
76
|
+
doc = Nokogiri::XML(URI.open(path)) # rubocop:disable Security/Open
|
|
77
77
|
svg = doc.at_css "svg"
|
|
78
78
|
svg["class"] = "pb_custom_icon " + object.custom_icon_classname
|
|
79
79
|
raw doc
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as DefaultImage } from './_default_image
|
|
2
|
-
export { default as RoundedImage } from './_rounded_image
|
|
3
|
-
export { default as CustomErrorImage } from './_custom_error_image
|
|
4
|
-
export { default as TransitionImage } from './_transition_image
|
|
1
|
+
export { default as DefaultImage } from './_default_image'
|
|
2
|
+
export { default as RoundedImage } from './_rounded_image'
|
|
3
|
+
export { default as CustomErrorImage } from './_custom_error_image'
|
|
4
|
+
export { default as TransitionImage } from './_transition_image'
|
|
@@ -11,6 +11,7 @@ const LineGraphDefault = (props) => (
|
|
|
11
11
|
<LineGraph
|
|
12
12
|
axisTitle="Number of Employees"
|
|
13
13
|
chartData={data}
|
|
14
|
+
height="300px"
|
|
14
15
|
id="line-fixed-height"
|
|
15
16
|
title="Fixed Height (300px)"
|
|
16
17
|
xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
3
3
|
|
|
4
|
-
import React, { useEffect,
|
|
4
|
+
import React, { useEffect, useState } from 'react'
|
|
5
5
|
import classnames from 'classnames'
|
|
6
6
|
import inlineFocus from './inlineFocus'
|
|
7
7
|
import useFocus from './useFocus'
|
|
8
8
|
import { globalProps } from '../utilities/globalProps'
|
|
9
|
-
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
|
9
|
+
import { buildAriaProps, buildDataProps, noop } from '../utilities/props'
|
|
10
10
|
|
|
11
11
|
try {
|
|
12
12
|
const Trix = require('trix')
|
|
@@ -16,6 +16,8 @@ try {
|
|
|
16
16
|
}
|
|
17
17
|
} catch (_e) { /* do nothing */ }
|
|
18
18
|
|
|
19
|
+
import { TrixEditor } from "react-trix"
|
|
20
|
+
|
|
19
21
|
type RichTextEditorProps = {
|
|
20
22
|
aria?: object,
|
|
21
23
|
toolbarBottom?: Boolean,
|
|
@@ -25,7 +27,7 @@ type RichTextEditorProps = {
|
|
|
25
27
|
id?: string,
|
|
26
28
|
inline?: boolean,
|
|
27
29
|
name?: string,
|
|
28
|
-
onChange: (string) => void,
|
|
30
|
+
onChange: (html: string, text: string) => void,
|
|
29
31
|
placeholder?: string,
|
|
30
32
|
simple?: boolean,
|
|
31
33
|
sticky?: boolean,
|
|
@@ -40,133 +42,116 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
|
40
42
|
className,
|
|
41
43
|
data = {},
|
|
42
44
|
focus = false,
|
|
43
|
-
id,
|
|
44
45
|
inline = false,
|
|
45
46
|
name,
|
|
46
|
-
onChange,
|
|
47
|
+
onChange = noop,
|
|
47
48
|
placeholder,
|
|
48
49
|
simple = false,
|
|
49
50
|
sticky = false,
|
|
50
51
|
template = '',
|
|
51
52
|
value = '',
|
|
52
53
|
} = props
|
|
53
|
-
const trixRef = useRef()
|
|
54
|
-
const ariaProps = buildAriaProps(aria)
|
|
55
|
-
const dataProps = buildDataProps(data)
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
const ariaProps = buildAriaProps(aria),
|
|
56
|
+
dataProps = buildDataProps(data),
|
|
57
|
+
[editor, setEditor] = useState()
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
const handleOnEditorReady = (editorInstance) => setEditor(editorInstance),
|
|
60
|
+
element = editor?.element
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
// DOM manipulation must wait for editor to be ready
|
|
63
|
+
if (editor) {
|
|
64
|
+
const toolbarElement = element.parentElement.querySelector('trix-toolbar'),
|
|
65
|
+
blockCodeButton = toolbarElement.querySelector('[data-trix-attribute=code]')
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
blockCodeButton.insertAdjacentElement('afterend', inlineCodeButton)
|
|
67
|
+
let inlineCodeButton = toolbarElement.querySelector('[data-trix-attribute=inlineCode]')
|
|
68
|
+
if (!inlineCodeButton) inlineCodeButton = blockCodeButton.cloneNode(true)
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
// set button attributes
|
|
71
|
+
inlineCodeButton.dataset.trixAttribute = 'inlineCode'
|
|
72
|
+
blockCodeButton.insertAdjacentElement('afterend', inlineCodeButton)
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
if (range[0] == range[1]) return 'block'
|
|
74
|
+
if (toolbarBottom) editor.element.after(toolbarElement)
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
const getCodeFormattingType = (): string => {
|
|
77
|
+
if (editor.attributeIsActive('code')) return 'block'
|
|
78
|
+
if (editor.attributeIsActive('inlineCode')) return 'inline'
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
blockCodeButton.hidden = type == 'inline'
|
|
86
|
-
inlineCodeButton.hidden = type == 'block'
|
|
87
|
-
})
|
|
80
|
+
const range = editor.getSelectedRange()
|
|
81
|
+
if (range[0] == range[1]) return 'block'
|
|
88
82
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
trixRef.current.addEventListener('trix-change', (event) => {
|
|
93
|
-
onChange && onChange(event.target.innerHTML)
|
|
94
|
-
})
|
|
95
|
-
}, [trixRef])
|
|
96
|
-
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
const editor = trixRef.current.editorController.editor
|
|
99
|
-
if (template) {
|
|
100
|
-
editor.loadHTML('')
|
|
101
|
-
editor.setSelectedRange([0, 0])
|
|
102
|
-
editor.insertHTML(template)
|
|
83
|
+
const text = editor.getSelectedDocument().toString().trim()
|
|
84
|
+
return /\n/.test(text) ? 'block' : 'inline'
|
|
103
85
|
}
|
|
104
|
-
}, [template])
|
|
105
|
-
|
|
106
|
-
focus
|
|
107
|
-
? (document.addEventListener('trix-focus', useFocus),
|
|
108
|
-
document.addEventListener('trix-blur', useFocus),
|
|
109
|
-
useFocus())
|
|
110
|
-
: null
|
|
111
|
-
|
|
112
|
-
document.addEventListener('trix-focus', inlineFocus)
|
|
113
|
-
document.addEventListener('trix-blur', inlineFocus)
|
|
114
86
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
87
|
+
// DOM event listeners
|
|
88
|
+
element.addEventListener('trix-selection-change', () => {
|
|
89
|
+
const type = getCodeFormattingType()
|
|
90
|
+
blockCodeButton.hidden = type == 'inline'
|
|
91
|
+
inlineCodeButton.hidden = type == 'block'
|
|
92
|
+
})
|
|
121
93
|
|
|
122
|
-
|
|
123
|
-
|
|
94
|
+
focus
|
|
95
|
+
? (document.addEventListener('trix-focus', useFocus),
|
|
96
|
+
document.addEventListener('trix-blur', useFocus),
|
|
97
|
+
useFocus())
|
|
98
|
+
: null
|
|
124
99
|
|
|
125
|
-
|
|
126
|
-
|
|
100
|
+
document.addEventListener('trix-focus', inlineFocus)
|
|
101
|
+
document.addEventListener('trix-blur', inlineFocus)
|
|
127
102
|
}
|
|
128
103
|
|
|
129
104
|
useEffect(() => {
|
|
130
|
-
|
|
131
|
-
|
|
105
|
+
if (!editor || !template) return
|
|
106
|
+
editor.loadHTML('')
|
|
107
|
+
editor.setSelectedRange([0, 0])
|
|
108
|
+
editor.insertHTML(template)
|
|
109
|
+
}, [editor, template])
|
|
132
110
|
|
|
133
111
|
useEffect(() => {
|
|
134
|
-
|
|
135
|
-
|
|
112
|
+
if (!element) return
|
|
113
|
+
element.addEventListener('click', ({target}) => {
|
|
114
|
+
const trixEditorContainer = target.closest('.pb_rich_text_editor_kit')
|
|
115
|
+
if (!trixEditorContainer) return
|
|
136
116
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
117
|
+
const anchorElement = target.closest('a')
|
|
118
|
+
if (!anchorElement) return
|
|
119
|
+
|
|
120
|
+
if (anchorElement.hasAttribute('href')) window.open(anchorElement.href)
|
|
121
|
+
})
|
|
122
|
+
}, [element])
|
|
123
|
+
|
|
124
|
+
const richTextEditorClass = 'pb_rich_text_editor_kit',
|
|
125
|
+
simpleClass = simple ? 'simple' : '',
|
|
126
|
+
focusClass = focus ? 'focus-editor-targets' : '',
|
|
127
|
+
stickyClass = sticky ? 'sticky' : '',
|
|
128
|
+
inlineClass = inline ? 'inline' : '',
|
|
129
|
+
toolbarBottomClass = toolbarBottom ? 'toolbar-bottom' : ''
|
|
130
|
+
|
|
131
|
+
let css = classnames(globalProps(props), className)
|
|
132
|
+
css = classnames(
|
|
133
|
+
richTextEditorClass,
|
|
134
|
+
simpleClass,
|
|
135
|
+
focusClass,
|
|
136
|
+
stickyClass,
|
|
137
|
+
inlineClass,
|
|
138
|
+
toolbarBottomClass,
|
|
139
|
+
css
|
|
140
|
+
)
|
|
144
141
|
|
|
145
142
|
return (
|
|
146
143
|
<div
|
|
147
144
|
{...ariaProps}
|
|
148
145
|
{...dataProps}
|
|
149
|
-
className={
|
|
150
|
-
RichTextEditorClass,
|
|
151
|
-
SimpleClass,
|
|
152
|
-
FocusClass,
|
|
153
|
-
StickyClass,
|
|
154
|
-
InlineClass,
|
|
155
|
-
ToolbarBottomClass,
|
|
156
|
-
css
|
|
157
|
-
)}
|
|
146
|
+
className={css}
|
|
158
147
|
>
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
/>
|
|
165
|
-
<trix-editor
|
|
166
|
-
input={id}
|
|
167
|
-
name={name}
|
|
148
|
+
<TrixEditor
|
|
149
|
+
className=""
|
|
150
|
+
fileParamName={name}
|
|
151
|
+
onChange={onChange}
|
|
152
|
+
onEditorReady={handleOnEditorReady}
|
|
168
153
|
placeholder={placeholder}
|
|
169
|
-
|
|
154
|
+
value={value}
|
|
170
155
|
/>
|
|
171
156
|
</div>
|
|
172
157
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= pb_rails("rich_text_editor", props: {id: "default"}) %>
|
|
1
|
+
<%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here. You can format your text, add links, quotes, and bullets."}) %>
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
2
|
import { RichTextEditor } from '../../'
|
|
3
3
|
|
|
4
|
-
const RichTextEditorDefault = (props) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const RichTextEditorDefault = (props) => {
|
|
5
|
+
const [value, setValue] = useState('Add your text here. You can format your text, add links, quotes, and bullets.'),
|
|
6
|
+
handleOnChange = (html) => setValue(html)
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div>
|
|
10
|
+
<RichTextEditor
|
|
11
|
+
onChange={handleOnChange}
|
|
12
|
+
value={value}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
11
18
|
|
|
12
19
|
export default RichTextEditorDefault
|
|
@@ -75,6 +75,8 @@ const TextInput = (props: TextInputProps, ref: React.ElementRef<"input">) => {
|
|
|
75
75
|
globalProps(props),
|
|
76
76
|
className,
|
|
77
77
|
])
|
|
78
|
+
const uniqueTextInputKey = `${id ? id : ''}${Math.ceil(Math.random() * 100000)}`
|
|
79
|
+
|
|
78
80
|
const addOnIcon = (
|
|
79
81
|
<Icon
|
|
80
82
|
className="add-on-icon"
|
|
@@ -89,6 +91,7 @@ const TextInput = (props: TextInputProps, ref: React.ElementRef<"input">) => {
|
|
|
89
91
|
className="text_input"
|
|
90
92
|
disabled={disabled}
|
|
91
93
|
id={id}
|
|
94
|
+
key={uniqueTextInputKey}
|
|
92
95
|
name={name}
|
|
93
96
|
onChange={onChange}
|
|
94
97
|
placeholder={placeholder}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.align_content_start {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-content: start !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.align_content_end {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-content: end !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.align_content_center {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-content: center !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.align_content_space_between {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-content: space-between !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.align_content_space_around {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-content: space-around !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.align_content_space_evenly {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-content: space-evenly !important;
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.align_items_flex_start {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-start !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.align_items_flex_end {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: flex-end !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.align_items_start {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: start !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.align_items_end {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: end !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
.align_items_center {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.align_items_baseline {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: baseline !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.align_items_stretch {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: stretch !important;
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.align_self_start {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-self: start !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.align_self_end {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-self: end !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.align_self_auto {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-self: auto !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.align_self_center {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-self: center !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.align_self_stretch {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-self: stretch !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.align_self_baseline {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-self: baseline !important;
|
|
29
|
+
}
|