playbook_ui 12.9.1.pre.alpha.play664tiptapinvestigation353 → 12.10.0.pre.alpha.PLAY677richtexteditorts370
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/pb_body/docs/_body_articles.html.erb +8 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_articles.jsx +20 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_articles.md +1 -0
- data/app/pb_kits/playbook/pb_body/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_body/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_map/_map.scss +153 -31
- data/app/pb_kits/playbook/pb_map/_pb_map_button_mixin.scss +53 -0
- data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +1 -2
- data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +29 -8
- data/app/pb_kits/playbook/pb_nav/{_item.jsx → _item.tsx} +38 -36
- data/app/pb_kits/playbook/pb_nav/_nav.test.js +119 -0
- data/app/pb_kits/playbook/pb_nav/{_nav.jsx → _nav.tsx} +19 -20
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +83 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/{_rich_text_editor.jsx → _rich_text_editor.tsx} +42 -46
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/{inlineFocus.js → inlineFocus.ts} +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/{useFocus.js → useFocus.ts} +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +6 -4
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_no_label.html.erb +4 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_no_label.jsx +23 -0
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
- data/lib/playbook/pb_doc_helper.rb +8 -3
- data/lib/playbook/version.rb +2 -2
- metadata +16 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap.jsx +0 -66
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_tip_tap.jsx +0 -15
- /data/{app/pb_kits/playbook/data → dist}/menu.yml +0 -0
@@ -0,0 +1,119 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import Nav from './_nav'
|
5
|
+
import NavItem from './_item'
|
6
|
+
|
7
|
+
const navTestId = 'nav'
|
8
|
+
const itemTestId = 'item'
|
9
|
+
const navClassName = 'custom-class-name-nav'
|
10
|
+
const itemClassName = 'custom-class-name-item'
|
11
|
+
const navTitle = 'Menu'
|
12
|
+
const itemTitle = 'Photos'
|
13
|
+
const itemImageUrl = 'https://upload.wikimedia.org/wikipedia/commons/0/00/Apple_News_icon_%28macOS%29.png'
|
14
|
+
|
15
|
+
const NavDefault = (props = []) => {
|
16
|
+
return (
|
17
|
+
<Nav
|
18
|
+
aria={{ label: navTestId }}
|
19
|
+
className={navClassName}
|
20
|
+
data={{ testid: navTestId }}
|
21
|
+
title={navTitle}
|
22
|
+
{...props}
|
23
|
+
>
|
24
|
+
<NavItem
|
25
|
+
aria={{ label: itemTestId }}
|
26
|
+
className={itemClassName}
|
27
|
+
data={{ testid: itemTestId }}
|
28
|
+
imageUrl={itemImageUrl}
|
29
|
+
link="#"
|
30
|
+
text={itemTitle}
|
31
|
+
/>
|
32
|
+
<NavItem
|
33
|
+
link="#"
|
34
|
+
text="Music"
|
35
|
+
/>
|
36
|
+
<NavItem
|
37
|
+
active
|
38
|
+
link="#"
|
39
|
+
text="Video"
|
40
|
+
/>
|
41
|
+
<NavItem
|
42
|
+
link="#"
|
43
|
+
text="Files"
|
44
|
+
/>
|
45
|
+
</Nav>
|
46
|
+
)
|
47
|
+
}
|
48
|
+
|
49
|
+
test('should pass data prop', () => {
|
50
|
+
render(<NavDefault />)
|
51
|
+
const kit = screen.getByTestId(navTestId)
|
52
|
+
expect(kit).toBeInTheDocument()
|
53
|
+
})
|
54
|
+
|
55
|
+
test('should pass className prop', () => {
|
56
|
+
render(<NavDefault />)
|
57
|
+
const kit = screen.getByTestId(navTestId)
|
58
|
+
expect(kit).toHaveClass(navClassName)
|
59
|
+
})
|
60
|
+
|
61
|
+
test('should pass aria prop', () => {
|
62
|
+
render(<NavDefault />)
|
63
|
+
const kit = screen.getByTestId(navTestId)
|
64
|
+
expect(kit).toHaveAttribute('aria-label', navTestId)
|
65
|
+
})
|
66
|
+
|
67
|
+
test('should render nav title', () => {
|
68
|
+
render(<NavDefault />)
|
69
|
+
const kit = screen.getByText(navTitle)
|
70
|
+
expect(kit).toBeInTheDocument()
|
71
|
+
})
|
72
|
+
|
73
|
+
test('should not be borderless by default', () => {
|
74
|
+
render(<NavDefault />)
|
75
|
+
const kit = screen.getByTestId(navTestId)
|
76
|
+
expect(kit).toHaveClass('pb_nav_list_normal_vertical_highlight')
|
77
|
+
})
|
78
|
+
|
79
|
+
test('should be borderless', () => {
|
80
|
+
render(<NavDefault borderless />)
|
81
|
+
const kit = screen.getByTestId(navTestId)
|
82
|
+
expect(kit).toHaveClass('pb_nav_list_normal_vertical_highlight_borderless')
|
83
|
+
})
|
84
|
+
|
85
|
+
test('should highlight by default', () => {
|
86
|
+
render(<NavDefault />)
|
87
|
+
const kit = screen.getByTestId(navTestId)
|
88
|
+
expect(kit).toHaveClass('pb_nav_list_normal_vertical_highlight')
|
89
|
+
})
|
90
|
+
|
91
|
+
test('should not highlight', () => {
|
92
|
+
render(<NavDefault highlight={false} />)
|
93
|
+
const kit = screen.getByTestId(navTestId)
|
94
|
+
expect(kit).toHaveClass('pb_nav_list_normal_vertical')
|
95
|
+
})
|
96
|
+
|
97
|
+
test('should have vertical orientation by default', () => {
|
98
|
+
render(<NavDefault />)
|
99
|
+
const kit = screen.getByTestId(navTestId)
|
100
|
+
expect(kit).toHaveClass('pb_nav_list_normal_vertical_highlight')
|
101
|
+
})
|
102
|
+
|
103
|
+
test('should change orientation', () => {
|
104
|
+
render(<NavDefault orientation='horizontal' />)
|
105
|
+
const kit = screen.getByTestId(navTestId)
|
106
|
+
expect(kit).toHaveClass('pb_nav_list_normal_horizontal_highlight')
|
107
|
+
})
|
108
|
+
|
109
|
+
test('should have normal variant by default', () => {
|
110
|
+
render(<NavDefault />)
|
111
|
+
const kit = screen.getByTestId(navTestId)
|
112
|
+
expect(kit).toHaveClass('pb_nav_list_normal_vertical_highlight')
|
113
|
+
})
|
114
|
+
|
115
|
+
test('should change variant', () => {
|
116
|
+
render(<NavDefault variant='subtle' />)
|
117
|
+
const kit = screen.getByTestId(navTestId)
|
118
|
+
expect(kit).toHaveClass('pb_nav_list_subtle_vertical_highlight')
|
119
|
+
})
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
|
@@ -9,20 +7,21 @@ import { globalProps } from '../utilities/globalProps'
|
|
9
7
|
import Caption from '../pb_caption/_caption'
|
10
8
|
|
11
9
|
type NavProps = {
|
12
|
-
aria?:
|
10
|
+
aria?: { [key: string]: string },
|
13
11
|
borderless?: boolean,
|
14
|
-
children?: React.
|
15
|
-
className?: string |
|
12
|
+
children?: React.ReactNode[] | React.ReactNode,
|
13
|
+
className?: string | string[],
|
16
14
|
data?: object,
|
17
15
|
dark?: boolean,
|
18
16
|
highlight?: boolean,
|
19
17
|
id?: string,
|
20
|
-
onClick?:
|
18
|
+
onClick?: React.MouseEventHandler<HTMLElement>,
|
21
19
|
orientation?: "vertical" | "horizontal",
|
22
|
-
link:
|
20
|
+
link: string,
|
23
21
|
title: string,
|
24
22
|
variant?: "normal" | "subtle",
|
25
23
|
}
|
24
|
+
|
26
25
|
const Nav = (props: NavProps) => {
|
27
26
|
const {
|
28
27
|
aria = {},
|
@@ -34,7 +33,7 @@ const Nav = (props: NavProps) => {
|
|
34
33
|
highlight = true,
|
35
34
|
id,
|
36
35
|
link = '#',
|
37
|
-
onClick = () => {},
|
36
|
+
onClick = () => { },
|
38
37
|
orientation = 'vertical',
|
39
38
|
title = '',
|
40
39
|
variant = 'normal',
|
@@ -53,26 +52,26 @@ const Nav = (props: NavProps) => {
|
|
53
52
|
|
54
53
|
return (
|
55
54
|
<nav
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
{...ariaProps}
|
56
|
+
{...dataProps}
|
57
|
+
className={cardCss}
|
58
|
+
id={id}
|
60
59
|
>
|
61
|
-
|
60
|
+
{title &&
|
62
61
|
<div className="pb_nav_list_title">
|
63
62
|
<a
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
className="pb_nav_list_item_link_text"
|
64
|
+
href={link}
|
65
|
+
onClick={onClick}
|
67
66
|
>
|
68
67
|
<Caption
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
dark={dark}
|
69
|
+
size="md"
|
70
|
+
text={`${title}`}
|
72
71
|
/>
|
73
72
|
</a>
|
74
73
|
</div>
|
75
|
-
|
74
|
+
}
|
76
75
|
<ul>{children}</ul>
|
77
76
|
</nav>
|
78
77
|
)
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import Nav from './_nav'
|
5
|
+
import NavItem from './_item'
|
6
|
+
|
7
|
+
const navTestId = 'nav'
|
8
|
+
const itemTestId = 'item'
|
9
|
+
const navClassName = 'custom-class-name-nav'
|
10
|
+
const itemClassName = 'custom-class-name-item'
|
11
|
+
const navTitle = 'Menu'
|
12
|
+
const itemTitle = 'Photos'
|
13
|
+
const itemImageUrl = 'https://upload.wikimedia.org/wikipedia/commons/0/00/Apple_News_icon_%28macOS%29.png'
|
14
|
+
|
15
|
+
const NavDefault = (props) => {
|
16
|
+
return (
|
17
|
+
<Nav
|
18
|
+
aria={{ label: navTestId }}
|
19
|
+
className={navClassName}
|
20
|
+
data={{ testid: navTestId }}
|
21
|
+
title={navTitle}
|
22
|
+
>
|
23
|
+
<NavItem
|
24
|
+
aria={{ label: itemTestId }}
|
25
|
+
className={itemClassName}
|
26
|
+
data={{ testid: itemTestId }}
|
27
|
+
imageUrl={itemImageUrl}
|
28
|
+
link="#"
|
29
|
+
text={itemTitle}
|
30
|
+
{...props}
|
31
|
+
/>
|
32
|
+
<NavItem
|
33
|
+
link="#"
|
34
|
+
text="Music"
|
35
|
+
/>
|
36
|
+
<NavItem
|
37
|
+
active
|
38
|
+
link="#"
|
39
|
+
text="Video"
|
40
|
+
/>
|
41
|
+
<NavItem
|
42
|
+
link="#"
|
43
|
+
text="Files"
|
44
|
+
/>
|
45
|
+
</Nav>
|
46
|
+
)
|
47
|
+
}
|
48
|
+
|
49
|
+
test('should pass data prop', () => {
|
50
|
+
render(<NavDefault />)
|
51
|
+
const kit = screen.getByTestId(itemTestId)
|
52
|
+
expect(kit).toBeInTheDocument()
|
53
|
+
})
|
54
|
+
|
55
|
+
test('should pass className prop', () => {
|
56
|
+
render(<NavDefault />)
|
57
|
+
const kit = screen.getByTestId(itemTestId)
|
58
|
+
expect(kit).toHaveClass(itemClassName)
|
59
|
+
})
|
60
|
+
|
61
|
+
test('should pass aria prop', () => {
|
62
|
+
render(<NavDefault />)
|
63
|
+
const kit = screen.getByTestId(itemTestId)
|
64
|
+
expect(kit).toHaveAttribute('aria-label', itemTestId)
|
65
|
+
})
|
66
|
+
|
67
|
+
test('should render title', () => {
|
68
|
+
render(<NavDefault />)
|
69
|
+
const kit = screen.getByText(itemTitle)
|
70
|
+
expect(kit).toBeInTheDocument()
|
71
|
+
})
|
72
|
+
|
73
|
+
test('should have a right icon', () => {
|
74
|
+
render(<NavDefault iconRight="angle-down" />)
|
75
|
+
const kit = screen.getByTestId(itemTestId)
|
76
|
+
expect(kit).toContainHTML('<i class="pb_icon_kit far fa-fw fa-angle-down pb_nav_list_item_icon_right" />')
|
77
|
+
})
|
78
|
+
|
79
|
+
test('should have a left icon', () => {
|
80
|
+
render(<NavDefault iconLeft="users-class" />)
|
81
|
+
const kit = screen.getByTestId(itemTestId)
|
82
|
+
expect(kit).toContainHTML('<i class="pb_icon_kit far fa-fw fa-users-class pb_nav_list_item_icon_left" />')
|
83
|
+
})
|
data/app/pb_kits/playbook/pb_rich_text_editor/{_rich_text_editor.jsx → _rich_text_editor.tsx}
RENAMED
@@ -1,13 +1,9 @@
|
|
1
|
-
/* @flow */
|
2
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
3
|
-
|
4
1
|
import React, { useEffect, useState } from 'react'
|
5
2
|
import classnames from 'classnames'
|
6
3
|
import inlineFocus from './inlineFocus'
|
7
4
|
import useFocus from './useFocus'
|
8
5
|
import { globalProps } from '../utilities/globalProps'
|
9
6
|
import { buildAriaProps, buildDataProps, noop } from '../utilities/props'
|
10
|
-
import PBTipTapEditor from './_tiptap'
|
11
7
|
|
12
8
|
try {
|
13
9
|
const Trix = require('trix')
|
@@ -19,12 +15,21 @@ try {
|
|
19
15
|
|
20
16
|
import { TrixEditor } from "react-trix"
|
21
17
|
|
18
|
+
type Editor = {
|
19
|
+
attributeIsActive?: Function,
|
20
|
+
element?: HTMLElement,
|
21
|
+
getSelectedDocument?: Function,
|
22
|
+
getSelectedRange?: () => Array<number>,
|
23
|
+
insertHTML?: Function,
|
24
|
+
loadHTML?: Function,
|
25
|
+
setSelectedRange?: (range: Array<number>) => void,
|
26
|
+
}
|
27
|
+
|
22
28
|
type RichTextEditorProps = {
|
23
|
-
aria?:
|
24
|
-
advanced?: Boolean,
|
29
|
+
aria?: { [key: string]: string },
|
25
30
|
toolbarBottom?: Boolean,
|
26
31
|
className?: string,
|
27
|
-
data?:
|
32
|
+
data?: { [key: string]: string },
|
28
33
|
focus?: boolean,
|
29
34
|
id?: string,
|
30
35
|
inline?: boolean,
|
@@ -40,7 +45,6 @@ type RichTextEditorProps = {
|
|
40
45
|
const RichTextEditor = (props: RichTextEditorProps) => {
|
41
46
|
const {
|
42
47
|
aria = {},
|
43
|
-
advanced = false,
|
44
48
|
toolbarBottom = false,
|
45
49
|
className,
|
46
50
|
data = {},
|
@@ -56,19 +60,19 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
56
60
|
} = props
|
57
61
|
|
58
62
|
const ariaProps = buildAriaProps(aria),
|
59
|
-
|
60
|
-
|
63
|
+
dataProps = buildDataProps(data),
|
64
|
+
[editor, setEditor] = useState<Editor>()
|
61
65
|
|
62
|
-
const handleOnEditorReady = (editorInstance) => setEditor(editorInstance),
|
63
|
-
|
66
|
+
const handleOnEditorReady = (editorInstance: Editor) => setEditor(editorInstance),
|
67
|
+
element = editor?.element
|
64
68
|
|
65
69
|
// DOM manipulation must wait for editor to be ready
|
66
70
|
if (editor) {
|
67
|
-
const toolbarElement = element.parentElement.querySelector('trix-toolbar'),
|
68
|
-
|
71
|
+
const toolbarElement = element.parentElement.querySelector('trix-toolbar') as HTMLElement,
|
72
|
+
blockCodeButton = toolbarElement.querySelector('[data-trix-attribute=code]') as HTMLElement
|
69
73
|
|
70
|
-
let inlineCodeButton = toolbarElement.querySelector('[data-trix-attribute=inlineCode]')
|
71
|
-
if (!inlineCodeButton) inlineCodeButton = blockCodeButton.cloneNode(true)
|
74
|
+
let inlineCodeButton = toolbarElement.querySelector('[data-trix-attribute=inlineCode]') as HTMLElement
|
75
|
+
if (!inlineCodeButton) inlineCodeButton = blockCodeButton.cloneNode(true) as HTMLElement
|
72
76
|
|
73
77
|
// set button attributes
|
74
78
|
inlineCodeButton.dataset.trixAttribute = 'inlineCode'
|
@@ -96,8 +100,8 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
96
100
|
|
97
101
|
focus
|
98
102
|
? (document.addEventListener('trix-focus', useFocus),
|
99
|
-
|
100
|
-
|
103
|
+
document.addEventListener('trix-blur', useFocus),
|
104
|
+
useFocus())
|
101
105
|
: null
|
102
106
|
|
103
107
|
document.addEventListener('trix-focus', inlineFocus)
|
@@ -113,11 +117,11 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
113
117
|
|
114
118
|
useEffect(() => {
|
115
119
|
if (!element) return
|
116
|
-
element.addEventListener('click', ({target}) => {
|
117
|
-
const trixEditorContainer = target.closest('.pb_rich_text_editor_kit')
|
120
|
+
element.addEventListener('click', ({ target }: Event) => {
|
121
|
+
const trixEditorContainer = (target as Element).closest('.pb_rich_text_editor_kit')
|
118
122
|
if (!trixEditorContainer) return
|
119
123
|
|
120
|
-
const anchorElement = target.closest('a')
|
124
|
+
const anchorElement = (target as Element).closest('a')
|
121
125
|
if (!anchorElement) return
|
122
126
|
|
123
127
|
if (anchorElement.hasAttribute('href')) window.open(anchorElement.href)
|
@@ -125,11 +129,11 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
125
129
|
}, [element])
|
126
130
|
|
127
131
|
const richTextEditorClass = 'pb_rich_text_editor_kit',
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
132
|
+
simpleClass = simple ? 'simple' : '',
|
133
|
+
focusClass = focus ? 'focus-editor-targets' : '',
|
134
|
+
stickyClass = sticky ? 'sticky' : '',
|
135
|
+
inlineClass = inline ? 'inline' : '',
|
136
|
+
toolbarBottomClass = toolbarBottom ? 'toolbar-bottom' : ''
|
133
137
|
|
134
138
|
let css = classnames(globalProps(props), className)
|
135
139
|
css = classnames(
|
@@ -144,27 +148,19 @@ const RichTextEditor = (props: RichTextEditorProps) => {
|
|
144
148
|
|
145
149
|
return (
|
146
150
|
<div
|
147
|
-
|
148
|
-
|
149
|
-
|
151
|
+
{...ariaProps}
|
152
|
+
{...dataProps}
|
153
|
+
className={css}
|
150
154
|
>
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
onChange={onChange}
|
161
|
-
onEditorReady={handleOnEditorReady}
|
162
|
-
placeholder={placeholder}
|
163
|
-
value={value}
|
164
|
-
/>
|
165
|
-
)
|
166
|
-
}
|
167
|
-
|
155
|
+
<TrixEditor
|
156
|
+
className=""
|
157
|
+
fileParamName={name}
|
158
|
+
mergeTags={[]}
|
159
|
+
onChange={onChange}
|
160
|
+
onEditorReady={handleOnEditorReady}
|
161
|
+
placeholder={placeholder}
|
162
|
+
value={value}
|
163
|
+
/>
|
168
164
|
</div>
|
169
165
|
)
|
170
166
|
}
|
@@ -13,7 +13,6 @@ examples:
|
|
13
13
|
|
14
14
|
react:
|
15
15
|
- rich_text_editor_default: Default
|
16
|
-
- rich_text_editor_tip_tap: Advanced
|
17
16
|
- rich_text_editor_simple: Simple
|
18
17
|
- rich_text_editor_attributes: Attributes
|
19
18
|
- rich_text_editor_focus: Focus
|
@@ -22,4 +21,3 @@ examples:
|
|
22
21
|
- rich_text_editor_toolbar_bottom: Toolbar Bottom
|
23
22
|
- rich_text_editor_inline: Inline
|
24
23
|
- rich_text_editor_preview: Preview
|
25
|
-
|
@@ -7,4 +7,3 @@ export { default as RichTextEditorTemplates } from './_rich_text_editor_template
|
|
7
7
|
export { default as RichTextEditorToolbarBottom } from './_rich_text_editor_toolbar_bottom.jsx'
|
8
8
|
export { default as RichTextEditorInline } from './_rich_text_editor_inline.jsx'
|
9
9
|
export { default as RichTextEditorPreview } from './_rich_text_editor_preview.jsx'
|
10
|
-
export { default as RichTextEditorTipTap } from './_rich_text_editor_tip_tap.jsx'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
const inlineFocus = () => {
|
2
|
-
const trixEditorElement = event.target
|
2
|
+
const trixEditorElement = event.target as Element
|
3
3
|
const trixEditorContainer = trixEditorElement.closest('.pb_rich_text_editor_kit')
|
4
4
|
|
5
5
|
if (!trixEditorContainer.classList.contains('inline')) return
|
@@ -2,7 +2,7 @@ const useFocus = () => {
|
|
2
2
|
const allTrixEditors = document.querySelectorAll(
|
3
3
|
'.focus-editor-targets trix-editor'
|
4
4
|
)
|
5
|
-
allTrixEditors.forEach((editorElement) => {
|
5
|
+
allTrixEditors.forEach((editorElement: any) => {
|
6
6
|
const toolbarElement = editorElement.toolbarElement
|
7
7
|
if (editorElement == document.activeElement) {
|
8
8
|
editorElement.classList.add('focused-editor')
|
@@ -140,10 +140,12 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
140
140
|
{...dataProps}
|
141
141
|
className={css}
|
142
142
|
>
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
143
|
+
{label &&
|
144
|
+
<Caption
|
145
|
+
className="pb_text_input_kit_label"
|
146
|
+
text={label}
|
147
|
+
/>
|
148
|
+
}
|
147
149
|
<div className={`${addOnCss} text_input_wrapper`}>
|
148
150
|
{render}
|
149
151
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
|
3
|
+
import TextInput from '../_text_input'
|
4
|
+
|
5
|
+
const TextInputNoLabel = (props) => {
|
6
|
+
const [email, setEmail] = useState('')
|
7
|
+
|
8
|
+
const handleUpdateEmail = ({ target }) => {
|
9
|
+
setEmail(target.value)
|
10
|
+
}
|
11
|
+
return (
|
12
|
+
<div>
|
13
|
+
<TextInput
|
14
|
+
onChange={handleUpdateEmail}
|
15
|
+
placeholder="Enter email address"
|
16
|
+
type="email"
|
17
|
+
value={email}
|
18
|
+
{...props}
|
19
|
+
/>
|
20
|
+
</div>
|
21
|
+
)
|
22
|
+
}
|
23
|
+
export default TextInputNoLabel
|
@@ -6,6 +6,7 @@ examples:
|
|
6
6
|
- text_input_disabled: Disabled
|
7
7
|
- text_input_add_on: Add On
|
8
8
|
- text_input_inline: Inline
|
9
|
+
- text_input_no_label: No Label
|
9
10
|
react:
|
10
11
|
- text_input_default: Default
|
11
12
|
- text_input_error: With Error
|
@@ -13,3 +14,4 @@ examples:
|
|
13
14
|
- text_input_disabled: Disabled
|
14
15
|
- text_input_add_on: Add On
|
15
16
|
- text_input_inline: Inline
|
17
|
+
- text_input_no_label: No Label
|
@@ -4,3 +4,4 @@ export { default as TextInputError } from './_text_input_error.jsx'
|
|
4
4
|
export { default as TextInputDisabled } from './_text_input_disabled.jsx'
|
5
5
|
export { default as TextInputAddOn } from './_text_input_add_on.jsx'
|
6
6
|
export { default as TextInputInline } from './_text_input_inline.jsx'
|
7
|
+
export { default as TextInputNoLabel } from './_text_input_no_label.jsx'
|
@@ -27,9 +27,9 @@ module Playbook
|
|
27
27
|
|
28
28
|
# Deal with lists of kits, used in Playbook doc and Externally
|
29
29
|
# rubocop:disable Style/StringConcatenation
|
30
|
-
def pb_kits(type: "rails", limit_examples: false, dark_mode: false)
|
30
|
+
def pb_kits(type: "rails", limit_examples: false, dark_mode: false, method: get_kits)
|
31
31
|
display_kits = []
|
32
|
-
kits =
|
32
|
+
kits = method
|
33
33
|
kits.each do |kit|
|
34
34
|
if kit.is_a?(Hash)
|
35
35
|
nav_hash_array(kit).each do |sub_kit|
|
@@ -45,7 +45,12 @@ module Playbook
|
|
45
45
|
|
46
46
|
# rubocop:disable Naming/AccessorMethodName
|
47
47
|
def get_kits
|
48
|
-
menu = YAML.load_file(Playbook::Engine.root.join("
|
48
|
+
menu = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))
|
49
|
+
menu["kits"]
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_kits_pb_website
|
53
|
+
menu = YAML.load_file(Rails.root.join("config/menu.yml"))
|
49
54
|
menu["kits"]
|
50
55
|
end
|
51
56
|
# rubocop:enable Naming/AccessorMethodName
|
data/lib/playbook/version.rb
CHANGED