playbook_ui 14.12.0.pre.rc.2 → 14.12.0.pre.rc.3
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_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -2
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +12 -4
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +5 -1
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +8 -3
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +6 -1
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +21 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +13 -6
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +4 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +5 -5
- data/dist/chunks/{_typeahead-C2iCBqxQ.js → _typeahead-BNULwihE.js} +1 -1
- data/dist/chunks/{_weekday_stacked-CWnbnW7m.js → _weekday_stacked-BKWemDAe.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -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 +6 -4
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_table_props.md → _advanced_table_table_props_react.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c83795d8853ca7a4d5f2d6f555ca08f5f3b6098386d027b2c236a9b98da77160
|
4
|
+
data.tar.gz: ed2f28a1ab8e0bd2c6be2b5154ae5b9d6cf6db232b9c6c0961f8fce414b2dec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b154a086c2fcb6bbb6ba2131b8a2ca2b0f6433e5ef60fa492be8b812ffeec1d8c4621f71f0470412bec15fbd91695f6c24ccec5316ded81fa6100c2a4df951b4
|
7
|
+
data.tar.gz: e5b67c905808710552a7643b7757de1ca8bba31899ae187c89bbbb8124fc936484e75eaeab160d8bd59819d55f3a54f136365d7e3007d68378520b6f48de770f
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
|
-
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }) do %>
|
2
|
+
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }.merge(object.table_props)) do %>
|
3
3
|
<% if content.present? %>
|
4
4
|
<% content.presence %>
|
5
5
|
<% else %>
|
@@ -13,6 +13,8 @@ module Playbook
|
|
13
13
|
prop :responsive, type: Playbook::Props::Enum,
|
14
14
|
values: %w[none scroll],
|
15
15
|
default: "none"
|
16
|
+
prop :table_props, type: Playbook::Props::HashProp,
|
17
|
+
default: {}
|
16
18
|
|
17
19
|
def classname
|
18
20
|
generate_classname("pb_advanced_table", responsive_classname, separator: " ")
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
accessor: "newEnrollments",
|
9
|
+
label: "New Enrollments",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
accessor: "scheduledMeetings",
|
13
|
+
label: "Scheduled Meetings",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
accessor: "attendanceRate",
|
17
|
+
label: "Attendance Rate",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
accessor: "completedClasses",
|
21
|
+
label: "Completed Classes",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "classCompletionRate",
|
25
|
+
label: "Class Completion Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "graduatedStudents",
|
29
|
+
label: "Graduated Students",
|
30
|
+
}
|
31
|
+
] %>
|
32
|
+
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions, table_props: { container: false, sticky: true }}) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table) under the hood which comes with it's own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `table_props` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table).
|
@@ -3,6 +3,7 @@ examples:
|
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
4
4
|
- advanced_table_beta_subrow_headers: SubRow Headers
|
5
5
|
- advanced_table_collapsible_trail_rails: Collapsible Trail
|
6
|
+
- advanced_table_table_props: Table Props
|
6
7
|
- advanced_table_beta_sort: Enable Sorting
|
7
8
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
8
9
|
- advanced_table_column_headers: Multi-Header Columns
|
@@ -42,8 +42,8 @@ type TypeaheadProps = {
|
|
42
42
|
id?: string,
|
43
43
|
label?: string,
|
44
44
|
loadOptions?: string | Noop,
|
45
|
-
getOptionLabel?: string | (() =>
|
46
|
-
getOptionValue?: string | (() =>
|
45
|
+
getOptionLabel?: string | (() => string),
|
46
|
+
getOptionValue?: string | (() => string),
|
47
47
|
name?: string,
|
48
48
|
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
49
49
|
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
@@ -109,6 +109,7 @@ const Typeahead = ({
|
|
109
109
|
multiKit: '',
|
110
110
|
onCreateOption: null as null,
|
111
111
|
plusIcon: false,
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
112
113
|
onMultiValueClick: (_option: SelectValueType): any => undefined,
|
113
114
|
pillColor: pillColor,
|
114
115
|
...props,
|
@@ -1,16 +1,24 @@
|
|
1
1
|
import React, { useEffect } from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type ClearContainerProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
selectProps?: {
|
7
|
+
id: string,
|
8
|
+
},
|
9
|
+
clearValue: () => void,
|
10
|
+
}
|
11
|
+
|
12
|
+
const ClearContainer = (props: ClearContainerProps): React.ReactElement => {
|
5
13
|
const { selectProps, clearValue } = props
|
6
14
|
useEffect(() => {
|
7
15
|
document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, clearValue)
|
8
|
-
}, [
|
16
|
+
}, [clearValue, selectProps.id])
|
9
17
|
|
10
18
|
return (
|
11
19
|
<components.ClearIndicator
|
12
|
-
|
13
|
-
|
20
|
+
className="clear_indicator"
|
21
|
+
{...props}
|
14
22
|
/>
|
15
23
|
)
|
16
24
|
}
|
@@ -5,7 +5,11 @@ import Flex from '../../pb_flex/_flex'
|
|
5
5
|
import TextInput from '../../pb_text_input/_text_input'
|
6
6
|
|
7
7
|
type Props = {
|
8
|
-
|
8
|
+
selectProps: {
|
9
|
+
dark?: boolean,
|
10
|
+
label: string,
|
11
|
+
error?: string,
|
12
|
+
},
|
9
13
|
}
|
10
14
|
|
11
15
|
const TypeaheadControl = (props: Props) => (
|
@@ -1,10 +1,15 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type IndicatorsContainerProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
}
|
7
|
+
|
8
|
+
|
9
|
+
const IndicatorsContainer = (props: IndicatorsContainerProps): React.ReactElement => (
|
5
10
|
<components.IndicatorsContainer
|
6
|
-
|
7
|
-
|
11
|
+
className="text_input_indicators"
|
12
|
+
{...props}
|
8
13
|
/>
|
9
14
|
)
|
10
15
|
|
@@ -1,7 +1,12 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type MenuListProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
footer: React.ReactNode,
|
7
|
+
}
|
8
|
+
|
9
|
+
const MenuList = (props: MenuListProps): React.ReactElement => {
|
5
10
|
return (
|
6
11
|
<components.MenuList {...props}>
|
7
12
|
{props.children}
|
@@ -3,7 +3,22 @@ import { components } from 'react-select'
|
|
3
3
|
|
4
4
|
import User from '../../pb_user/_user'
|
5
5
|
|
6
|
-
|
6
|
+
type OptionProps = {
|
7
|
+
children: React.ReactNode,
|
8
|
+
label?: string,
|
9
|
+
data: {
|
10
|
+
imageUrl?: string,
|
11
|
+
},
|
12
|
+
selectProps: {
|
13
|
+
dark?: boolean,
|
14
|
+
valueComponent?: (data: {
|
15
|
+
imageUrl?: string,
|
16
|
+
}) => React.ReactNode,
|
17
|
+
},
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
const Option = (props: OptionProps): React.ReactElement => {
|
7
22
|
const {
|
8
23
|
imageUrl,
|
9
24
|
} = props.data
|
@@ -14,11 +29,11 @@ const Option = (props: any) => {
|
|
14
29
|
<>
|
15
30
|
{!valueComponent && imageUrl &&
|
16
31
|
<User
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
32
|
+
align="left"
|
33
|
+
avatarUrl={imageUrl}
|
34
|
+
dark={props.selectProps.dark}
|
35
|
+
name={props.label}
|
36
|
+
orientation="horizontal"
|
22
37
|
/>
|
23
38
|
}
|
24
39
|
|
@@ -4,19 +4,26 @@ import { components } from 'react-select'
|
|
4
4
|
import Flex from '../../pb_flex/_flex'
|
5
5
|
import Icon from '../../pb_icon/_icon'
|
6
6
|
|
7
|
-
|
7
|
+
type PlaceholderProps = {
|
8
|
+
children: React.ReactNode,
|
9
|
+
selectProps: {
|
10
|
+
plusIcon?: boolean,
|
11
|
+
},
|
12
|
+
}
|
13
|
+
|
14
|
+
const Placeholder = (props: PlaceholderProps): React.ReactElement => (
|
8
15
|
<>
|
9
16
|
<Flex
|
10
|
-
|
11
|
-
|
17
|
+
align="center"
|
18
|
+
className="placeholder"
|
12
19
|
>
|
13
20
|
<components.IndicatorsContainer
|
14
|
-
|
21
|
+
{...props}
|
15
22
|
/>
|
16
23
|
{props.selectProps.plusIcon &&
|
17
24
|
<Icon
|
18
|
-
|
19
|
-
|
25
|
+
className="typeahead-plus-icon"
|
26
|
+
icon="plus"
|
20
27
|
/>
|
21
28
|
}
|
22
29
|
</Flex>
|
@@ -1,10 +1,14 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type ValueContainerProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
}
|
7
|
+
|
8
|
+
const ValueContainer = (props: ValueContainerProps): React.ReactElement => (
|
5
9
|
<components.ValueContainer
|
6
|
-
|
7
|
-
|
10
|
+
className="text_input_value_container"
|
11
|
+
{...props}
|
8
12
|
/>
|
9
13
|
)
|
10
14
|
|
@@ -45,8 +45,7 @@ const promiseOptions = (inputValue) =>
|
|
45
45
|
|
46
46
|
const TypeaheadWithPillsAsync = (props) => {
|
47
47
|
const [users, setUsers] = useState([])
|
48
|
-
|
49
|
-
const formatValue = (users) => formatUsers(users)
|
48
|
+
|
50
49
|
const formatUsers = (users) => {
|
51
50
|
const results = () => (users.map((user) => {
|
52
51
|
if (Object.keys(user)[0] === 'name' || Object.keys(user)[1] === 'id'){
|
@@ -58,6 +57,9 @@ const TypeaheadWithPillsAsync = (props) => {
|
|
58
57
|
return results()
|
59
58
|
}
|
60
59
|
|
60
|
+
const handleOnChange = (value) => setUsers(formatUsers(value))
|
61
|
+
const formatValue = (users) => formatUsers(users)
|
62
|
+
|
61
63
|
return (
|
62
64
|
<>
|
63
65
|
{users && users.length > 0 && (
|
@@ -83,13 +83,13 @@ const TypeaheadWithPillsAsyncCustomOptions = (props) => {
|
|
83
83
|
onChange={handleOnChange}
|
84
84
|
onMultiValueClick={handleOnMultiValueClick}
|
85
85
|
placeholder="type the name of a Github user"
|
86
|
-
valueComponent={(
|
86
|
+
valueComponent={({imageUrl, label, territory, type}) => (
|
87
87
|
<User
|
88
88
|
avatar
|
89
|
-
avatarUrl={
|
90
|
-
name={
|
91
|
-
territory={
|
92
|
-
title={
|
89
|
+
avatarUrl={imageUrl}
|
90
|
+
name={label}
|
91
|
+
territory={territory}
|
92
|
+
title={type}
|
93
93
|
/>
|
94
94
|
)}
|
95
95
|
{...props}
|