playbook_ui 13.15.0.pre.alpha.PLAY10851907 → 13.15.0.pre.alpha.PLAY11311893
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/pb_passphrase/_passphrase.tsx +50 -51
- data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +19 -20
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +3 -4
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +4 -6
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +20 -20
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +4 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorButton.tsx +17 -19
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorTypes.ts +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +21 -23
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +10 -18
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +23 -46
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarHistory.tsx +8 -8
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarNodes.tsx +7 -7
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +15 -17
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +7 -9
- data/app/pb_kits/playbook/pb_select/_select.scss +13 -4
- data/app/pb_kits/playbook/pb_select/_select.tsx +6 -3
- data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.html.erb +24 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.jsx +38 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_select/select.rb +6 -1
- data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +24 -25
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +26 -27
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +1 -2
- data/app/pb_kits/playbook/pb_source/_source.tsx +15 -15
- data/dist/playbook-rails.js +2 -2
- data/lib/playbook/version.rb +1 -1
- metadata +4 -2
@@ -9,7 +9,7 @@ import NavItem from '../../pb_nav/_item'
|
|
9
9
|
|
10
10
|
import { ToolbarTypes } from './EditorTypes'
|
11
11
|
|
12
|
-
const ToolbarDropdown = ({editor}: any)
|
12
|
+
const ToolbarDropdown = ({editor}: any) => {
|
13
13
|
const [showPopover, setShowPopover] = useState(false)
|
14
14
|
|
15
15
|
const toolbarDropdownItems = [
|
@@ -81,21 +81,11 @@ for (const { text, isActive, icon } of toolbarDropdownItems) {
|
|
81
81
|
if (isActive) {
|
82
82
|
activeCount ++
|
83
83
|
activeItems.push(
|
84
|
-
<Flex align="center"
|
85
|
-
|
86
|
-
key={icon}
|
87
|
-
>
|
88
|
-
<Icon icon={icon}
|
89
|
-
size="lg"
|
90
|
-
/>
|
84
|
+
<Flex align="center" key={icon} gap="xs">
|
85
|
+
<Icon icon={icon} size="lg" />
|
91
86
|
<div>{text}</div>
|
92
|
-
<Flex className={showPopover ? "fa-flip-vertical" : ""}
|
93
|
-
|
94
|
-
>
|
95
|
-
<Icon fixedWidth
|
96
|
-
icon="angle-down"
|
97
|
-
margin-left="xs"
|
98
|
-
/>
|
87
|
+
<Flex className={showPopover ? "fa-flip-vertical" : ""} display="inline_flex">
|
88
|
+
<Icon fixedWidth icon="angle-down" margin-left="xs" />
|
99
89
|
</Flex>
|
100
90
|
</Flex>
|
101
91
|
);
|
@@ -103,10 +93,7 @@ for (const { text, isActive, icon } of toolbarDropdownItems) {
|
|
103
93
|
}
|
104
94
|
|
105
95
|
const popoverReference = (
|
106
|
-
<Button className="editor-dropdown-button"
|
107
|
-
onClick={handleTogglePopover}
|
108
|
-
variant="secondary"
|
109
|
-
>
|
96
|
+
<Button className="editor-dropdown-button" onClick={handleTogglePopover} variant="secondary">
|
110
97
|
{
|
111
98
|
activeCount === 2 ? (
|
112
99
|
activeItems[1]
|
@@ -114,21 +101,11 @@ const popoverReference = (
|
|
114
101
|
activeCount === 1 ? (
|
115
102
|
activeItems[0] || null
|
116
103
|
) : (
|
117
|
-
<Flex align="center"
|
118
|
-
|
119
|
-
key="paragraph"
|
120
|
-
>
|
121
|
-
<Icon icon="paragraph"
|
122
|
-
size="lg"
|
123
|
-
/>
|
104
|
+
<Flex align="center" key="paragraph" gap="xs">
|
105
|
+
<Icon icon="paragraph" size="lg" />
|
124
106
|
<div>Paragraph</div>
|
125
|
-
<Flex className={showPopover ? "fa-flip-vertical" : ""}
|
126
|
-
|
127
|
-
>
|
128
|
-
<Icon fixedWidth
|
129
|
-
icon="angle-down"
|
130
|
-
margin-left="xs"
|
131
|
-
/>
|
107
|
+
<Flex className={showPopover ? "fa-flip-vertical" : ""} display="inline_flex">
|
108
|
+
<Icon fixedWidth icon="angle-down" margin-left="xs" />
|
132
109
|
</Flex>
|
133
110
|
</Flex>
|
134
111
|
)
|
@@ -147,21 +124,21 @@ const popoverReference = (
|
|
147
124
|
show={showPopover}
|
148
125
|
>
|
149
126
|
<Nav
|
150
|
-
|
151
|
-
|
152
|
-
|
127
|
+
paddingTop="xs"
|
128
|
+
paddingBottom="xs"
|
129
|
+
variant="subtle"
|
153
130
|
>
|
154
|
-
{toolbarDropdownItems.map(({ icon, text, onclick, isActive}:
|
131
|
+
{toolbarDropdownItems.map(({ icon, text, onclick, isActive}:ToolbarTypes, index:number) => (
|
155
132
|
<NavItem
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
133
|
+
cursor="pointer"
|
134
|
+
className={`pb_tiptap_toolbar_dropdown_list_item ${isActive ? "is-active" : ""}`}
|
135
|
+
iconLeft={icon}
|
136
|
+
key={`${text}_${index}`}
|
137
|
+
margin='none'
|
138
|
+
onClick={()=> {onclick(); setShowPopover(false)}}
|
139
|
+
text={text}
|
140
|
+
paddingTop='xxs'
|
141
|
+
paddingBottom='xxs'
|
165
142
|
/>
|
166
143
|
))}
|
167
144
|
</Nav>
|
@@ -3,7 +3,7 @@ import FlexItem from "../../pb_flex/_flex_item";
|
|
3
3
|
import EditorButton from "./EditorButton";
|
4
4
|
import { ToolbarTypes } from "./EditorTypes";
|
5
5
|
|
6
|
-
const ToolbarHistoryItems = ({editor}:
|
6
|
+
const ToolbarHistoryItems = ({editor}:any) => {
|
7
7
|
|
8
8
|
const toolbarHistoryItems = [
|
9
9
|
{
|
@@ -26,14 +26,14 @@ const toolbarHistoryItems = [
|
|
26
26
|
<>
|
27
27
|
<FlexItem displayFlex>
|
28
28
|
{toolbarHistoryItems.map(
|
29
|
-
({ onclick, classname, disable, icon, text }:
|
29
|
+
({ onclick, classname, disable, icon, text }:ToolbarTypes, index:number) => (
|
30
30
|
<EditorButton
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
classname={classname}
|
32
|
+
onclick={onclick}
|
33
|
+
disable={disable}
|
34
|
+
icon={icon}
|
35
|
+
key={index}
|
36
|
+
text={text}
|
37
37
|
/>
|
38
38
|
)
|
39
39
|
)}
|
@@ -2,7 +2,7 @@ import React, {useCallback} from "react";
|
|
2
2
|
import EditorButton from "./EditorButton";
|
3
3
|
import { ToolbarTypes } from "./EditorTypes";
|
4
4
|
|
5
|
-
const ToolbarNodes = ({editor}:
|
5
|
+
const ToolbarNodes = ({editor}:any) => {
|
6
6
|
|
7
7
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
8
8
|
const setLink = useCallback(() => {
|
@@ -42,13 +42,13 @@ const toolbarNodesItems = [
|
|
42
42
|
|
43
43
|
return (
|
44
44
|
<>
|
45
|
-
{toolbarNodesItems.map(({ onclick, icon, text, isActive }:
|
45
|
+
{toolbarNodesItems.map(({ onclick, icon, text, isActive }:ToolbarTypes, index:number) => (
|
46
46
|
<EditorButton
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
classname={`toolbar_button ${isActive ? 'is-active' : ''}`}
|
48
|
+
onclick={onclick}
|
49
|
+
icon={icon}
|
50
|
+
key={index}
|
51
|
+
text={text}
|
52
52
|
/>
|
53
53
|
))}
|
54
54
|
</>
|
@@ -17,27 +17,27 @@ import { TrixEditor } from "react-trix"
|
|
17
17
|
import EditorToolbar from './TipTap/Toolbar'
|
18
18
|
|
19
19
|
type Editor = {
|
20
|
-
attributeIsActive?:
|
20
|
+
attributeIsActive?: Function,
|
21
21
|
element?: HTMLElement,
|
22
|
-
getSelectedDocument?:
|
22
|
+
getSelectedDocument?: Function,
|
23
23
|
getSelectedRange?: () => Array<number>,
|
24
|
-
insertHTML?:
|
25
|
-
loadHTML?:
|
26
|
-
setSelectedRange?: (range: Array<number>) => void,
|
24
|
+
insertHTML?: Function,
|
25
|
+
loadHTML?: Function,
|
26
|
+
setSelectedRange?: (range: Array<number>) => void,
|
27
27
|
}
|
28
28
|
|
29
29
|
type RichTextEditorProps = {
|
30
30
|
aria?: { [key: string]: string },
|
31
31
|
advancedEditor?: any,
|
32
32
|
advancedEditorToolbar?: boolean,
|
33
|
-
toolbarBottom?:
|
33
|
+
toolbarBottom?: Boolean,
|
34
34
|
children?: React.ReactNode | React.ReactNode[]
|
35
35
|
className?: string,
|
36
36
|
data?: { [key: string]: string },
|
37
37
|
focus?: boolean,
|
38
38
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
39
39
|
id?: string,
|
40
|
-
inline?: boolean,
|
40
|
+
inline?: boolean,
|
41
41
|
extensions?: { [key: string]: string }[],
|
42
42
|
name?: string,
|
43
43
|
onChange: (html: string, text: string) => void,
|
@@ -49,7 +49,7 @@ type RichTextEditorProps = {
|
|
49
49
|
maxWidth?: string
|
50
50
|
} & GlobalProps
|
51
51
|
|
52
|
-
const RichTextEditor = (props: RichTextEditorProps)
|
52
|
+
const RichTextEditor = (props: RichTextEditorProps) => {
|
53
53
|
const {
|
54
54
|
aria = {},
|
55
55
|
advancedEditor,
|
@@ -81,6 +81,7 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
81
81
|
const handleOnEditorReady = (editorInstance: Editor) => setEditor(editorInstance),
|
82
82
|
element = editor?.element
|
83
83
|
|
84
|
+
|
84
85
|
// DOM manipulation must wait for editor to be ready
|
85
86
|
if (editor) {
|
86
87
|
const toolbarElement = element.parentElement.querySelector('trix-toolbar') as HTMLElement,
|
@@ -116,7 +117,6 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
116
117
|
focus
|
117
118
|
? (document.addEventListener('trix-focus', useFocus),
|
118
119
|
document.addEventListener('trix-blur', useFocus),
|
119
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
120
120
|
useFocus())
|
121
121
|
: null
|
122
122
|
|
@@ -164,10 +164,10 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
164
164
|
|
165
165
|
return (
|
166
166
|
<div
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
{...ariaProps}
|
168
|
+
{...dataProps}
|
169
|
+
{...htmlProps}
|
170
|
+
className={css}
|
171
171
|
>
|
172
172
|
{
|
173
173
|
advancedEditor ? (
|
@@ -175,11 +175,9 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
175
175
|
className={classnames("pb_rich_text_editor_advanced_container", {
|
176
176
|
["toolbar-active"]: advancedEditorToolbar,
|
177
177
|
})}
|
178
|
-
|
178
|
+
>
|
179
179
|
{advancedEditorToolbar && (
|
180
|
-
<EditorToolbar editor={advancedEditor}
|
181
|
-
extensions={extensions}
|
182
|
-
/>
|
180
|
+
<EditorToolbar extensions={extensions} editor={advancedEditor}/>
|
183
181
|
)}
|
184
182
|
{ children }
|
185
183
|
</div>
|
@@ -20,7 +20,7 @@ type SectionSeparatorProps = {
|
|
20
20
|
variant?: "card" | "background",
|
21
21
|
}
|
22
22
|
|
23
|
-
const SectionSeparator = (props: SectionSeparatorProps)
|
23
|
+
const SectionSeparator = (props: SectionSeparatorProps) => {
|
24
24
|
const {
|
25
25
|
aria = {},
|
26
26
|
children,
|
@@ -42,19 +42,17 @@ const SectionSeparator = (props: SectionSeparatorProps): React.ReactElement => {
|
|
42
42
|
return (
|
43
43
|
|
44
44
|
<div
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
{...ariaProps}
|
46
|
+
{...dataProps}
|
47
|
+
{...htmlProps}
|
48
|
+
className={classes}
|
49
|
+
id={id}
|
50
50
|
>
|
51
51
|
{
|
52
52
|
children && children ||
|
53
53
|
text && (
|
54
54
|
<span>
|
55
|
-
<Caption dark={dark}
|
56
|
-
text={text}
|
57
|
-
/>
|
55
|
+
<Caption text={text} dark={dark} />
|
58
56
|
</span>
|
59
57
|
)
|
60
58
|
}
|
@@ -102,20 +102,29 @@
|
|
102
102
|
pointer-events: none;
|
103
103
|
}
|
104
104
|
&.inline {
|
105
|
+
@mixin active_arrow_style {
|
106
|
+
svg {
|
107
|
+
color: $primary !important;
|
108
|
+
font-size: 16px;
|
109
|
+
}
|
110
|
+
}
|
105
111
|
&:not(:hover) {
|
106
112
|
svg {
|
107
113
|
display: none;
|
108
114
|
}
|
109
115
|
}
|
116
|
+
&.show_arrow:not(:hover) {
|
117
|
+
svg {
|
118
|
+
display: block;
|
119
|
+
}
|
120
|
+
@include active_arrow_style();
|
121
|
+
}
|
110
122
|
&:hover {
|
123
|
+
@include active_arrow_style();
|
111
124
|
select {
|
112
125
|
color: $primary !important;
|
113
126
|
background: rgba(0,130,255,0.1);
|
114
127
|
}
|
115
|
-
svg {
|
116
|
-
color: $primary !important;
|
117
|
-
font-size: 16px;
|
118
|
-
}
|
119
128
|
}
|
120
129
|
select {
|
121
130
|
box-shadow: none;
|
@@ -36,6 +36,7 @@ type SelectProps = {
|
|
36
36
|
onChange: InputCallback<HTMLSelectElement>,
|
37
37
|
options: SelectOption[],
|
38
38
|
required?: boolean,
|
39
|
+
showArrow?: boolean,
|
39
40
|
value?: string,
|
40
41
|
} & GlobalProps
|
41
42
|
|
@@ -66,6 +67,7 @@ const Select = ({
|
|
66
67
|
onChange = () => undefined,
|
67
68
|
options = [],
|
68
69
|
required = false,
|
70
|
+
showArrow = false,
|
69
71
|
value,
|
70
72
|
...props
|
71
73
|
}: SelectProps, ref: React.LegacyRef<HTMLSelectElement>) => {
|
@@ -77,15 +79,16 @@ const Select = ({
|
|
77
79
|
const inlineClass = inline ? 'inline' : null
|
78
80
|
const compactClass = compact ? 'compact' : null
|
79
81
|
const classes = classnames(
|
80
|
-
buildCss(
|
82
|
+
buildCss("pb_select"),
|
81
83
|
globalProps({
|
82
84
|
...props,
|
83
|
-
marginBottom: props.marginBottom || props.margin ||
|
85
|
+
marginBottom: props.marginBottom || props.margin || "sm",
|
84
86
|
}),
|
85
87
|
className,
|
86
88
|
inlineClass,
|
89
|
+
{ show_arrow: showArrow },
|
87
90
|
compactClass
|
88
|
-
)
|
91
|
+
);
|
89
92
|
|
90
93
|
const selectWrapperClass = classnames(buildCss('pb_select_kit_wrapper'), { error }, className)
|
91
94
|
const selectBody =(() =>{
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= pb_rails("select", props: {
|
2
|
+
label: "Favorite Food",
|
3
|
+
name: "food",
|
4
|
+
inline: true,
|
5
|
+
options: [
|
6
|
+
{
|
7
|
+
value: "1",
|
8
|
+
value_text: "Burgers",
|
9
|
+
},
|
10
|
+
{
|
11
|
+
value: "2",
|
12
|
+
value_text: "Pizza",
|
13
|
+
},
|
14
|
+
{
|
15
|
+
value: "3",
|
16
|
+
value_text: "Tacos",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
value: "4",
|
20
|
+
value_text: "BBQ",
|
21
|
+
},
|
22
|
+
],
|
23
|
+
show_arrow: true
|
24
|
+
}) %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Body, Select } from '../..'
|
3
|
+
|
4
|
+
const SelectInlineShowArrow = (props) => {
|
5
|
+
const options = [
|
6
|
+
{
|
7
|
+
value: '1',
|
8
|
+
text: 'Burgers',
|
9
|
+
},
|
10
|
+
{
|
11
|
+
value: '2',
|
12
|
+
text: 'Pizza',
|
13
|
+
},
|
14
|
+
{
|
15
|
+
value: '3',
|
16
|
+
text: 'Tacos',
|
17
|
+
},
|
18
|
+
]
|
19
|
+
|
20
|
+
return (
|
21
|
+
<div>
|
22
|
+
<Select
|
23
|
+
inline
|
24
|
+
label="Favorite Food"
|
25
|
+
name="food"
|
26
|
+
options={options}
|
27
|
+
showArrow
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
<Body
|
31
|
+
status="negative"
|
32
|
+
{...props}
|
33
|
+
/>
|
34
|
+
</div>
|
35
|
+
)
|
36
|
+
}
|
37
|
+
|
38
|
+
export default SelectInlineShowArrow
|
@@ -10,6 +10,7 @@ examples:
|
|
10
10
|
- select_custom_select: Custom Select
|
11
11
|
- select_error: Select w/ Error
|
12
12
|
- select_inline: Select Inline
|
13
|
+
- select_inline_show_arrow: Select Inline (Always Show Arrow)
|
13
14
|
- select_inline_compact: Select Inline Compact
|
14
15
|
- select_attributes: Select W/ Attributes
|
15
16
|
- select_multiple: Select Multiple
|
@@ -26,6 +27,7 @@ examples:
|
|
26
27
|
- select_custom_select: Custom Select
|
27
28
|
- select_error: Select w/ Error
|
28
29
|
- select_inline: Select Inline
|
30
|
+
- select_inline_show_arrow: Select Inline (Always Show Arrow)
|
29
31
|
- select_inline_compact: Select Inline Compact
|
30
32
|
- select_multiple: Select Multiple
|
31
33
|
|
@@ -7,5 +7,6 @@ export { default as SelectCustomSelect } from './_select_custom_select.jsx'
|
|
7
7
|
export { default as SelectValueTextSame } from './_select_value_text_same.jsx'
|
8
8
|
export { default as SelectError } from './_select_error.jsx'
|
9
9
|
export { default as SelectInline } from './_select_inline.jsx'
|
10
|
+
export { default as SelectInlineShowArrow } from './_select_inline_show_arrow.jsx'
|
10
11
|
export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
|
11
12
|
export { default as SelectMultiple } from './_select_multiple.jsx'
|
@@ -19,10 +19,11 @@ module Playbook
|
|
19
19
|
prop :name
|
20
20
|
prop :onchange
|
21
21
|
prop :options, type: Playbook::Props::HashArray, required: false, default: []
|
22
|
+
prop :show_arrow, type: Playbook::Props::Boolean, default: false
|
22
23
|
prop :required, type: Playbook::Props::Boolean, default: false
|
23
24
|
|
24
25
|
def classnames
|
25
|
-
classname + inline_class + compact_class
|
26
|
+
classname + inline_class + compact_class + show_arrow_class
|
26
27
|
end
|
27
28
|
|
28
29
|
def all_attributes
|
@@ -49,6 +50,10 @@ module Playbook
|
|
49
50
|
compact ? "compact" : ""
|
50
51
|
end
|
51
52
|
|
53
|
+
def show_arrow_class
|
54
|
+
show_arrow ? "show_arrow" : ""
|
55
|
+
end
|
56
|
+
|
52
57
|
def select_wrapper_class
|
53
58
|
"pb_select_kit_wrapper" + error_class
|
54
59
|
end
|
@@ -33,7 +33,7 @@ type SelectableCardIconProps = {
|
|
33
33
|
onChange?: (event: React.FormEvent<HTMLInputElement>) => void,
|
34
34
|
}
|
35
35
|
|
36
|
-
const SelectableCardIcon = (props: SelectableCardIconProps)
|
36
|
+
const SelectableCardIcon = (props: SelectableCardIconProps) => {
|
37
37
|
const {
|
38
38
|
aria = {},
|
39
39
|
checkmark = false,
|
@@ -70,37 +70,36 @@ const SelectableCardIcon = (props: SelectableCardIconProps): React.ReactElement
|
|
70
70
|
|
71
71
|
return (
|
72
72
|
<div
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
{...ariaProps}
|
74
|
+
{...dataProps}
|
75
|
+
{...htmlProps}
|
76
|
+
className={classes}
|
77
77
|
>
|
78
78
|
<SelectableCard
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
79
|
+
checked={checked}
|
80
|
+
customIcon={customIcon}
|
81
|
+
dark={dark}
|
82
|
+
disabled={disabled}
|
83
|
+
icon={checkmark}
|
84
|
+
inputId={inputId}
|
85
|
+
multi={multi}
|
86
|
+
name={name}
|
87
|
+
onChange={onChange}
|
88
|
+
value={value}
|
89
89
|
>
|
90
90
|
{
|
91
91
|
<>
|
92
92
|
<SelectableIcon
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
/>
|
93
|
+
customIcon={customIcon}
|
94
|
+
icon={icon}
|
95
|
+
inputId={''}
|
96
|
+
inputs="disabled"
|
97
|
+
name={''}
|
98
|
+
text={titleText} />
|
100
99
|
<Body
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
color="light"
|
101
|
+
dark={dark}
|
102
|
+
text={bodyText}
|
104
103
|
/>
|
105
104
|
</>
|
106
105
|
}
|
@@ -6,11 +6,10 @@ import {
|
|
6
6
|
buildAriaProps,
|
7
7
|
buildCss,
|
8
8
|
buildDataProps,
|
9
|
-
buildHtmlProps
|
9
|
+
buildHtmlProps
|
10
10
|
} from '../utilities/props'
|
11
11
|
import Icon from '../pb_icon/_icon'
|
12
12
|
import Title from '../pb_title/_title'
|
13
|
-
import { GenericObject } from '../types'
|
14
13
|
|
15
14
|
type SelectableIconProps = {
|
16
15
|
aria?: {[key: string]: string},
|
@@ -18,7 +17,7 @@ type SelectableIconProps = {
|
|
18
17
|
className?: string,
|
19
18
|
customIcon?: {[key: string] :SVGElement},
|
20
19
|
disabled?: boolean,
|
21
|
-
data?:
|
20
|
+
data?: Object,
|
22
21
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
23
22
|
icon: string,
|
24
23
|
inputId: string,
|
@@ -45,7 +44,7 @@ const SelectableIcon = ({
|
|
45
44
|
text,
|
46
45
|
value,
|
47
46
|
...props
|
48
|
-
}: SelectableIconProps)
|
47
|
+
}: SelectableIconProps) => {
|
49
48
|
const ariaProps = buildAriaProps(aria)
|
50
49
|
const dataProps = buildDataProps(data)
|
51
50
|
const htmlProps = buildHtmlProps(htmlOptions)
|
@@ -65,22 +64,22 @@ const SelectableIcon = ({
|
|
65
64
|
|
66
65
|
return (
|
67
66
|
<div
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
{...ariaProps}
|
68
|
+
{...dataProps}
|
69
|
+
{...htmlProps}
|
70
|
+
className={classes}
|
72
71
|
>
|
73
72
|
{inputs === 'disabled' && (
|
74
73
|
<>
|
75
74
|
<Icon
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
customIcon={customIcon}
|
76
|
+
icon={icon}
|
77
|
+
size="2x"
|
79
78
|
/>
|
80
79
|
<Title
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
size={4}
|
81
|
+
tag="h4"
|
82
|
+
text={text}
|
84
83
|
/>
|
85
84
|
</>
|
86
85
|
)}
|
@@ -88,24 +87,24 @@ const SelectableIcon = ({
|
|
88
87
|
{inputs === 'enabled' && (
|
89
88
|
<>
|
90
89
|
<input
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
90
|
+
{...props}
|
91
|
+
checked={checked}
|
92
|
+
disabled={disabled}
|
93
|
+
id={inputIdPresent}
|
94
|
+
name={name}
|
95
|
+
type={inputType}
|
96
|
+
value={value}
|
98
97
|
/>
|
99
98
|
<label htmlFor={inputIdPresent}>
|
100
99
|
<Icon
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
customIcon={customIcon}
|
101
|
+
icon={icon}
|
102
|
+
size="2x"
|
104
103
|
/>
|
105
104
|
<Title
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
size={4}
|
106
|
+
tag="h4"
|
107
|
+
text={text}
|
109
108
|
/>
|
110
109
|
</label>
|
111
110
|
</>
|
@@ -7,13 +7,12 @@ import { SelectableListItemProps } from './_item.js'
|
|
7
7
|
|
8
8
|
import List from '../pb_list/_list'
|
9
9
|
import SelectableListItem from './_item'
|
10
|
-
import { GenericObject } from '../types'
|
11
10
|
|
12
11
|
type SelectableListProps = {
|
13
12
|
aria?: {[key: string]: string },
|
14
13
|
children?: React.ReactElement[],
|
15
14
|
className?: string,
|
16
|
-
data?:
|
15
|
+
data?: object,
|
17
16
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
18
17
|
id?: string,
|
19
18
|
variant?: 'checkbox' | 'radio',
|