playbook_ui 12.5.0.pre.alpha.datepickerinput1 → 12.5.0.pre.alpha.filter1
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_date_picker/_date_picker.scss +6 -9
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +44 -61
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +0 -1
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +72 -0
- data/app/pb_kits/playbook/pb_filter/Filter/{FilterBackground.jsx → FilterBackground.tsx} +12 -14
- data/app/pb_kits/playbook/pb_filter/Filter/{FilterDouble.jsx → FilterDouble.tsx} +7 -8
- data/app/pb_kits/playbook/pb_filter/Filter/{FilterSingle.jsx → FilterSingle.tsx} +25 -25
- data/app/pb_kits/playbook/pb_filter/Filter/{FiltersPopover.jsx → FiltersPopover.tsx} +13 -11
- data/app/pb_kits/playbook/pb_filter/Filter/{ResultsCount.jsx → ResultsCount.tsx} +39 -14
- data/app/pb_kits/playbook/pb_filter/Filter/{SortMenu.jsx → SortMenu.tsx} +6 -6
- data/app/pb_kits/playbook/pb_filter/Filter/{index.jsx → index.tsx} +17 -10
- data/app/pb_kits/playbook/pb_filter/{_filter.jsx → _filter.tsx} +0 -2
- data/app/pb_kits/playbook/pb_list/_list.tsx +2 -2
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +33 -32
- data/lib/playbook/version.rb +2 -2
- metadata +11 -12
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +0 -68
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx +0 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f38164cc9c607578c2f74686bf2715e8006cffd060879d9c23cc52021e42109e
|
4
|
+
data.tar.gz: 00bdea5c26205ae76a885adc0872c05b36c4965d7736ad60aa685d8cb7ac268c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42f54dad230676a4f4a9546ac425c3cd0e3772540df2b367a811a83c488176461f5253305865d93e50283d482eb0dbe2cb14ca4feb9e4c52f83d4eac7b576875
|
7
|
+
data.tar.gz: b7f08be337b4876fc30ac264aa70332793e463526c1b90ddfc32a4335009e61506d313bd4b246d80c301e0019d3867fffcda77ea526f46c16a2dcd2b321ce487
|
@@ -5,7 +5,8 @@
|
|
5
5
|
@import "./sass_partials/inline_styles";
|
6
6
|
@import "./sass_partials/month_and_year_styles";
|
7
7
|
@import "./sass_partials/time_selection_styles";
|
8
|
-
|
8
|
+
|
9
|
+
|
9
10
|
|
10
11
|
[class^=pb_date_picker_kit] {
|
11
12
|
.input_wrapper {
|
@@ -19,10 +20,8 @@
|
|
19
20
|
@import "./sass_partials/calendar_input_icon";
|
20
21
|
}
|
21
22
|
|
22
|
-
&:focus,
|
23
|
-
|
24
|
-
div.cal_icon_wrapper,
|
25
|
-
input.date_picker_input {
|
23
|
+
&:focus, :focus-within {
|
24
|
+
div.cal_icon_wrapper, input.text_input{
|
26
25
|
@include transition_default;
|
27
26
|
border-color: $primary;
|
28
27
|
}
|
@@ -34,20 +33,18 @@
|
|
34
33
|
@import "./sass_partials/header_styles";
|
35
34
|
@import "./sass_partials/overrides";
|
36
35
|
|
37
|
-
.
|
36
|
+
.text_input.flatpickr-input {
|
38
37
|
text-overflow: ellipsis;
|
39
38
|
padding-right: $space_xl + 10 !important;
|
40
39
|
}
|
41
|
-
|
42
40
|
// Calendar Shadow and Border
|
43
41
|
.flatpickr-calendar {
|
44
42
|
box-shadow: $shadow_deeper;
|
45
43
|
border: 1px solid $border_light;
|
46
44
|
}
|
47
|
-
|
48
45
|
// Hide Caret
|
49
46
|
&:before,
|
50
47
|
&:after {
|
51
48
|
content: none;
|
52
49
|
}
|
53
|
-
}
|
50
|
+
}
|
@@ -5,13 +5,13 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
5
5
|
import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
|
6
6
|
|
7
7
|
import datePickerHelper from './date_picker_helper'
|
8
|
+
|
8
9
|
import Icon from '../pb_icon/_icon'
|
9
|
-
import
|
10
|
-
import Body from '../pb_body/_body'
|
10
|
+
import TextInput from '../pb_text_input/_text_input'
|
11
11
|
|
12
12
|
type DatePickerProps = {
|
13
13
|
allowInput?: boolean,
|
14
|
-
aria?: {
|
14
|
+
aria?: {[key: string]: string},
|
15
15
|
className?: string,
|
16
16
|
dark?: boolean,
|
17
17
|
data?: { [key: string]: string },
|
@@ -27,15 +27,15 @@ type DatePickerProps = {
|
|
27
27
|
hideLabel?: boolean,
|
28
28
|
id?: string,
|
29
29
|
inLine?: boolean,
|
30
|
-
inputAria?: {
|
31
|
-
inputData?: {
|
32
|
-
inputOnChange?: (
|
30
|
+
inputAria?: {[key: string]: string},
|
31
|
+
inputData?: {[key: string]: string},
|
32
|
+
inputOnChange?: (arg: string) => void,
|
33
33
|
inputValue?: any,
|
34
34
|
label?: string,
|
35
35
|
maxDate: string,
|
36
36
|
minDate: string,
|
37
37
|
name: string,
|
38
|
-
pickerId?: string,
|
38
|
+
pickerId?: ArrayLike<Node> | Node | string,
|
39
39
|
placeholder?: string,
|
40
40
|
positionElement?: HTMLElement | null,
|
41
41
|
scrollContainer?: string,
|
@@ -68,8 +68,8 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
68
68
|
hideLabel = false,
|
69
69
|
id,
|
70
70
|
inLine = false,
|
71
|
-
inputAria
|
72
|
-
inputData
|
71
|
+
inputAria,
|
72
|
+
inputData,
|
73
73
|
inputOnChange,
|
74
74
|
inputValue,
|
75
75
|
label = 'Date Picker',
|
@@ -87,14 +87,11 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
87
87
|
selectionType = '',
|
88
88
|
showTimezone = false,
|
89
89
|
staticPosition = true,
|
90
|
-
yearRange = [1900, 2100],
|
90
|
+
yearRange = [ 1900, 2100 ],
|
91
91
|
} = props
|
92
92
|
|
93
93
|
const ariaProps = buildAriaProps(aria)
|
94
94
|
const dataProps = buildDataProps(data)
|
95
|
-
const inputAriaProps = buildAriaProps(inputAria)
|
96
|
-
const inputDataProps = buildDataProps(inputData)
|
97
|
-
|
98
95
|
const classes = classnames(
|
99
96
|
buildCss('pb_date_picker_kit'),
|
100
97
|
globalProps(props),
|
@@ -131,13 +128,13 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
131
128
|
|
132
129
|
const iconWrapperClass = () => {
|
133
130
|
let base = 'cal_icon_wrapper'
|
134
|
-
if (dark)
|
131
|
+
if (dark){
|
135
132
|
base += ' dark'
|
136
133
|
}
|
137
|
-
if (hideLabel)
|
134
|
+
if (hideLabel){
|
138
135
|
base += ' no_label_shift'
|
139
136
|
}
|
140
|
-
if (error)
|
137
|
+
if (error){
|
141
138
|
base += ' error'
|
142
139
|
}
|
143
140
|
return base
|
@@ -145,75 +142,61 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
145
142
|
|
146
143
|
return (
|
147
144
|
<div
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
145
|
+
{...ariaProps}
|
146
|
+
{...dataProps}
|
147
|
+
className={classes}
|
148
|
+
id={id}
|
152
149
|
>
|
153
|
-
<div
|
154
|
-
|
155
|
-
|
156
|
-
className="input_wrapper">
|
157
|
-
|
158
|
-
<Caption
|
159
|
-
className="pb_date_picker_kit_label"
|
160
|
-
text={hideLabel ? null : label}
|
161
|
-
/>
|
162
|
-
|
163
|
-
<div className="date_picker_input_wrapper">
|
164
|
-
<input
|
150
|
+
<div className="input_wrapper">
|
151
|
+
<TextInput
|
152
|
+
aria={inputAria}
|
165
153
|
autoComplete="off"
|
166
|
-
|
154
|
+
dark={dark}
|
155
|
+
data={inputData}
|
167
156
|
disabled={disableInput}
|
157
|
+
error={error}
|
168
158
|
id={pickerId}
|
159
|
+
label={hideLabel ? null : label}
|
169
160
|
name={name}
|
170
161
|
onChange={inputOnChange}
|
171
162
|
placeholder={placeholder}
|
172
163
|
value={inputValue}
|
173
|
-
|
174
|
-
|
175
|
-
{error && <Body
|
176
|
-
status="negative"
|
177
|
-
text={error}
|
178
|
-
variant={null}
|
179
|
-
/>
|
180
|
-
}
|
181
|
-
</div>
|
164
|
+
/>
|
182
165
|
|
183
|
-
{!hideIcon &&
|
166
|
+
{ !hideIcon &&
|
184
167
|
<div
|
185
|
-
|
186
|
-
|
168
|
+
className={iconWrapperClass()}
|
169
|
+
id={`cal-icon-${pickerId}`}
|
187
170
|
>
|
188
|
-
|
171
|
+
<Icon
|
189
172
|
className="cal_icon"
|
190
173
|
icon="calendar-alt"
|
191
|
-
|
192
|
-
|
174
|
+
/>
|
175
|
+
</div>
|
193
176
|
}
|
194
177
|
|
195
|
-
{hideIcon && inLine ?
|
178
|
+
{ hideIcon && inLine ?
|
196
179
|
<div>
|
197
180
|
<div
|
198
|
-
|
199
|
-
|
181
|
+
className={iconWrapperClass()}
|
182
|
+
id={`${pickerId}-icon-plus`}
|
200
183
|
>
|
201
184
|
<Icon
|
202
|
-
|
203
|
-
|
185
|
+
className="date-picker-plus-icon"
|
186
|
+
icon="plus"
|
204
187
|
/>
|
205
188
|
</div>
|
206
189
|
<div
|
207
|
-
|
208
|
-
|
190
|
+
className={iconWrapperClass()}
|
191
|
+
id={`${pickerId}-angle-down`}
|
209
192
|
>
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
193
|
+
<Icon
|
194
|
+
className="angle_down_icon"
|
195
|
+
icon="angle-down"
|
196
|
+
/>
|
214
197
|
</div>
|
215
|
-
</div>
|
216
|
-
|
198
|
+
</div>
|
199
|
+
: null }
|
217
200
|
</div>
|
218
201
|
</div>
|
219
202
|
)
|
@@ -112,7 +112,6 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
112
112
|
// ===========================================================
|
113
113
|
|
114
114
|
flatpickr(`#${pickerId}`, {
|
115
|
-
allowInput,
|
116
115
|
closeOnSelect,
|
117
116
|
disableMobile: true,
|
118
117
|
dateFormat: getDateFormat(),
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { isEmpty, map, omitBy } from 'lodash'
|
3
|
+
|
4
|
+
import Body from '../../pb_body/_body'
|
5
|
+
import Caption from '../../pb_caption/_caption'
|
6
|
+
import Title from '../../pb_title/_title'
|
7
|
+
|
8
|
+
export type FilterDescription = {
|
9
|
+
[key: string]: string | null | boolean,
|
10
|
+
}
|
11
|
+
|
12
|
+
export type CurrentFiltersProps = {
|
13
|
+
dark: boolean,
|
14
|
+
filters: FilterDescription,
|
15
|
+
}
|
16
|
+
|
17
|
+
const hiddenFilters = (value: any) => isEmpty(value) && value !== true
|
18
|
+
|
19
|
+
const CurrentFilters = ({ dark, filters }: CurrentFiltersProps): React.ReactElement => {
|
20
|
+
const displayableFilters = omitBy(filters, hiddenFilters)
|
21
|
+
|
22
|
+
return (
|
23
|
+
<div className="maskContainer">
|
24
|
+
{ isEmpty(filters) &&
|
25
|
+
<div className="filters">
|
26
|
+
<Body
|
27
|
+
color="light"
|
28
|
+
paddingLeft="xs"
|
29
|
+
size={4}
|
30
|
+
tag="h4"
|
31
|
+
text="No Filter Selected"
|
32
|
+
/>
|
33
|
+
</div>
|
34
|
+
}
|
35
|
+
{ !isEmpty(filters) &&
|
36
|
+
<div className="filters">
|
37
|
+
<div className="left_gradient" />
|
38
|
+
{map(displayableFilters, (value, name) => (
|
39
|
+
<div
|
40
|
+
className="filter"
|
41
|
+
key={`filter-${name}`}
|
42
|
+
>
|
43
|
+
{ value === true ?
|
44
|
+
<Title
|
45
|
+
dark={dark}
|
46
|
+
size={4}
|
47
|
+
tag="h4"
|
48
|
+
text={name}
|
49
|
+
/> :
|
50
|
+
<div>
|
51
|
+
<Caption
|
52
|
+
dark={dark}
|
53
|
+
text={name}
|
54
|
+
/>
|
55
|
+
<Title
|
56
|
+
dark={dark}
|
57
|
+
size={4}
|
58
|
+
tag="h4"
|
59
|
+
text={value}
|
60
|
+
/>
|
61
|
+
</div>
|
62
|
+
}
|
63
|
+
</div>
|
64
|
+
))}
|
65
|
+
<div className="right_gradient" />
|
66
|
+
</div>
|
67
|
+
}
|
68
|
+
</div>
|
69
|
+
)
|
70
|
+
}
|
71
|
+
|
72
|
+
export default CurrentFilters
|
@@ -1,35 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import React, { Node } from 'react'
|
1
|
+
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
|
6
|
-
import { globalProps } from '../../utilities/globalProps'
|
4
|
+
import { GlobalProps, globalProps } from '../../utilities/globalProps'
|
7
5
|
|
8
6
|
import Card from '../../pb_card/_card'
|
9
7
|
|
10
|
-
type FilterBackgroundProps = {
|
8
|
+
export type FilterBackgroundProps = {
|
11
9
|
background: boolean,
|
12
10
|
className: string,
|
13
|
-
children
|
11
|
+
children?: React.ReactChild[] | React.ReactChild,
|
14
12
|
dark: boolean,
|
15
|
-
}
|
13
|
+
} & GlobalProps
|
16
14
|
|
17
|
-
const FilterBackground = (props: FilterBackgroundProps) => {
|
15
|
+
const FilterBackground = (props: FilterBackgroundProps): React.ReactElement => {
|
18
16
|
const { background = true, className, children, dark } = props
|
19
17
|
|
20
18
|
return (
|
21
19
|
<div className={classnames(`pb_filter_kit ${className}`, globalProps(props))}>
|
22
|
-
|
23
|
-
<When condition={background}>
|
20
|
+
{ background ?
|
24
21
|
<Card
|
25
22
|
dark={dark}
|
26
23
|
padding="none"
|
27
24
|
>
|
28
25
|
{children}
|
29
|
-
</Card>
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
</Card> :
|
27
|
+
<>
|
28
|
+
{children}
|
29
|
+
</>
|
30
|
+
}
|
33
31
|
</div>
|
34
32
|
)
|
35
33
|
}
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
|
5
3
|
import CurrentFilters, { FilterDescription } from './CurrentFilters'
|
@@ -15,13 +13,14 @@ import SortMenu, {
|
|
15
13
|
import Caption from '../../pb_caption/_caption'
|
16
14
|
import Flex from '../../pb_flex/_flex'
|
17
15
|
import SectionSeparator from '../../pb_section_separator/_section_separator'
|
16
|
+
|
18
17
|
export type FilterDoubleProps = {
|
19
|
-
children
|
18
|
+
children?: React.ReactChild[] | React.ReactChild,
|
20
19
|
filters?: FilterDescription,
|
21
|
-
onSortChange
|
20
|
+
onSortChange?: SortingChangeCallback,
|
22
21
|
results?: number,
|
23
|
-
sortOptions
|
24
|
-
sortValue?: SortValue,
|
22
|
+
sortOptions?: SortOptions,
|
23
|
+
sortValue?: SortValue[],
|
25
24
|
} & FilterBackgroundProps
|
26
25
|
|
27
26
|
const FilterDouble = ({
|
@@ -35,7 +34,7 @@ const FilterDouble = ({
|
|
35
34
|
minWidth,
|
36
35
|
placement,
|
37
36
|
...bgProps
|
38
|
-
}: FilterDoubleProps) => (
|
37
|
+
}: FilterDoubleProps): React.ReactElement => (
|
39
38
|
<FilterBackground
|
40
39
|
dark={dark}
|
41
40
|
{...bgProps}
|
@@ -49,7 +48,7 @@ const FilterDouble = ({
|
|
49
48
|
minWidth={minWidth}
|
50
49
|
placement={placement}
|
51
50
|
>
|
52
|
-
|
51
|
+
{children}
|
53
52
|
</FiltersPopover>
|
54
53
|
<CurrentFilters
|
55
54
|
dark={dark}
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import { isEmpty } from 'lodash'
|
5
3
|
|
@@ -16,12 +14,12 @@ import SortMenu, {
|
|
16
14
|
} from './SortMenu'
|
17
15
|
|
18
16
|
export type FilterSingleProps = {
|
19
|
-
children?:
|
17
|
+
children?: React.ReactChild[] | React.ReactChild,
|
20
18
|
filters?: FilterDescription,
|
21
19
|
onSortChange?: SortingChangeCallback,
|
22
20
|
results?: number,
|
23
21
|
sortOptions?: SortOptions,
|
24
|
-
sortValue?: SortValue,
|
22
|
+
sortValue?: SortValue[],
|
25
23
|
} & FilterBackgroundProps
|
26
24
|
|
27
25
|
const FilterSingle = ({
|
@@ -35,7 +33,7 @@ const FilterSingle = ({
|
|
35
33
|
minWidth,
|
36
34
|
placement,
|
37
35
|
...bgProps
|
38
|
-
}: FilterSingleProps) => {
|
36
|
+
}: FilterSingleProps): React.ReactElement => {
|
39
37
|
return (
|
40
38
|
<FilterBackground
|
41
39
|
dark={dark}
|
@@ -46,31 +44,33 @@ const FilterSingle = ({
|
|
46
44
|
paddingRight="lg"
|
47
45
|
vertical="center"
|
48
46
|
>
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
{ children &&
|
48
|
+
<>
|
49
|
+
<FiltersPopover
|
50
|
+
dark={dark}
|
51
|
+
minWidth={minWidth}
|
52
|
+
placement={placement}
|
53
|
+
>
|
55
54
|
{children}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
55
|
+
</FiltersPopover>
|
56
|
+
<CurrentFilters
|
57
|
+
dark={dark}
|
58
|
+
filters={filters}
|
59
|
+
/>
|
60
|
+
</>
|
61
|
+
}
|
62
62
|
<ResultsCount
|
63
63
|
dark={dark}
|
64
64
|
results={results}
|
65
65
|
/>
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
66
|
+
{ !isEmpty(sortOptions) &&
|
67
|
+
<SortMenu
|
68
|
+
dark={dark}
|
69
|
+
onChange={onSortChange}
|
70
|
+
options={sortOptions}
|
71
|
+
value={sortValue}
|
72
|
+
/>
|
73
|
+
}
|
74
74
|
</Flex>
|
75
75
|
</FilterBackground>
|
76
76
|
)
|
@@ -1,12 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import React, { Node, useState } from 'react'
|
1
|
+
import React, { ReactNode, useState } from 'react'
|
4
2
|
|
5
3
|
import CircleIconButton from '../../pb_circle_icon_button/_circle_icon_button'
|
6
4
|
import PbReactPopover from '../../pb_popover/_popover'
|
7
5
|
|
8
|
-
|
9
|
-
|
6
|
+
type FiltersPopoverProps = {
|
7
|
+
children?: React.ReactChild[] | React.ReactChild | (({closePopover}: {closePopover: () => void}) => ReactNode),
|
8
|
+
dark?: boolean,
|
9
|
+
minWidth?: string,
|
10
|
+
placement?: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end",
|
11
|
+
}
|
12
|
+
const FiltersPopover = ({ children, dark, minWidth, placement = "bottom-start" }: FiltersPopoverProps): React.ReactElement => {
|
10
13
|
const [hide, updateHide] = useState(true)
|
11
14
|
const toggle = () => updateHide(!hide)
|
12
15
|
|
@@ -16,7 +19,6 @@ const FiltersPopover = ({ children, dark, minWidth, placement = "bottom-start" }
|
|
16
19
|
icon="filter"
|
17
20
|
id="filter"
|
18
21
|
onClick={toggle}
|
19
|
-
text="filter"
|
20
22
|
variant="secondary"
|
21
23
|
/>
|
22
24
|
)
|
@@ -30,11 +32,11 @@ const FiltersPopover = ({ children, dark, minWidth, placement = "bottom-start" }
|
|
30
32
|
shouldClosePopover={updateHide}
|
31
33
|
show={!hide}
|
32
34
|
>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
<div className="pb-form">
|
36
|
+
{typeof children === 'function'
|
37
|
+
? children({ closePopover: () => (updateHide(true)) })
|
38
|
+
: children}
|
39
|
+
</div>
|
38
40
|
</PbReactPopover>
|
39
41
|
)
|
40
42
|
}
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
|
5
3
|
import Caption from '../../pb_caption/_caption'
|
@@ -9,31 +7,58 @@ const resultsText = (results: number): string => results == 1 ? 'Result' : 'Resu
|
|
9
7
|
|
10
8
|
type ResultsCountProps = {
|
11
9
|
dark?: boolean,
|
12
|
-
results?:
|
10
|
+
results?: number | null,
|
13
11
|
title?: boolean,
|
14
12
|
}
|
15
|
-
const ResultsCount = ({ dark, results, title }: ResultsCountProps) =>
|
16
|
-
|
17
|
-
|
13
|
+
const ResultsCount = ({ dark, results, title }: ResultsCountProps): React.ReactElement => {
|
14
|
+
|
15
|
+
const resultTitle = () => {
|
16
|
+
return (
|
18
17
|
<TitleCount
|
19
18
|
align="center"
|
20
19
|
count={results}
|
21
20
|
dark={dark}
|
22
21
|
title={`${resultsText(results)}:`}
|
23
22
|
/>
|
24
|
-
|
25
|
-
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
const justResults = () => {
|
27
|
+
return (
|
26
28
|
<Caption
|
27
29
|
className="filter-results"
|
28
30
|
dark={dark}
|
29
31
|
size="xs"
|
30
32
|
text={`${results} ${resultsText(results)}`}
|
31
33
|
/>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
)
|
35
|
+
}
|
36
|
+
|
37
|
+
const displayResultsCount = () => {
|
38
|
+
if (results && title) {
|
39
|
+
return (
|
40
|
+
<>
|
41
|
+
{resultTitle()}
|
42
|
+
</>
|
43
|
+
)
|
44
|
+
} else if (results) {
|
45
|
+
return (
|
46
|
+
<>
|
47
|
+
{justResults()}
|
48
|
+
</>
|
49
|
+
)
|
50
|
+
} else {
|
51
|
+
return (
|
52
|
+
<div />
|
53
|
+
)
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
return (
|
58
|
+
<>
|
59
|
+
{displayResultsCount()}
|
60
|
+
</>
|
61
|
+
)
|
62
|
+
}
|
38
63
|
|
39
64
|
export default ResultsCount
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React, { useState } from 'react'
|
4
2
|
import { find, map, partial } from 'lodash'
|
5
3
|
|
@@ -12,9 +10,9 @@ import PbReactPopover from '../../pb_popover/_popover'
|
|
12
10
|
export type Direction = 'asc' | 'desc'
|
13
11
|
export type SortOptions = { [name: string]: string }
|
14
12
|
export type SortValue = { name: string, dir: Direction }
|
15
|
-
export type SortingChangeCallback = (SortValue[]) => void
|
13
|
+
export type SortingChangeCallback = (value: SortValue[]) => void
|
16
14
|
|
17
|
-
const nextValue = (value: SortValue[], name: string):
|
15
|
+
const nextValue = (value: SortValue[], name: string): SortValue => {
|
18
16
|
const current = find(value, { name })
|
19
17
|
return {
|
20
18
|
name,
|
@@ -26,12 +24,13 @@ const directionIcon = (dir: Direction) => (
|
|
26
24
|
dir == 'asc' ? 'sort-amount-up' : 'sort-amount-down'
|
27
25
|
)
|
28
26
|
|
29
|
-
const renderOptions = (options: SortOptions, value: SortValue[], handleChange: (SortValue) => void) => (
|
27
|
+
const renderOptions = (options: SortOptions, value: SortValue[], handleChange: (arg0: SortValue) => void) => (
|
30
28
|
map(options, (label, name) => {
|
31
29
|
const next = nextValue(value, name)
|
32
30
|
return (
|
33
31
|
<ListItem key={`option-${next.name}-${next.dir}`}>
|
34
32
|
<Button
|
33
|
+
htmlType={undefined}
|
35
34
|
onClick={partial(handleChange, next)}
|
36
35
|
text={` ${label}`}
|
37
36
|
variant="link"
|
@@ -47,7 +46,7 @@ export type SortMenuProps = {
|
|
47
46
|
options: SortOptions,
|
48
47
|
value?: SortValue[],
|
49
48
|
}
|
50
|
-
const SortMenu = ({ dark, options, value, onChange }: SortMenuProps) => {
|
49
|
+
const SortMenu = ({ dark, options, value, onChange }: SortMenuProps): React.ReactElement => {
|
51
50
|
const [hide, updateHide] = useState(true)
|
52
51
|
const toggle = () => updateHide(!hide)
|
53
52
|
const handleChange = (value: SortValue) => {
|
@@ -58,6 +57,7 @@ const SortMenu = ({ dark, options, value, onChange }: SortMenuProps) => {
|
|
58
57
|
const sortButton = (
|
59
58
|
<Button
|
60
59
|
dark={dark}
|
60
|
+
htmlType={undefined}
|
61
61
|
id="sort-button"
|
62
62
|
onClick={toggle}
|
63
63
|
paddingRight="none"
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import FilterSingle, { FilterSingleProps } from './FilterSingle'
|
5
3
|
import FilterDouble, { FilterDoubleProps } from './FilterDouble'
|
@@ -10,16 +8,25 @@ type FilterProps =
|
|
10
8
|
double?: boolean,
|
11
9
|
})
|
12
10
|
|
13
|
-
const Filter = ({
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
const Filter = ({
|
12
|
+
double = false,
|
13
|
+
...templateProps
|
14
|
+
}: FilterProps): React.ReactElement => {
|
15
|
+
const displayFilter = () => {
|
16
|
+
if (double === true) {
|
17
|
+
return (
|
17
18
|
<FilterDouble {...templateProps} />
|
18
|
-
|
19
|
-
|
19
|
+
)
|
20
|
+
} else {
|
21
|
+
return (
|
20
22
|
<FilterSingle {...templateProps} />
|
21
|
-
|
22
|
-
|
23
|
+
)
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return (
|
27
|
+
<>
|
28
|
+
{displayFilter()}
|
29
|
+
</>
|
23
30
|
)
|
24
31
|
}
|
25
32
|
|
@@ -11,14 +11,14 @@ type ListProps = {
|
|
11
11
|
dark?: boolean;
|
12
12
|
data?: object;
|
13
13
|
id?: string;
|
14
|
-
layout
|
14
|
+
layout?: "" | "left" | "right";
|
15
15
|
ordered?: boolean;
|
16
16
|
role?: string;
|
17
17
|
tabIndex?: number;
|
18
18
|
text?: string;
|
19
19
|
size?: string;
|
20
20
|
variant?: string;
|
21
|
-
xpadding
|
21
|
+
xpadding?: boolean;
|
22
22
|
};
|
23
23
|
|
24
24
|
const List = (props: ListProps) => {
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import React, { useEffect } from "react";
|
2
2
|
import ReactDOM from "react-dom";
|
3
|
-
|
4
3
|
import {
|
5
4
|
Popper,
|
6
5
|
Manager as PopperManager,
|
@@ -23,7 +22,7 @@ type PbPopoverProps = {
|
|
23
22
|
aria?: { [key: string]: string };
|
24
23
|
className?: string;
|
25
24
|
closeOnClick?: "outside" | "inside" | "any";
|
26
|
-
data?:
|
25
|
+
data?: { [key: string]: string },
|
27
26
|
id?: string;
|
28
27
|
offset?: boolean;
|
29
28
|
reference: PopperReference & any;
|
@@ -100,31 +99,31 @@ const Popover = (props: PbPopoverProps) => {
|
|
100
99
|
|
101
100
|
return (
|
102
101
|
<Popper
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
modifiers={popoverModifiers({ modifiers, offset })}
|
103
|
+
placement={placement}
|
104
|
+
referenceElement={referenceElement}
|
106
105
|
>
|
107
106
|
{({ placement, ref, style }) => {
|
108
107
|
return (
|
109
108
|
<div
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
109
|
+
{...ariaProps}
|
110
|
+
{...dataProps}
|
111
|
+
className={classes}
|
112
|
+
data-placement={placement}
|
113
|
+
id={id}
|
114
|
+
ref={ref}
|
115
|
+
style={Object.assign({}, style, zIndexStyle)}
|
117
116
|
>
|
118
117
|
<div
|
119
|
-
|
118
|
+
className={classnames(`${buildCss("pb_popover_tooltip")} show`)}
|
120
119
|
>
|
121
120
|
<div
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
121
|
+
className={classnames(
|
122
|
+
"pb_popover_body",
|
123
|
+
popoverSpacing,
|
124
|
+
overflowHandling
|
125
|
+
)}
|
126
|
+
style={widthHeightStyles()}
|
128
127
|
>
|
129
128
|
{children}
|
130
129
|
</div>
|
@@ -192,17 +191,17 @@ const PbReactPopover = (props: PbPopoverProps) => {
|
|
192
191
|
|
193
192
|
const popoverComponent = (
|
194
193
|
<Popover
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
194
|
+
className={className}
|
195
|
+
maxHeight={maxHeight}
|
196
|
+
maxWidth={maxWidth}
|
197
|
+
minHeight={minHeight}
|
198
|
+
minWidth={minWidth}
|
199
|
+
modifiers={modifiers}
|
200
|
+
offset={offset}
|
201
|
+
placement={placement}
|
202
|
+
referenceElement={referenceElement}
|
203
|
+
zIndex={zIndex}
|
204
|
+
{...props}
|
206
205
|
>
|
207
206
|
{children}
|
208
207
|
</Popover>
|
@@ -214,7 +213,9 @@ const PbReactPopover = (props: PbPopoverProps) => {
|
|
214
213
|
{reference && !referenceElement && (
|
215
214
|
<PopperReference>
|
216
215
|
{({ ref }) => (
|
217
|
-
<span
|
216
|
+
<span
|
217
|
+
className="pb_popover_reference_wrapper"
|
218
|
+
ref={ref}>
|
218
219
|
<reference.type {...reference.props} />
|
219
220
|
</span>
|
220
221
|
)}
|
@@ -236,4 +237,4 @@ const PbReactPopover = (props: PbPopoverProps) => {
|
|
236
237
|
);
|
237
238
|
};
|
238
239
|
|
239
|
-
export default PbReactPopover;
|
240
|
+
export default PbReactPopover;
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.5.0.pre.alpha.
|
4
|
+
version: 12.5.0.pre.alpha.filter1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -754,7 +754,6 @@ files:
|
|
754
754
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss
|
755
755
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_header_styles.scss
|
756
756
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss
|
757
|
-
- app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss
|
758
757
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_month_and_year_styles.scss
|
759
758
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss
|
760
759
|
- app/pb_kits/playbook/pb_date_picker/sass_partials/_time_selection_styles.scss
|
@@ -911,16 +910,16 @@ files:
|
|
911
910
|
- app/pb_kits/playbook/pb_file_upload/docs/example.yml
|
912
911
|
- app/pb_kits/playbook/pb_file_upload/docs/index.js
|
913
912
|
- app/pb_kits/playbook/pb_file_upload/fileupload.test.js
|
914
|
-
- app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.
|
915
|
-
- app/pb_kits/playbook/pb_filter/Filter/FilterBackground.
|
916
|
-
- app/pb_kits/playbook/pb_filter/Filter/FilterDouble.
|
917
|
-
- app/pb_kits/playbook/pb_filter/Filter/FilterSingle.
|
918
|
-
- app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.
|
919
|
-
- app/pb_kits/playbook/pb_filter/Filter/ResultsCount.
|
920
|
-
- app/pb_kits/playbook/pb_filter/Filter/SortMenu.
|
921
|
-
- app/pb_kits/playbook/pb_filter/Filter/index.
|
922
|
-
- app/pb_kits/playbook/pb_filter/_filter.jsx
|
913
|
+
- app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx
|
914
|
+
- app/pb_kits/playbook/pb_filter/Filter/FilterBackground.tsx
|
915
|
+
- app/pb_kits/playbook/pb_filter/Filter/FilterDouble.tsx
|
916
|
+
- app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx
|
917
|
+
- app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx
|
918
|
+
- app/pb_kits/playbook/pb_filter/Filter/ResultsCount.tsx
|
919
|
+
- app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx
|
920
|
+
- app/pb_kits/playbook/pb_filter/Filter/index.tsx
|
923
921
|
- app/pb_kits/playbook/pb_filter/_filter.scss
|
922
|
+
- app/pb_kits/playbook/pb_filter/_filter.tsx
|
924
923
|
- app/pb_kits/playbook/pb_filter/docs/_description.md
|
925
924
|
- app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb
|
926
925
|
- app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx
|
@@ -1,68 +0,0 @@
|
|
1
|
-
@import "../../pb_textarea/textarea_mixin";
|
2
|
-
|
3
|
-
[class^=pb_date_picker_kit] {
|
4
|
-
margin-bottom: $space_sm;
|
5
|
-
|
6
|
-
.pb_date_picker_kit_label {
|
7
|
-
margin-bottom: $space_xs;
|
8
|
-
display: block;
|
9
|
-
}
|
10
|
-
|
11
|
-
.date_picker_input_wrapper {
|
12
|
-
display: block;
|
13
|
-
|
14
|
-
input::placeholder,
|
15
|
-
.date_picker_input .placeholder {
|
16
|
-
@include pb_body_light;
|
17
|
-
}
|
18
|
-
|
19
|
-
input,
|
20
|
-
.date_picker_input {
|
21
|
-
max-height: 45px;
|
22
|
-
@include pb_textarea_light;
|
23
|
-
overflow: hidden;
|
24
|
-
}
|
25
|
-
|
26
|
-
input:hover,
|
27
|
-
.date_picker_input:hover {
|
28
|
-
background-color: rgba($focus_input_light, $opacity_5);
|
29
|
-
}
|
30
|
-
|
31
|
-
input:focus,
|
32
|
-
.date_picker_input:focus,
|
33
|
-
input:-webkit-autofill:focus,
|
34
|
-
.date_picker_input:-webkit-autofill:focus {
|
35
|
-
@include pb_textarea_focus;
|
36
|
-
@include transition_default;
|
37
|
-
border-color: $primary;
|
38
|
-
background-color: rgba($focus_input_light, $opacity_5);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
&.error {
|
43
|
-
.date_picker_input_wrapper {
|
44
|
-
[class*=pb_body_kit] {
|
45
|
-
margin-top: $space_xs / 2;
|
46
|
-
}
|
47
|
-
|
48
|
-
input,
|
49
|
-
.date_picker_input {
|
50
|
-
border-color: $error;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
&.inline {
|
56
|
-
.date_picker_input_wrapper input::placeholder,
|
57
|
-
.date_picker_input_wrapper .date_picker_input .placeholder {
|
58
|
-
opacity: 1;
|
59
|
-
}
|
60
|
-
|
61
|
-
&:not(:hover) {
|
62
|
-
.date_picker_input_wrapper input:not(:focus) {
|
63
|
-
background-color: transparent;
|
64
|
-
border-color: transparent;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
}
|
@@ -1,76 +0,0 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
|
-
import React from 'react'
|
4
|
-
import { isEmpty, map, omitBy } from 'lodash'
|
5
|
-
|
6
|
-
import Body from '../../pb_body/_body'
|
7
|
-
import Caption from '../../pb_caption/_caption'
|
8
|
-
import Title from '../../pb_title/_title'
|
9
|
-
|
10
|
-
export type FilterDescription = {
|
11
|
-
[key: string]: ?string | boolean,
|
12
|
-
}
|
13
|
-
|
14
|
-
export type CurrentFiltersProps = {
|
15
|
-
dark: boolean,
|
16
|
-
filters: FilterDescription,
|
17
|
-
}
|
18
|
-
|
19
|
-
const hiddenFilters = (value) => isEmpty(value) && value !== true
|
20
|
-
|
21
|
-
const CurrentFilters = ({ dark, filters }: CurrentFiltersProps) => {
|
22
|
-
const displayableFilters = omitBy(filters, hiddenFilters)
|
23
|
-
|
24
|
-
return (
|
25
|
-
<div className="maskContainer">
|
26
|
-
<If condition={isEmpty(filters)}>
|
27
|
-
<div className="filters">
|
28
|
-
<Body
|
29
|
-
color="light"
|
30
|
-
paddingLeft="xs"
|
31
|
-
size={4}
|
32
|
-
tag="h4"
|
33
|
-
text="No Filter Selected"
|
34
|
-
/>
|
35
|
-
</div>
|
36
|
-
</If>
|
37
|
-
<If condition={!isEmpty(filters)}>
|
38
|
-
<div className="filters">
|
39
|
-
<div className="left_gradient" />
|
40
|
-
{map(displayableFilters, (value, name) => (
|
41
|
-
<div
|
42
|
-
className="filter"
|
43
|
-
key={`filter-${name}`}
|
44
|
-
>
|
45
|
-
<Choose>
|
46
|
-
<When condition={value === true}>
|
47
|
-
<Title
|
48
|
-
dark={dark}
|
49
|
-
size={4}
|
50
|
-
tag="h4"
|
51
|
-
text={name}
|
52
|
-
/>
|
53
|
-
</When>
|
54
|
-
<Otherwise>
|
55
|
-
<Caption
|
56
|
-
dark={dark}
|
57
|
-
text={name}
|
58
|
-
/>
|
59
|
-
<Title
|
60
|
-
dark={dark}
|
61
|
-
size={4}
|
62
|
-
tag="h4"
|
63
|
-
text={value}
|
64
|
-
/>
|
65
|
-
</Otherwise>
|
66
|
-
</Choose>
|
67
|
-
</div>
|
68
|
-
))}
|
69
|
-
<div className="right_gradient" />
|
70
|
-
</div>
|
71
|
-
</If>
|
72
|
-
</div>
|
73
|
-
)
|
74
|
-
}
|
75
|
-
|
76
|
-
export default CurrentFilters
|