playbook_ui 15.5.0.pre.rc.0 → 15.5.0.pre.rc.2
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_currency/docs/_currency_abbreviated.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +10 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +10 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +7 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +7 -0
- data/app/pb_kits/playbook/pb_currency/docs/_description.md +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +44 -3
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.rb +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +14 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +33 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +22 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +2 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.md +1 -0
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.html.erb +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.md +11 -0
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.md +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.md +1 -0
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.md +2 -2
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.md +1 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.md +1 -0
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +8 -61
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +2 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +11 -19
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +7 -16
- data/app/pb_kits/playbook/pb_table/_table.tsx +28 -26
- data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
- data/dist/chunks/{_line_graph-eQNOB_GQ.js → _line_graph-BuucBJlH.js} +1 -1
- data/dist/chunks/_typeahead-VFd5WMRg.js +6 -0
- data/dist/chunks/{_weekday_stacked-CvJHyUq6.js → _weekday_stacked-B4_b9xef.js} +2 -2
- data/dist/chunks/{lib-BCrK6CFU.js → lib-COXg9aPA.js} +1 -1
- data/dist/chunks/{pb_form_validation-Cj4vdjWI.js → pb_form_validation-DR765aoq.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +19 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +25 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default_rails.md +0 -7
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline_rails.md +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky_rails.md +0 -1
- data/dist/chunks/_typeahead-vbfetkuE.js +0 -24
|
@@ -2,10 +2,6 @@ import React, { useEffect, useState, useRef } from 'react'
|
|
|
2
2
|
import classnames from 'classnames'
|
|
3
3
|
import { TrixEditor } from 'react-trix'
|
|
4
4
|
|
|
5
|
-
import { useEditor, EditorContent } from '@tiptap/react'
|
|
6
|
-
import StarterKit from '@tiptap/starter-kit'
|
|
7
|
-
import Link from '@tiptap/extension-link'
|
|
8
|
-
|
|
9
5
|
import inlineFocus from './inlineFocus'
|
|
10
6
|
import useFocus from './useFocus'
|
|
11
7
|
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
|
@@ -52,8 +48,7 @@ type RichTextEditorProps = {
|
|
|
52
48
|
sticky?: boolean,
|
|
53
49
|
template: string,
|
|
54
50
|
value?: string,
|
|
55
|
-
maxWidth?: string
|
|
56
|
-
railsEditor?: boolean
|
|
51
|
+
maxWidth?: string
|
|
57
52
|
} & GlobalProps
|
|
58
53
|
|
|
59
54
|
const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
@@ -86,27 +81,6 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
|
86
81
|
[showToolbarOnFocus, setShowToolbarOnFocus] = useState(false),
|
|
87
82
|
containerRef = useRef<HTMLDivElement>(null)
|
|
88
83
|
|
|
89
|
-
const isRails = !advancedEditor && props.railsEditor === true
|
|
90
|
-
|
|
91
|
-
// TipTap editor for Rails (hook always runs per React rules, but only used when isRails is true)
|
|
92
|
-
const railsTipTapEditor = useEditor({
|
|
93
|
-
extensions: [StarterKit, Link],
|
|
94
|
-
content: value || '',
|
|
95
|
-
onUpdate: ({ editor }) => {
|
|
96
|
-
if (!isRails) return
|
|
97
|
-
|
|
98
|
-
const html = editor.getHTML()
|
|
99
|
-
const text = editor.getText()
|
|
100
|
-
onChange(html, text)
|
|
101
|
-
|
|
102
|
-
// Update hidden input for TipTap Rails form submission
|
|
103
|
-
const hiddenInput = document.getElementById(`hidden-input-${props.id || 'rich-text-editor'}`)
|
|
104
|
-
if (hiddenInput) {
|
|
105
|
-
(hiddenInput as HTMLInputElement).value = html ?? ''
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
}, [isRails, value])
|
|
109
|
-
|
|
110
84
|
const htmlProps = buildHtmlProps(htmlOptions)
|
|
111
85
|
|
|
112
86
|
const handleOnEditorReady = (editorInstance: Editor) => {
|
|
@@ -166,8 +140,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
|
166
140
|
}
|
|
167
141
|
|
|
168
142
|
useEffect(() => {
|
|
169
|
-
|
|
170
|
-
if (!tiptapEditor || !focus) return
|
|
143
|
+
if (!advancedEditor || !focus) return
|
|
171
144
|
|
|
172
145
|
const handleFocus = () => setShowToolbarOnFocus(true)
|
|
173
146
|
|
|
@@ -176,7 +149,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
|
176
149
|
setShowToolbarOnFocus(false)
|
|
177
150
|
}
|
|
178
151
|
|
|
179
|
-
const editorElement =
|
|
152
|
+
const editorElement = advancedEditor?.view?.dom
|
|
180
153
|
if (editorElement) {
|
|
181
154
|
editorElement.addEventListener('focus', handleFocus)
|
|
182
155
|
}
|
|
@@ -189,7 +162,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
|
189
162
|
}
|
|
190
163
|
document.removeEventListener('mousedown', handleClickOutside)
|
|
191
164
|
}
|
|
192
|
-
}, [advancedEditor,
|
|
165
|
+
}, [advancedEditor, focus])
|
|
193
166
|
|
|
194
167
|
//============= end focus prop with advanced editor=================
|
|
195
168
|
|
|
@@ -200,17 +173,6 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
|
200
173
|
editor.insertHTML(template)
|
|
201
174
|
}, [editor, template])
|
|
202
175
|
|
|
203
|
-
// Handle value prop changes for Rails TipTap editor
|
|
204
|
-
useEffect(() => {
|
|
205
|
-
if (!railsTipTapEditor) return
|
|
206
|
-
const currentContent = railsTipTapEditor.getHTML()
|
|
207
|
-
const newValue = value || ''
|
|
208
|
-
|
|
209
|
-
if (currentContent !== newValue) {
|
|
210
|
-
railsTipTapEditor.commands.setContent(newValue)
|
|
211
|
-
}
|
|
212
|
-
}, [railsTipTapEditor, value])
|
|
213
|
-
|
|
214
176
|
useEffect(() => {
|
|
215
177
|
if (!editor?.element) return
|
|
216
178
|
editor.element.addEventListener('click', ({ target }: Event) => {
|
|
@@ -238,11 +200,8 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
|
238
200
|
className
|
|
239
201
|
)
|
|
240
202
|
|
|
241
|
-
// Get the TipTap editor instance (either passed from React or auto-initialized for Rails)
|
|
242
|
-
const tipTapEditor = advancedEditor || (isRails ? railsTipTapEditor : null)
|
|
243
|
-
|
|
244
203
|
// Determine if toolbar should be shown
|
|
245
|
-
const shouldShowToolbar = focus &&
|
|
204
|
+
const shouldShowToolbar = focus && advancedEditor ? showToolbarOnFocus : advancedEditorToolbar
|
|
246
205
|
|
|
247
206
|
return (
|
|
248
207
|
<div
|
|
@@ -253,32 +212,20 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
|
253
212
|
ref={focus ? containerRef : undefined}
|
|
254
213
|
>
|
|
255
214
|
{
|
|
256
|
-
|
|
257
|
-
tipTapEditor ? (
|
|
215
|
+
advancedEditor ? (
|
|
258
216
|
<div
|
|
259
217
|
className={classnames("pb_rich_text_editor_advanced_container", {
|
|
260
218
|
["toolbar-active"]: shouldShowToolbar,
|
|
261
219
|
})}
|
|
262
220
|
>
|
|
263
221
|
{shouldShowToolbar && (
|
|
264
|
-
<EditorToolbar editor={
|
|
222
|
+
<EditorToolbar editor={advancedEditor}
|
|
265
223
|
extensions={extensions}
|
|
266
224
|
simple={simple}
|
|
267
225
|
sticky={sticky}
|
|
268
226
|
/>
|
|
269
227
|
)}
|
|
270
|
-
|
|
271
|
-
{railsTipTapEditor ? <EditorContent editor={tipTapEditor} /> : <>{children}</>}
|
|
272
|
-
|
|
273
|
-
{/* Set up hidden input for TipTap Rails form submission */}
|
|
274
|
-
{railsTipTapEditor && (
|
|
275
|
-
<input
|
|
276
|
-
id={`hidden-input-${props.id || 'rich-text-editor'}`}
|
|
277
|
-
name={name || 'content'}
|
|
278
|
-
type="hidden"
|
|
279
|
-
value={tipTapEditor?.getHTML() ?? ''}
|
|
280
|
-
/>
|
|
281
|
-
)}
|
|
228
|
+
{ children }
|
|
282
229
|
</div>
|
|
283
230
|
) : (
|
|
284
231
|
<TrixEditor
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
<%= pb_rails("rich_text_editor", props: {
|
|
2
|
-
id: "focus-editor-1",
|
|
3
|
-
focus: true,
|
|
4
|
-
value: "Click inside to see the toolbar. Click outside to hide it."
|
|
5
|
-
}) %>
|
|
1
|
+
<%= pb_rails("rich_text_editor", props: {focus: true}) %>
|
|
6
2
|
<br>
|
|
7
|
-
<%= pb_rails("rich_text_editor", props: {
|
|
8
|
-
id: "focus-editor-2",
|
|
9
|
-
focus: true,
|
|
10
|
-
value: "When the optional focus prop is set to true, the toolbar will only show once you click in to the RichTextEditor."
|
|
11
|
-
}) %>
|
|
3
|
+
<%= pb_rails("rich_text_editor", props: {focus: true}) %>
|
|
@@ -1,38 +1,30 @@
|
|
|
1
|
-
<%= pb_rails("rich_text_editor", props: {
|
|
2
|
-
id: "content-preview-editor",
|
|
3
|
-
margin_bottom: "md",
|
|
4
|
-
value: "Add text here, format it, and press \"Preview Output\" to see what your stylized output will look like on the page."
|
|
5
|
-
}) %>
|
|
6
|
-
|
|
7
|
-
<%= pb_rails("button", props: { id: "preview-button", text: "Preview Output", variant: "secondary" }) %>
|
|
8
1
|
|
|
2
|
+
<%= pb_rails("rich_text_editor", props: { id: "content-preview-editor" }) %>
|
|
9
3
|
<div id="card-obfuscation" style="display:none">
|
|
10
4
|
<%= pb_rails("card", props: { margin_top: "md", max_width: "md", padding: "sm" }) do %>
|
|
11
|
-
<div id="content-preview" class="
|
|
5
|
+
<div id="content-preview" class="trix-content">
|
|
12
6
|
</div>
|
|
13
7
|
<% end %>
|
|
14
8
|
</div>
|
|
9
|
+
<%= pb_rails("button", props: { id: "preview-button", variant: "secondary", margin_top: "md" }) do %>
|
|
10
|
+
<span>Preview Output</span>
|
|
11
|
+
<% end %>
|
|
15
12
|
|
|
16
13
|
<script>
|
|
17
14
|
document.addEventListener('DOMContentLoaded', () => {
|
|
18
15
|
function handleButtonClick() {
|
|
19
|
-
// Find the specific TipTap editor container by ID
|
|
20
16
|
const editorContainer = [...document.querySelectorAll('[data-pb-react-props]')]
|
|
21
17
|
.find(element => element.getAttribute('data-pb-react-props')?.includes('"id":"content-preview-editor"'))
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Find the TipTap editor content
|
|
29
|
-
const tiptapEditor = editorContainer.querySelector('.ProseMirror')
|
|
19
|
+
const editorElement = editorContainer?.querySelector('trix-editor')
|
|
20
|
+
const inputId = editorElement?.getAttribute('input')
|
|
21
|
+
const inputElement = inputId && document.getElementById(inputId)
|
|
22
|
+
|
|
23
|
+
const editorContent = inputElement?.value || ''
|
|
30
24
|
const previewArea = document.getElementById('content-preview')
|
|
31
25
|
const cardDiv = document.getElementById('card-obfuscation')
|
|
32
26
|
|
|
33
|
-
if (
|
|
34
|
-
// Get the HTML content from the TipTap editor
|
|
35
|
-
const editorContent = tiptapEditor.innerHTML || ''
|
|
27
|
+
if (previewArea && cardDiv) {
|
|
36
28
|
previewArea.innerHTML = editorContent
|
|
37
29
|
cardDiv.style.display = 'block'
|
|
38
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= pb_rails("rich_text_editor", props: {id: "sticky
|
|
1
|
+
<%= pb_rails("rich_text_editor", props: {id: "sticky", sticky: true, 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."}) %>
|
|
@@ -3,10 +3,10 @@ examples:
|
|
|
3
3
|
rails:
|
|
4
4
|
- rich_text_editor_default: Default
|
|
5
5
|
- rich_text_editor_simple: Simple
|
|
6
|
-
|
|
6
|
+
- rich_text_editor_attributes: Attributes
|
|
7
7
|
- rich_text_editor_focus: Focus
|
|
8
8
|
- rich_text_editor_sticky: Sticky
|
|
9
|
-
|
|
9
|
+
- rich_text_editor_templates: Templates
|
|
10
10
|
# - rich_text_editor_toolbar_bottom: Toolbar Bottom
|
|
11
11
|
- rich_text_editor_inline: Inline
|
|
12
12
|
- rich_text_editor_preview: Preview
|
|
@@ -18,15 +18,9 @@ module Playbook
|
|
|
18
18
|
default: false
|
|
19
19
|
|
|
20
20
|
prop :value
|
|
21
|
+
prop :template
|
|
21
22
|
prop :placeholder
|
|
22
23
|
prop :input_options
|
|
23
|
-
prop :advanced_editor_toolbar, type: Playbook::Props::Boolean,
|
|
24
|
-
default: true
|
|
25
|
-
prop :extensions, type: Playbook::Props::HashArray,
|
|
26
|
-
default: []
|
|
27
|
-
prop :max_width, type: Playbook::Props::Enum,
|
|
28
|
-
values: %w[xs sm md lg xl],
|
|
29
|
-
default: "md"
|
|
30
24
|
|
|
31
25
|
def classname
|
|
32
26
|
generate_classname("pb_rich_text_editor_kit", simple_class, focus_class, sticky_class, separator: " ")
|
|
@@ -46,20 +40,17 @@ module Playbook
|
|
|
46
40
|
|
|
47
41
|
def rich_text_options
|
|
48
42
|
{
|
|
49
|
-
advancedEditorToolbar: advanced_editor_toolbar,
|
|
50
|
-
className: classname,
|
|
51
|
-
extensions: extensions,
|
|
52
|
-
focus: focus,
|
|
53
43
|
id: id,
|
|
54
44
|
inline: inline,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
placeholder: placeholder,
|
|
58
|
-
railsEditor: true,
|
|
45
|
+
className: classname,
|
|
46
|
+
focus: focus,
|
|
59
47
|
simple: simple,
|
|
60
48
|
sticky: sticky,
|
|
61
49
|
toolbarBottom: toolbar_bottom,
|
|
62
|
-
value: value
|
|
50
|
+
value: value,
|
|
51
|
+
template: template,
|
|
52
|
+
placeholder: placeholder,
|
|
53
|
+
inputOptions: input_options,
|
|
63
54
|
}
|
|
64
55
|
end
|
|
65
56
|
end
|
|
@@ -119,21 +119,22 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
|
119
119
|
header.classList.add('sticky-left-shadow');
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
const headerWidth = (header as HTMLElement).offsetWidth;
|
|
123
|
+
accumulatedWidth += headerWidth;
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
cells.forEach((cell) => {
|
|
126
|
+
cell.classList.add('sticky');
|
|
127
|
+
(cell as HTMLElement).style.left = `${accumulatedWidth - headerWidth}px`;
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
129
|
+
if (!isLastColumn) {
|
|
130
|
+
cell.classList.add('with-border-right');
|
|
131
|
+
cell.classList.remove('sticky-left-shadow');
|
|
132
|
+
} else {
|
|
133
|
+
cell.classList.remove('with-border-right');
|
|
134
|
+
cell.classList.add('sticky-left-shadow');
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
137
138
|
});
|
|
138
139
|
};
|
|
139
140
|
|
|
@@ -170,21 +171,22 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
|
170
171
|
header.classList.add('sticky-right-shadow');
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
const headerWidth = (header as HTMLElement).offsetWidth;
|
|
175
|
+
accumulatedWidth += headerWidth;
|
|
175
176
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
cells.forEach((cell) => {
|
|
178
|
+
cell.classList.add('sticky');
|
|
179
|
+
(cell as HTMLElement).style.right = `${accumulatedWidth - headerWidth}px`;
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
if (!isLastColumn) {
|
|
182
|
+
cell.classList.add('with-border-left');
|
|
183
|
+
cell.classList.remove('sticky-right-shadow');
|
|
184
|
+
} else {
|
|
185
|
+
cell.classList.remove('with-border-left');
|
|
186
|
+
cell.classList.add('sticky-right-shadow');
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
188
190
|
});
|
|
189
191
|
};
|
|
190
192
|
|
|
@@ -213,10 +213,24 @@ export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
|
|
213
213
|
|
|
214
214
|
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
|
215
215
|
const keys: string[] = Object.keys(prop)
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
const screenSizeValues = ["xs", "sm", "md", "lg", "xl"]
|
|
217
|
+
let classResult = ''
|
|
218
|
+
|
|
219
|
+
// Handle default value separately (generates base class without size prefix)
|
|
220
|
+
if (prop.default !== undefined) {
|
|
221
|
+
const defaultValue: string = typeof(prop.default) === 'string' ? camelToSnakeCase(prop.default) : prop.default
|
|
222
|
+
classResult += `${classPrefix}_${defaultValue} `
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Handle responsive sizes (generates classes with size prefix)
|
|
226
|
+
keys.forEach((key) => {
|
|
227
|
+
if (screenSizeValues.includes(key)) {
|
|
228
|
+
const propValue: string = typeof(prop[key]) === 'string' ? camelToSnakeCase(prop[key]) : prop[key]
|
|
229
|
+
classResult += `${classPrefix}_${key}_${propValue} `
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
return classResult.trim()
|
|
220
234
|
}
|
|
221
235
|
|
|
222
236
|
//reusable function for top, bottom, right and left props
|
|
@@ -436,9 +450,11 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
|
436
450
|
if (typeof zIndexEntry[1] == "number") {
|
|
437
451
|
css += `z_index_${zIndexEntry[1]} `
|
|
438
452
|
} else if (typeof zIndexEntry[1] == "object") {
|
|
439
|
-
|
|
440
|
-
|
|
453
|
+
const responsiveObj: {[key: string]: string} = {}
|
|
454
|
+
Object.entries(zIndexEntry[1]).forEach(([key, value]) => {
|
|
455
|
+
responsiveObj[key] = value.toString()
|
|
441
456
|
})
|
|
457
|
+
css += getResponsivePropClasses(responsiveObj, 'z_index')
|
|
442
458
|
} else if (zIndexEntry[1] === 'max') {
|
|
443
459
|
css += `z_index_max `
|
|
444
460
|
}
|
|
@@ -463,9 +479,11 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
|
463
479
|
if (typeof displayEntry[1] == "string") {
|
|
464
480
|
css += `display_${displayEntry[1]} `
|
|
465
481
|
} else if (typeof displayEntry[1] == "object") {
|
|
466
|
-
|
|
467
|
-
|
|
482
|
+
const responsiveObj: {[key: string]: string} = {}
|
|
483
|
+
Object.entries(displayEntry[1]).forEach(([key, value]) => {
|
|
484
|
+
responsiveObj[key] = typeof value === 'string' ? value : value.toString()
|
|
468
485
|
})
|
|
486
|
+
css += getResponsivePropClasses(responsiveObj, 'display')
|
|
469
487
|
} else {
|
|
470
488
|
' '
|
|
471
489
|
}
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
alignContent={{ default: "spaceAround", xs: "center", sm: "spaceAround", md: "center" }}
|
|
44
|
+
data={{ testid: testId }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`align_content_space_around`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`align_content_xs_center`)
|
|
53
|
+
expect(kit).toHaveClass(`align_content_sm_space_around`)
|
|
54
|
+
expect(kit).toHaveClass(`align_content_md_center`)
|
|
55
|
+
})
|
|
@@ -34,3 +34,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
34
34
|
})
|
|
35
35
|
}
|
|
36
36
|
})
|
|
37
|
+
|
|
38
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
39
|
+
const testId = `${testSubject}-default-responsive`
|
|
40
|
+
render(
|
|
41
|
+
<Body
|
|
42
|
+
alignItems={{ default: "end", xs: "center", sm: "end", md: "center" }}
|
|
43
|
+
data={{ testid: testId }}
|
|
44
|
+
text="Hi"
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
const kit = screen.getByTestId(testId)
|
|
48
|
+
// Should have base class for default value
|
|
49
|
+
expect(kit).toHaveClass(`align_items_end`)
|
|
50
|
+
// Should have responsive classes for screen sizes
|
|
51
|
+
expect(kit).toHaveClass(`align_items_xs_center`)
|
|
52
|
+
expect(kit).toHaveClass(`align_items_sm_end`)
|
|
53
|
+
expect(kit).toHaveClass(`align_items_md_center`)
|
|
54
|
+
})
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
alignSelf={{ default: "end", xs: "center", sm: "end", md: "center" }}
|
|
44
|
+
data={{ testid: testId }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`align_self_end`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`align_self_xs_center`)
|
|
53
|
+
expect(kit).toHaveClass(`align_self_sm_end`)
|
|
54
|
+
expect(kit).toHaveClass(`align_self_md_center`)
|
|
55
|
+
})
|
|
@@ -36,3 +36,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
36
36
|
})
|
|
37
37
|
}
|
|
38
38
|
})
|
|
39
|
+
|
|
40
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
41
|
+
const testId = `${testSubject}-default-responsive`
|
|
42
|
+
render(
|
|
43
|
+
<Body
|
|
44
|
+
data={{ testid: testId }}
|
|
45
|
+
display={{ default: "none", xs: "block", sm: "none", md: "block" }}
|
|
46
|
+
text="Hi"
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
const kit = screen.getByTestId(testId)
|
|
50
|
+
// Should have base class for default value
|
|
51
|
+
expect(kit).toHaveClass(`display_none`)
|
|
52
|
+
// Should have responsive classes for screen sizes
|
|
53
|
+
expect(kit).toHaveClass(`display_xs_block`)
|
|
54
|
+
expect(kit).toHaveClass(`display_sm_none`)
|
|
55
|
+
expect(kit).toHaveClass(`display_md_block`)
|
|
56
|
+
})
|
|
@@ -62,3 +62,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
62
62
|
})
|
|
63
63
|
}
|
|
64
64
|
})
|
|
65
|
+
|
|
66
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
67
|
+
const testId = `${testSubject}-default-responsive`
|
|
68
|
+
render(
|
|
69
|
+
<Body
|
|
70
|
+
data={{ testid: testId }}
|
|
71
|
+
flex={{ default: "3", xs: "1", sm: "3", md: "1" }}
|
|
72
|
+
text="Hi"
|
|
73
|
+
/>
|
|
74
|
+
)
|
|
75
|
+
const kit = screen.getByTestId(testId)
|
|
76
|
+
// Should have base class for default value
|
|
77
|
+
expect(kit).toHaveClass(`flex_3`)
|
|
78
|
+
// Should have responsive classes for screen sizes
|
|
79
|
+
expect(kit).toHaveClass(`flex_xs_1`)
|
|
80
|
+
expect(kit).toHaveClass(`flex_sm_3`)
|
|
81
|
+
expect(kit).toHaveClass(`flex_md_1`)
|
|
82
|
+
})
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
data={{ testid: testId }}
|
|
44
|
+
flexDirection={{ default: "column", xs: "row", sm: "column", md: "row" }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`flex_direction_column`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`flex_direction_xs_row`)
|
|
53
|
+
expect(kit).toHaveClass(`flex_direction_sm_column`)
|
|
54
|
+
expect(kit).toHaveClass(`flex_direction_md_row`)
|
|
55
|
+
})
|
|
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
|
+
|
|
37
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
38
|
+
const testId = `${testSubject}-default-responsive`
|
|
39
|
+
render(
|
|
40
|
+
<Body
|
|
41
|
+
data={{ testid: testId }}
|
|
42
|
+
flexGrow={{ default: 1, xs: 0, sm: 1, md: 0 }}
|
|
43
|
+
text="Hi"
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
const kit = screen.getByTestId(testId)
|
|
47
|
+
// Should have base class for default value
|
|
48
|
+
expect(kit).toHaveClass(`flex_grow_1`)
|
|
49
|
+
// Should have responsive classes for screen sizes
|
|
50
|
+
expect(kit).toHaveClass(`flex_grow_xs_0`)
|
|
51
|
+
expect(kit).toHaveClass(`flex_grow_sm_1`)
|
|
52
|
+
expect(kit).toHaveClass(`flex_grow_md_0`)
|
|
53
|
+
})
|
|
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
|
+
|
|
37
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
38
|
+
const testId = `${testSubject}-default-responsive`
|
|
39
|
+
render(
|
|
40
|
+
<Body
|
|
41
|
+
data={{ testid: testId }}
|
|
42
|
+
flexShrink={{ default: 0, xs: 1, sm: 0, md: 1 }}
|
|
43
|
+
text="Hi"
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
const kit = screen.getByTestId(testId)
|
|
47
|
+
// Should have base class for default value
|
|
48
|
+
expect(kit).toHaveClass(`flex_shrink_0`)
|
|
49
|
+
// Should have responsive classes for screen sizes
|
|
50
|
+
expect(kit).toHaveClass(`flex_shrink_xs_1`)
|
|
51
|
+
expect(kit).toHaveClass(`flex_shrink_sm_0`)
|
|
52
|
+
expect(kit).toHaveClass(`flex_shrink_md_1`)
|
|
53
|
+
})
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
data={{ testid: testId }}
|
|
44
|
+
flexWrap={{ default: "wrap", xs: "nowrap", sm: "wrap", md: "nowrap" }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`flex_wrap_wrap`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`flex_wrap_xs_nowrap`)
|
|
53
|
+
expect(kit).toHaveClass(`flex_wrap_sm_wrap`)
|
|
54
|
+
expect(kit).toHaveClass(`flex_wrap_md_nowrap`)
|
|
55
|
+
})
|