playbook_ui 13.15.0.pre.alpha.PLAY11311893 → 13.15.0.pre.alpha.1132globalpropdatepickerspacing1929
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 +2 -3
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +43 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +15 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +1 -2
- data/app/pb_kits/playbook/pb_select/_select.scss +4 -13
- data/app/pb_kits/playbook/pb_select/_select.tsx +4 -7
- data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_select/select.rb +1 -6
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +0 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +4 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +5 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +2 -4
- data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.html.erb +0 -24
- data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.jsx +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3d5b87f2b6c16e79587bb3c5e948214ab861f720b447f1de049940fe74d6d3f
|
4
|
+
data.tar.gz: 35f0b35d0c9e112c30f0ca5af3916e1b57f05068650e320c1da973a97cf12936
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcec116e1d5fb1e095e0b92fec1a0a80f85407472821bcd7a22bafdafbd6e3d412d72237ab150c3338e934043e7a5427e567ceb87b2615836716e1cf2928c5a1
|
7
|
+
data.tar.gz: 88b6924b8a19996f02acad09f739e80a04aec6c2caf49374bb5ec37709f84939c29ecc8a9e591297d4d436c5e80c2c5060552423a073ba1bc3be4c02e38b4be8
|
@@ -10,7 +10,6 @@
|
|
10
10
|
|
11
11
|
[class^=pb_date_picker_kit] {
|
12
12
|
.input_wrapper {
|
13
|
-
margin-bottom: $space_sm;
|
14
13
|
position: relative;
|
15
14
|
|
16
15
|
.flatpickr-wrapper {
|
@@ -47,7 +46,7 @@
|
|
47
46
|
.text_input_wrapper_add_on .add-on-right .text_input{
|
48
47
|
cursor: pointer;
|
49
48
|
}
|
50
|
-
|
49
|
+
|
51
50
|
}
|
52
51
|
|
53
52
|
|
@@ -76,4 +75,4 @@
|
|
76
75
|
&:after {
|
77
76
|
content: none;
|
78
77
|
}
|
79
|
-
}
|
78
|
+
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import React, { useEffect } from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
|
4
|
+
import { Spacing } from "../types"
|
5
|
+
|
4
6
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
5
7
|
import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
|
6
8
|
|
@@ -9,6 +11,7 @@ import Icon from '../pb_icon/_icon'
|
|
9
11
|
import Caption from '../pb_caption/_caption'
|
10
12
|
import Body from '../pb_body/_body'
|
11
13
|
|
14
|
+
|
12
15
|
type DatePickerProps = {
|
13
16
|
allowInput?: boolean,
|
14
17
|
aria?: { [key: string]: string },
|
@@ -34,6 +37,13 @@ type DatePickerProps = {
|
|
34
37
|
inputOnChange?: (e: React.FormEvent<HTMLInputElement>) => void,
|
35
38
|
inputValue?: string,
|
36
39
|
label?: string,
|
40
|
+
margin?: Spacing;
|
41
|
+
marginBottom?: Spacing;
|
42
|
+
marginTop?: Spacing;
|
43
|
+
marginRight?: Spacing;
|
44
|
+
marginLeft?: Spacing;
|
45
|
+
marginX?: Spacing;
|
46
|
+
marginY?: Spacing;
|
37
47
|
maxDate: string,
|
38
48
|
minDate: string,
|
39
49
|
name: string,
|
@@ -78,6 +88,13 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
78
88
|
inputOnChange,
|
79
89
|
inputValue,
|
80
90
|
label = 'Date Picker',
|
91
|
+
margin,
|
92
|
+
marginBottom = "sm",
|
93
|
+
marginTop,
|
94
|
+
marginRight,
|
95
|
+
marginLeft,
|
96
|
+
marginX,
|
97
|
+
marginY,
|
81
98
|
maxDate,
|
82
99
|
minDate,
|
83
100
|
mode = 'single',
|
@@ -134,8 +151,33 @@ useEffect(() => {
|
|
134
151
|
required: false,
|
135
152
|
}, scrollContainer)
|
136
153
|
})
|
154
|
+
|
155
|
+
const spacingMarginProps = {
|
156
|
+
margin,
|
157
|
+
marginBottom,
|
158
|
+
marginTop,
|
159
|
+
marginRight,
|
160
|
+
marginLeft,
|
161
|
+
marginX,
|
162
|
+
marginY,
|
163
|
+
}
|
164
|
+
|
137
165
|
const filteredProps = {...props}
|
138
166
|
delete filteredProps?.position
|
167
|
+
delete filteredProps?.margin;
|
168
|
+
delete filteredProps?.marginX;
|
169
|
+
delete filteredProps?.marginY;
|
170
|
+
delete filteredProps?.marginBottom;
|
171
|
+
delete filteredProps?.marginTop;
|
172
|
+
delete filteredProps?.marginRight;
|
173
|
+
delete filteredProps?.marginLeft;
|
174
|
+
|
175
|
+
const inputClasses = classnames(
|
176
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
177
|
+
//@ts-ignore
|
178
|
+
globalProps(spacingMarginProps),
|
179
|
+
className
|
180
|
+
)
|
139
181
|
|
140
182
|
const classes = classnames(
|
141
183
|
buildCss('pb_date_picker_kit'),
|
@@ -179,7 +221,7 @@ useEffect(() => {
|
|
179
221
|
text={hideLabel ? null : label}
|
180
222
|
/>
|
181
223
|
<>
|
182
|
-
<div className=
|
224
|
+
<div className={`date_picker_input_wrapper ${inputClasses}`}>
|
183
225
|
<input
|
184
226
|
autoComplete="off"
|
185
227
|
className="date_picker_input"
|
@@ -74,8 +74,22 @@ module Playbook
|
|
74
74
|
prop :year_range, type: Playbook::Props::Array,
|
75
75
|
default: [1900, 2100]
|
76
76
|
|
77
|
+
def margins_to_remove
|
78
|
+
margin_classes_to_remove = []
|
79
|
+
margin_classes_to_remove << "m_#{object.margin}" if object.margin
|
80
|
+
margin_classes_to_remove << "mx_#{object.margin_x}" if object.margin_x
|
81
|
+
margin_classes_to_remove << "my_#{object.margin_y}" if object.margin_y
|
82
|
+
margin_classes_to_remove << "mb_#{object.margin_bottom}" if object.margin_bottom
|
83
|
+
margin_classes_to_remove << "mt_#{object.margin_top}" if object.margin_top
|
84
|
+
margin_classes_to_remove << "mr_#{object.margin_right}" if object.margin_right
|
85
|
+
margin_classes_to_remove << "ml_#{object.margin_left}" if object.margin_left
|
86
|
+
margin_classes_to_remove
|
87
|
+
end
|
88
|
+
|
77
89
|
def classname
|
78
|
-
|
90
|
+
regex = Regexp.union(margins_to_remove)
|
91
|
+
classnames = generate_classname("pb_date_picker_kit")
|
92
|
+
classnames.gsub(regex, "").strip.gsub(/\s+/, " ")
|
79
93
|
end
|
80
94
|
|
81
95
|
def date_picker_config
|
@@ -102,29 +102,20 @@
|
|
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
|
-
}
|
111
105
|
&:not(:hover) {
|
112
106
|
svg {
|
113
107
|
display: none;
|
114
108
|
}
|
115
109
|
}
|
116
|
-
&.show_arrow:not(:hover) {
|
117
|
-
svg {
|
118
|
-
display: block;
|
119
|
-
}
|
120
|
-
@include active_arrow_style();
|
121
|
-
}
|
122
110
|
&:hover {
|
123
|
-
@include active_arrow_style();
|
124
111
|
select {
|
125
112
|
color: $primary !important;
|
126
113
|
background: rgba(0,130,255,0.1);
|
127
114
|
}
|
115
|
+
svg {
|
116
|
+
color: $primary !important;
|
117
|
+
font-size: 16px;
|
118
|
+
}
|
128
119
|
}
|
129
120
|
select {
|
130
121
|
box-shadow: none;
|
@@ -36,7 +36,6 @@ type SelectProps = {
|
|
36
36
|
onChange: InputCallback<HTMLSelectElement>,
|
37
37
|
options: SelectOption[],
|
38
38
|
required?: boolean,
|
39
|
-
showArrow?: boolean,
|
40
39
|
value?: string,
|
41
40
|
} & GlobalProps
|
42
41
|
|
@@ -64,10 +63,9 @@ const Select = ({
|
|
64
63
|
inline = false,
|
65
64
|
multiple = false,
|
66
65
|
name,
|
67
|
-
onChange = () =>
|
66
|
+
onChange = () => {},
|
68
67
|
options = [],
|
69
68
|
required = false,
|
70
|
-
showArrow = false,
|
71
69
|
value,
|
72
70
|
...props
|
73
71
|
}: SelectProps, ref: React.LegacyRef<HTMLSelectElement>) => {
|
@@ -79,16 +77,15 @@ const Select = ({
|
|
79
77
|
const inlineClass = inline ? 'inline' : null
|
80
78
|
const compactClass = compact ? 'compact' : null
|
81
79
|
const classes = classnames(
|
82
|
-
buildCss(
|
80
|
+
buildCss('pb_select'),
|
83
81
|
globalProps({
|
84
82
|
...props,
|
85
|
-
marginBottom: props.marginBottom || props.margin ||
|
83
|
+
marginBottom: props.marginBottom || props.margin || 'sm',
|
86
84
|
}),
|
87
85
|
className,
|
88
86
|
inlineClass,
|
89
|
-
{ show_arrow: showArrow },
|
90
87
|
compactClass
|
91
|
-
)
|
88
|
+
)
|
92
89
|
|
93
90
|
const selectWrapperClass = classnames(buildCss('pb_select_kit_wrapper'), { error }, className)
|
94
91
|
const selectBody =(() =>{
|
@@ -10,7 +10,6 @@ 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)
|
14
13
|
- select_inline_compact: Select Inline Compact
|
15
14
|
- select_attributes: Select W/ Attributes
|
16
15
|
- select_multiple: Select Multiple
|
@@ -27,7 +26,6 @@ examples:
|
|
27
26
|
- select_custom_select: Custom Select
|
28
27
|
- select_error: Select w/ Error
|
29
28
|
- select_inline: Select Inline
|
30
|
-
- select_inline_show_arrow: Select Inline (Always Show Arrow)
|
31
29
|
- select_inline_compact: Select Inline Compact
|
32
30
|
- select_multiple: Select Multiple
|
33
31
|
|
@@ -7,6 +7,5 @@ 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'
|
11
10
|
export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
|
12
11
|
export { default as SelectMultiple } from './_select_multiple.jsx'
|
@@ -19,11 +19,10 @@ 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
|
23
22
|
prop :required, type: Playbook::Props::Boolean, default: false
|
24
23
|
|
25
24
|
def classnames
|
26
|
-
classname + inline_class + compact_class
|
25
|
+
classname + inline_class + compact_class
|
27
26
|
end
|
28
27
|
|
29
28
|
def all_attributes
|
@@ -50,10 +49,6 @@ module Playbook
|
|
50
49
|
compact ? "compact" : ""
|
51
50
|
end
|
52
51
|
|
53
|
-
def show_arrow_class
|
54
|
-
show_arrow ? "show_arrow" : ""
|
55
|
-
end
|
56
|
-
|
57
52
|
def select_wrapper_class
|
58
53
|
"pb_select_kit_wrapper" + error_class
|
59
54
|
end
|
@@ -70,12 +70,15 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
70
70
|
const shouldShowAddOn = icon !== null
|
71
71
|
const addOnCss = shouldShowAddOn ? 'text_input_wrapper_add_on' : ""
|
72
72
|
const addOnDarkModeCardCss = (shouldShowAddOn && dark) ? 'add-on-card-dark' : ""
|
73
|
+
const defaultMarginBottom = props.marginBottom ?? "mb_sm"
|
74
|
+
|
73
75
|
const css = classnames([
|
74
76
|
'pb_text_input_kit',
|
75
77
|
inline ? 'inline' : "",
|
76
78
|
error ? 'error' : "",
|
77
79
|
globalProps(props),
|
78
80
|
className,
|
81
|
+
defaultMarginBottom
|
79
82
|
])
|
80
83
|
const addOnIcon = (
|
81
84
|
<Icon
|
@@ -144,7 +147,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
144
147
|
{...htmlProps}
|
145
148
|
className={css}
|
146
149
|
>
|
147
|
-
{label &&
|
150
|
+
{label &&
|
148
151
|
<Caption
|
149
152
|
className="pb_text_input_kit_label"
|
150
153
|
text={label}
|
@@ -25,8 +25,12 @@ module Playbook
|
|
25
25
|
prop :add_on, type: Playbook::Props::NestedProps,
|
26
26
|
nested_kit: Playbook::PbTextInput::AddOn
|
27
27
|
|
28
|
+
def default_margin_bottom
|
29
|
+
object.margin_bottom.present? ? "" : " mb_sm"
|
30
|
+
end
|
31
|
+
|
28
32
|
def classname
|
29
|
-
generate_classname("pb_text_input_kit") + error_class + inline_class
|
33
|
+
generate_classname("pb_text_input_kit") + error_class + inline_class + default_margin_bottom
|
30
34
|
end
|
31
35
|
|
32
36
|
def input_tag
|