playbook_ui 13.15.0.pre.alpha.reactselectbump581876 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ca676b218e6956f950563cede091218e594c685e9c902ba0e5b7478e0561c1c
4
- data.tar.gz: af5307c638dc31401f477054c274923745611d3c1568d28c3d26cf0129912953
3
+ metadata.gz: d3d5b87f2b6c16e79587bb3c5e948214ab861f720b447f1de049940fe74d6d3f
4
+ data.tar.gz: 35f0b35d0c9e112c30f0ca5af3916e1b57f05068650e320c1da973a97cf12936
5
5
  SHA512:
6
- metadata.gz: fb7968ecdf0f3d18fbd18a6f55111189137d5007b73b6fb0a00f52749430de3b439877539dfb156ffd847ca3d34de035cc13bd74055c42c21f8d1f86f621fe4b
7
- data.tar.gz: 1e0bc3be07289cc06e6143304203cd20cd3e831e5cbe604f05a8e5229688a9240166a618293537a70ae2f34ef276604c0aa2e987f453d16554683bf7a146b689
6
+ metadata.gz: dcec116e1d5fb1e095e0b92fec1a0a80f85407472821bcd7a22bafdafbd6e3d412d72237ab150c3338e934043e7a5427e567ceb87b2615836716e1cf2928c5a1
7
+ data.tar.gz: 88b6924b8a19996f02acad09f739e80a04aec6c2caf49374bb5ec37709f84939c29ecc8a9e591297d4d436c5e80c2c5060552423a073ba1bc3be4c02e38b4be8
@@ -122,9 +122,11 @@ const highchartsDarkTheme: ThemeProps = {
122
122
  // specific to gauge
123
123
  // unfilled gauge color
124
124
  pane: {
125
- background: [{
125
+ background: {
126
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
127
+ // @ts-ignore
126
128
  borderColor: colors.border_dark,
127
- }],
129
+ },
128
130
  },
129
131
 
130
132
  plotOptions: {
@@ -122,9 +122,11 @@ const highchartsTheme: ThemeProps = {
122
122
  // specific to gauge
123
123
  // unfilled gauge color
124
124
  pane: {
125
- background: [{
126
- borderColor: colors.border_light,
127
- }],
125
+ background: {
126
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
127
+ // @ts-ignore
128
+ borderColor: colors.border_light,
129
+ },
128
130
  },
129
131
 
130
132
  plotOptions: {
@@ -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="date_picker_input_wrapper">
224
+ <div className={`date_picker_input_wrapper ${inputClasses}`}>
183
225
  <input
184
226
  autoComplete="off"
185
227
  className="date_picker_input"
@@ -19,6 +19,7 @@
19
19
  name: object.name,
20
20
  placeholder: object.placeholder,
21
21
  required: object.required,
22
+ classname: margins_to_remove.join(" ")
22
23
  }) %>
23
24
  <% end %>
24
25
 
@@ -80,4 +81,4 @@
80
81
  }
81
82
  })
82
83
  <% end %>
83
- <% end %>
84
+ <% end %>
@@ -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
- generate_classname("pb_date_picker_kit")
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
@@ -1,7 +1,6 @@
1
1
  @import "../../pb_textarea/textarea_mixin";
2
2
 
3
3
  [class^=pb_date_picker_kit] {
4
- margin-bottom: $space_sm;
5
4
 
6
5
  .pb_date_picker_kit_label {
7
6
  margin-bottom: $space_xs;
@@ -65,4 +64,4 @@
65
64
  }
66
65
  }
67
66
  }
68
- }
67
+ }
@@ -3,7 +3,6 @@
3
3
  @import "../tokens/colors";
4
4
 
5
5
  [class^="pb_text_input_kit"] {
6
- margin-bottom: $space_sm;
7
6
  .pb_text_input_kit_label {
8
7
  margin-bottom: $space_xs;
9
8
  display: block;
@@ -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