playbook_ui 10.23.0.pre.cachetest → 10.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/index.js +0 -3
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -2
- data/app/pb_kits/playbook/pb_avatar/{_avatar.jsx → _avatar.tsx} +13 -14
- data/app/pb_kits/playbook/pb_avatar/avatar.rb +1 -1
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +1 -1
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_background/_background.jsx +18 -4
- data/app/pb_kits/playbook/pb_background/_background.scss +23 -7
- data/app/pb_kits/playbook/pb_background/background.html.erb +5 -2
- data/app/pb_kits/playbook/pb_background/background.rb +33 -6
- data/app/pb_kits/playbook/pb_background/background.test.js +17 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +50 -2
- data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +71 -28
- data/app/pb_kits/playbook/pb_background/docs/_background_image.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_size.html.erb +5 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_size.jsx +36 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_size.md +3 -0
- data/app/pb_kits/playbook/pb_background/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +5 -1
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.jsx +2 -2
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.jsx +1 -1
- data/app/pb_kits/playbook/pb_button/_button.jsx +8 -4
- data/app/pb_kits/playbook/pb_button/_button.scss +18 -1
- data/app/pb_kits/playbook/pb_button/button.rb +13 -3
- data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.html.erb +1 -1
- data/app/pb_kits/playbook/pb_button/docs/_button_form.html.erb +1 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_form.jsx +14 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_button/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +1 -1
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/_card.jsx +1 -1
- 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_checkbox/_checkbox.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +3 -0
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +1 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx +1 -1
- data/app/pb_kits/playbook/pb_currency/_currency.jsx +24 -3
- data/app/pb_kits/playbook/pb_currency/currency.rb +12 -3
- data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.html.erb +27 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.jsx +44 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +215 -0
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +1 -1
- data/app/pb_kits/playbook/pb_dashboard_value/dashboard_value.rb +13 -1
- data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.html.erb +13 -6
- data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.jsx +9 -0
- data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +3 -3
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_should_close_on_overlay.md +2 -2
- data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +1 -1
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +17 -10
- data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +40 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +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.jsx +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +1 -0
- data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.jsx +1 -1
- data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
- data/app/pb_kits/playbook/pb_image/{_image.jsx → _image.tsx} +11 -15
- 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_image/image.rb +1 -1
- data/app/pb_kits/playbook/pb_image/image.test.js +1 -1
- data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.jsx +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +5 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -0
- data/app/pb_kits/playbook/pb_list/_list.jsx +1 -1
- data/app/pb_kits/playbook/pb_list/_list_item.jsx +1 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +1 -1
- data/app/pb_kits/playbook/pb_online_status/{_online_status.jsx → _online_status.tsx} +4 -6
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +2 -2
- data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +3 -5
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
- data/app/pb_kits/playbook/pb_popover/index.js +4 -9
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +1 -1
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
- data/app/pb_kits/playbook/pb_radio/_radio.jsx +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +83 -93
- 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_select/_select.jsx +2 -2
- data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.html.erb +2 -0
- data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_stat_value/stat_value.rb +2 -2
- data/app/pb_kits/playbook/pb_table/_table.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/_table_row.jsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +24 -19
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +14 -0
- data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +1 -0
- data/app/pb_kits/playbook/pb_time/_time.jsx +1 -1
- data/app/pb_kits/playbook/pb_title/_title.jsx +1 -1
- data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -1
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.jsx +1 -1
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +1 -1
- data/app/pb_kits/playbook/plugins/pb_chart.js +8 -4
- 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 +297 -0
- data/app/pb_kits/playbook/utilities/{props.js → props.ts} +9 -7
- 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 +47 -11
- data/app/pb_kits/playbook/types.js +0 -4
- data/app/pb_kits/playbook/utilities/globalProps.js +0 -97
@@ -1,11 +1,12 @@
|
|
1
1
|
/* @flow */
|
2
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
2
3
|
|
3
|
-
import React, { useEffect,
|
4
|
+
import React, { useEffect, useState } from 'react'
|
4
5
|
import classnames from 'classnames'
|
5
6
|
import inlineFocus from './inlineFocus'
|
6
7
|
import useFocus from './useFocus'
|
7
8
|
import { globalProps } from '../utilities/globalProps'
|
8
|
-
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
9
|
+
import { buildAriaProps, buildDataProps, noop } from '../utilities/props'
|
9
10
|
|
10
11
|
try {
|
11
12
|
const Trix = require('trix')
|
@@ -15,6 +16,8 @@ try {
|
|
15
16
|
}
|
16
17
|
} catch (_e) { /* do nothing */ }
|
17
18
|
|
19
|
+
import { TrixEditor } from "react-trix"
|
20
|
+
|
18
21
|
type RichTextEditorProps = {
|
19
22
|
aria?: object,
|
20
23
|
toolbarBottom?: Boolean,
|
@@ -24,7 +27,7 @@ type RichTextEditorProps = {
|
|
24
27
|
id?: string,
|
25
28
|
inline?: boolean,
|
26
29
|
name?: string,
|
27
|
-
onChange: (string) => void,
|
30
|
+
onChange: (html: string, text: string) => void,
|
28
31
|
placeholder?: string,
|
29
32
|
simple?: boolean,
|
30
33
|
sticky?: boolean,
|
@@ -39,129 +42,116 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
39
42
|
className,
|
40
43
|
data = {},
|
41
44
|
focus = false,
|
42
|
-
id,
|
43
45
|
inline = false,
|
44
46
|
name,
|
45
|
-
onChange,
|
47
|
+
onChange = noop,
|
46
48
|
placeholder,
|
47
49
|
simple = false,
|
48
50
|
sticky = false,
|
49
51
|
template = '',
|
50
52
|
value = '',
|
51
53
|
} = props
|
52
|
-
const trixRef = useRef()
|
53
|
-
const ariaProps = buildAriaProps(aria)
|
54
|
-
const dataProps = buildDataProps(data)
|
55
54
|
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
const ariaProps = buildAriaProps(aria),
|
56
|
+
dataProps = buildDataProps(data),
|
57
|
+
[editor, setEditor] = useState()
|
59
58
|
|
60
|
-
|
59
|
+
const handleOnEditorReady = (editorInstance) => setEditor(editorInstance),
|
60
|
+
element = editor?.element
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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]')
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
blockCodeButton.insertAdjacentElement('afterend', inlineCodeButton)
|
67
|
+
let inlineCodeButton = toolbarElement.querySelector('[data-trix-attribute=inlineCode]')
|
68
|
+
if (!inlineCodeButton) inlineCodeButton = blockCodeButton.cloneNode(true)
|
70
69
|
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
// set button attributes
|
71
|
+
inlineCodeButton.dataset.trixAttribute = 'inlineCode'
|
72
|
+
blockCodeButton.insertAdjacentElement('afterend', inlineCodeButton)
|
74
73
|
|
75
|
-
|
76
|
-
if (range[0] == range[1]) return 'block'
|
74
|
+
if (toolbarBottom) editor.element.after(toolbarElement)
|
77
75
|
|
78
|
-
|
79
|
-
|
80
|
-
|
76
|
+
const getCodeFormattingType = (): string => {
|
77
|
+
if (editor.attributeIsActive('code')) return 'block'
|
78
|
+
if (editor.attributeIsActive('inlineCode')) return 'inline'
|
81
79
|
|
82
|
-
|
83
|
-
|
84
|
-
blockCodeButton.hidden = type == 'inline'
|
85
|
-
inlineCodeButton.hidden = type == 'block'
|
86
|
-
})
|
80
|
+
const range = editor.getSelectedRange()
|
81
|
+
if (range[0] == range[1]) return 'block'
|
87
82
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
trixRef.current.addEventListener('trix-change', (event) => {
|
92
|
-
onChange && onChange(event.target.innerHTML)
|
93
|
-
})
|
94
|
-
}, [trixRef])
|
95
|
-
|
96
|
-
useEffect(() => {
|
97
|
-
const editor = trixRef.current.editorController.editor
|
98
|
-
if (template) {
|
99
|
-
editor.loadHTML('')
|
100
|
-
editor.setSelectedRange([0, 0])
|
101
|
-
editor.insertHTML(template)
|
83
|
+
const text = editor.getSelectedDocument().toString().trim()
|
84
|
+
return /\n/.test(text) ? 'block' : 'inline'
|
102
85
|
}
|
103
|
-
}, [template])
|
104
|
-
|
105
|
-
focus
|
106
|
-
? (document.addEventListener('trix-focus', useFocus),
|
107
|
-
document.addEventListener('trix-blur', useFocus),
|
108
|
-
useFocus())
|
109
|
-
: null
|
110
|
-
|
111
|
-
document.addEventListener('trix-focus', inlineFocus)
|
112
|
-
document.addEventListener('trix-blur', inlineFocus)
|
113
86
|
|
114
|
-
|
115
|
-
|
116
|
-
|
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
|
+
})
|
117
93
|
|
118
|
-
|
119
|
-
|
94
|
+
focus
|
95
|
+
? (document.addEventListener('trix-focus', useFocus),
|
96
|
+
document.addEventListener('trix-blur', useFocus),
|
97
|
+
useFocus())
|
98
|
+
: null
|
120
99
|
|
121
|
-
|
100
|
+
document.addEventListener('trix-focus', inlineFocus)
|
101
|
+
document.addEventListener('trix-blur', inlineFocus)
|
122
102
|
}
|
123
103
|
|
124
|
-
|
125
|
-
|
126
|
-
|
104
|
+
useEffect(() => {
|
105
|
+
if (!editor || !template) return
|
106
|
+
editor.loadHTML('')
|
107
|
+
editor.setSelectedRange([0, 0])
|
108
|
+
editor.insertHTML(template)
|
109
|
+
}, [editor, template])
|
127
110
|
|
128
111
|
useEffect(() => {
|
129
|
-
|
130
|
-
|
112
|
+
if (!element) return
|
113
|
+
element.addEventListener('click', ({target}) => {
|
114
|
+
const trixEditorContainer = target.closest('.pb_rich_text_editor_kit')
|
115
|
+
if (!trixEditorContainer) return
|
131
116
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
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
|
+
)
|
139
141
|
|
140
142
|
return (
|
141
143
|
<div
|
142
144
|
{...ariaProps}
|
143
145
|
{...dataProps}
|
144
|
-
className={
|
145
|
-
RichTextEditorClass,
|
146
|
-
SimpleClass,
|
147
|
-
FocusClass,
|
148
|
-
StickyClass,
|
149
|
-
InlineClass,
|
150
|
-
ToolbarBottomClass,
|
151
|
-
css
|
152
|
-
)}
|
146
|
+
className={css}
|
153
147
|
>
|
154
|
-
<
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
/>
|
160
|
-
<trix-editor
|
161
|
-
input={id}
|
162
|
-
name={name}
|
148
|
+
<TrixEditor
|
149
|
+
className=""
|
150
|
+
fileParamName={name}
|
151
|
+
onChange={onChange}
|
152
|
+
onEditorReady={handleOnEditorReady}
|
163
153
|
placeholder={placeholder}
|
164
|
-
|
154
|
+
value={value}
|
165
155
|
/>
|
166
156
|
</div>
|
167
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
|
@@ -4,7 +4,7 @@ import React, { forwardRef } from 'react'
|
|
4
4
|
import classnames from 'classnames'
|
5
5
|
|
6
6
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
7
|
-
import { globalProps } from '../utilities/globalProps'
|
7
|
+
import { globalProps, domSafeProps } from '../utilities/globalProps'
|
8
8
|
import type { InputCallback } from '../types'
|
9
9
|
|
10
10
|
import Body from '../pb_body/_body'
|
@@ -112,7 +112,7 @@ const Select = ({
|
|
112
112
|
{children}
|
113
113
|
<Else />
|
114
114
|
<select
|
115
|
-
{...props}
|
115
|
+
{...domSafeProps(props)}
|
116
116
|
disabled={disabled}
|
117
117
|
id={name}
|
118
118
|
multiple={multiple}
|
@@ -4,10 +4,10 @@ module Playbook
|
|
4
4
|
module PbStatValue
|
5
5
|
class StatValue < Playbook::KitBase
|
6
6
|
prop :unit
|
7
|
-
prop :value, type: Playbook::Props::
|
7
|
+
prop :value, type: Playbook::Props::Numeric
|
8
8
|
|
9
9
|
def formatted_value
|
10
|
-
number_with_delimiter(value, delimiter: ",")
|
10
|
+
number_with_delimiter(value, delimiter: ",", separator: ".")
|
11
11
|
end
|
12
12
|
|
13
13
|
def classname
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import React, { type Node } from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
import PbTable from './'
|
8
8
|
|
9
9
|
type TableProps = {
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import React from 'react'
|
3
3
|
import classnames from 'classnames'
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
5
|
-
import { globalProps } from '../utilities/globalProps
|
5
|
+
import { globalProps } from '../utilities/globalProps'
|
6
6
|
|
7
7
|
type TableRowPropTypes = {
|
8
8
|
aria?: object,
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import React, { forwardRef } from 'react'
|
3
3
|
import classnames from 'classnames'
|
4
4
|
|
5
|
-
import { globalProps } from '../utilities/globalProps
|
5
|
+
import { globalProps, domSafeProps } from '../utilities/globalProps'
|
6
6
|
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
7
7
|
|
8
8
|
import Flex from '../pb_flex/_flex'
|
@@ -37,10 +37,11 @@ type TextInputProps = {
|
|
37
37
|
|
38
38
|
const TextInput = (props: TextInputProps, ref: React.ElementRef<"input">) => {
|
39
39
|
const {
|
40
|
+
addOn = { icon: null, alignment: 'right', border: true },
|
40
41
|
aria = {},
|
41
42
|
className,
|
42
|
-
data = {},
|
43
43
|
dark = false,
|
44
|
+
data = {},
|
44
45
|
disabled,
|
45
46
|
error,
|
46
47
|
id,
|
@@ -53,7 +54,6 @@ const TextInput = (props: TextInputProps, ref: React.ElementRef<"input">) => {
|
|
53
54
|
type = 'text',
|
54
55
|
value = '',
|
55
56
|
children = null,
|
56
|
-
addOn = { icon: null, alignment: 'right', border: true },
|
57
57
|
} = props
|
58
58
|
|
59
59
|
const ariaProps = buildAriaProps(aria)
|
@@ -85,10 +85,11 @@ const TextInput = (props: TextInputProps, ref: React.ElementRef<"input">) => {
|
|
85
85
|
)
|
86
86
|
const textInput = (
|
87
87
|
<input
|
88
|
-
{...props}
|
88
|
+
{...domSafeProps(props)}
|
89
89
|
className="text_input"
|
90
90
|
disabled={disabled}
|
91
91
|
id={id}
|
92
|
+
key={id}
|
92
93
|
name={name}
|
93
94
|
onChange={onChange}
|
94
95
|
placeholder={placeholder}
|
@@ -107,21 +108,25 @@ const TextInput = (props: TextInputProps, ref: React.ElementRef<"input">) => {
|
|
107
108
|
vertical="center"
|
108
109
|
>
|
109
110
|
<If condition={addOnAlignment == 'left'}>
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
111
|
+
<>
|
112
|
+
<Card
|
113
|
+
className={`${addOnDarkModeCardCss} add-on-card card-left-aligned`}
|
114
|
+
dark={dark}
|
115
|
+
>
|
116
|
+
{addOnIcon}
|
117
|
+
</Card>
|
118
|
+
{textInput}
|
119
|
+
</>
|
120
|
+
<Else />
|
121
|
+
<>
|
122
|
+
{textInput}
|
123
|
+
<Card
|
124
|
+
className={`${addOnDarkModeCardCss} add-on-card card-right-aligned`}
|
125
|
+
dark={dark}
|
126
|
+
>
|
127
|
+
{addOnIcon}
|
128
|
+
</Card>
|
129
|
+
</>
|
125
130
|
</If>
|
126
131
|
</Flex>
|
127
132
|
</React.Fragment>
|
@@ -4,12 +4,12 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
[class^=pb_text_input_kit] {
|
7
|
+
margin-bottom: $space_sm;
|
7
8
|
.pb_text_input_kit_label {
|
8
9
|
margin-bottom: $space_xs;
|
9
10
|
display: block;
|
10
11
|
}
|
11
12
|
.text_input_wrapper {
|
12
|
-
margin-bottom: $space_sm;
|
13
13
|
display: block;
|
14
14
|
input::placeholder,
|
15
15
|
.text_input .placeholder {
|
@@ -75,3 +75,17 @@ test('returns additional class name', () => {
|
|
75
75
|
const kit = screen.getByTestId(testId)
|
76
76
|
expect(kit).toHaveClass(`${kitClass} dark error`)
|
77
77
|
})
|
78
|
+
|
79
|
+
test('returns additional class name', () => {
|
80
|
+
render(
|
81
|
+
<TextInput
|
82
|
+
data={{ testid: testId }}
|
83
|
+
label="First Name"
|
84
|
+
marginBottom="lg"
|
85
|
+
placeholder="Enter first name"
|
86
|
+
/>
|
87
|
+
)
|
88
|
+
|
89
|
+
const kit = screen.getByTestId(testId)
|
90
|
+
expect(kit).toHaveClass(`${kitClass} mb_lg`)
|
91
|
+
})
|
@@ -5,7 +5,7 @@ import classnames from 'classnames'
|
|
5
5
|
|
6
6
|
import DateTime from '../pb_kit/dateTime.js'
|
7
7
|
import { buildCss } from '../utilities/props'
|
8
|
-
import { globalProps } from '../utilities/globalProps
|
8
|
+
import { globalProps } from '../utilities/globalProps'
|
9
9
|
|
10
10
|
import Body from '../pb_body/_body'
|
11
11
|
import Caption from '../pb_caption/_caption'
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { deprecatedProps, globalProps } from '../utilities/globalProps
|
6
|
+
import { deprecatedProps, globalProps } from '../utilities/globalProps'
|
7
7
|
|
8
8
|
type TitleProps = {
|
9
9
|
aria?: object,
|
@@ -6,7 +6,7 @@ import AsyncSelect from 'react-select/async'
|
|
6
6
|
import CreateableSelect from 'react-select/creatable'
|
7
7
|
import AsyncCreateableSelect from 'react-select/async-creatable'
|
8
8
|
import { get, isString, uniqueId } from 'lodash'
|
9
|
-
import { globalProps } from '../utilities/globalProps
|
9
|
+
import { globalProps } from '../utilities/globalProps'
|
10
10
|
import classnames from 'classnames'
|
11
11
|
|
12
12
|
import Control from './components/Control'
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import React from 'react'
|
3
3
|
import classnames from 'classnames'
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
5
|
-
import { globalProps } from '../utilities/globalProps
|
5
|
+
import { globalProps } from '../utilities/globalProps'
|
6
6
|
|
7
7
|
type UserBadgeProps = {
|
8
8
|
aria?: object,
|
@@ -6,7 +6,7 @@
|
|
6
6
|
import React from 'react'
|
7
7
|
import classnames from 'classnames'
|
8
8
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
9
|
-
import { globalProps } from '../utilities/globalProps
|
9
|
+
import { globalProps } from '../utilities/globalProps'
|
10
10
|
import Joyride from 'react-joyride'
|
11
11
|
import Button from '../pb_button/_button'
|
12
12
|
import Flex from '../pb_flex/_flex'
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
|
-
import { globalProps } from '../utilities/globalProps
|
5
|
+
import { globalProps } from '../utilities/globalProps'
|
6
6
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
7
7
|
|
8
8
|
import Caption from '../pb_caption/_caption'
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import Highcharts from 'highcharts'
|
2
2
|
|
3
3
|
import { highchartsTheme } from '../pb_dashboard/pbChartsLightTheme'
|
4
|
+
import { highchartsDarkTheme } from '../pb_dashboard/pbChartsDarkTheme'
|
4
5
|
import colors from '../tokens/exports/_colors.scss'
|
5
6
|
|
6
7
|
import pie from 'highcharts/modules/variable-pie'
|
@@ -67,10 +68,14 @@ class pbChart {
|
|
67
68
|
}
|
68
69
|
}
|
69
70
|
|
71
|
+
setupTheme() {
|
72
|
+
this.options.dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme)
|
73
|
+
}
|
74
|
+
|
70
75
|
setupGauge(options) {
|
71
76
|
highchartsMore(Highcharts)
|
72
77
|
solidGauge(Highcharts)
|
73
|
-
|
78
|
+
this.setupTheme()
|
74
79
|
|
75
80
|
Highcharts.chart(this.defaults.id, {
|
76
81
|
chart: {
|
@@ -140,7 +145,7 @@ class pbChart {
|
|
140
145
|
}
|
141
146
|
|
142
147
|
setupPieChart(options) {
|
143
|
-
|
148
|
+
this.setupTheme()
|
144
149
|
Highcharts.chart(this.defaults.id, {
|
145
150
|
title: {
|
146
151
|
text: this.defaults.title,
|
@@ -187,8 +192,7 @@ class pbChart {
|
|
187
192
|
}
|
188
193
|
|
189
194
|
setupChart(options) {
|
190
|
-
|
191
|
-
|
195
|
+
this.setupTheme()
|
192
196
|
const configOptions = {
|
193
197
|
title: {
|
194
198
|
text: this.defaults.title,
|
@@ -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
|
+
}
|