playbook_ui 15.1.0.pre.alpha.PLAY251810942 → 15.1.0.pre.alpha.iconstatvaluescss10956

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea9f5c8acfb10e8fb3d40fea187b82854b1fb068361853c9b032f91fca4685ad
4
- data.tar.gz: ff8472f9f4055f5b24cb17583c02c37fa5cc022f37bf7d36869cb4d2dc06feaf
3
+ metadata.gz: 023dae1c06846305a2de70d79d36fac8bb6e685e9eed4da1157a84559d3749c6
4
+ data.tar.gz: f8154d1b04e55366e85ddf6f2a21d2e465d49ba40d6a456ddb43450307930e91
5
5
  SHA512:
6
- metadata.gz: a7a3df82c8d6bb097dc840c452b3658a4751f3ecb1efde791db7043328cca7a1450adb4d56b0b1d52e13ebd7e75163573105a2910bd01faeca49c05937086f83
7
- data.tar.gz: 869e0b7510f081c28a277b0f77f1c96e2f63dccfc5955913140a00952741545f79e728370a234ded1cedba4fde080bbd396650e357a37b24ede37ac55428bfff
6
+ metadata.gz: d7fa8e2b752601706f4aa07fc61cb6c08280c21c315faf666ef054eac38a01e6e14e17fe5015de1d6c3734ba0fae3039b01223ab85a32a305166ca0bd06983e7
7
+ data.tar.gz: f61864e43078b05767ba7fc2335881b00ee99799b8731ca982e00a43fc952c5b085b5712626d66b410548f5b6e83bbaf200b2343bf6ef4f7aff8ee94b046e76d
@@ -10,15 +10,9 @@
10
10
  @import "./scss_partials/dropdown_animation";
11
11
  @import "dropdown_mixin";
12
12
 
13
- .pb_dropdown_default,
14
- .pb_dropdown_subtle,
15
- .pb_dropdown_default_separators_hidden,
16
- .pb_dropdown_subtle_separators_hidden {
13
+ [class*="pb_dropdown"] {
17
14
  .dropdown_wrapper {
18
- .dropdown_trigger_wrapper,
19
- .dropdown_trigger_wrapper_focus,
20
- .dropdown_trigger_wrapper_focus_select_only,
21
- .dropdown_trigger_wrapper_select_only {
15
+ [class*="dropdown_trigger_wrapper"] {
22
16
  @include pb_body;
23
17
  border: 1px solid $border_light;
24
18
  background-color: $white;
@@ -54,11 +48,11 @@
54
48
  transition: box-shadow 0.15s ease-in-out;
55
49
  }
56
50
 
57
- &.dropdown_trigger_wrapper_select_only {
51
+ &[class*="_select_only"] {
58
52
  box-shadow: inset 0 -11px 20px rgba($primary, 0.05);
59
53
  }
60
54
 
61
- &.dropdown_trigger_wrapper_focus {
55
+ &[class*="_focus"] {
62
56
  box-shadow: 0px 0px 0 1px $primary !important;
63
57
  transition: box-shadow 0.1s ease-in-out;
64
58
  }
@@ -75,12 +69,7 @@
75
69
  z-index: $z_1;
76
70
  width: 100%;
77
71
 
78
- .pb_dropdown_option,
79
- .pb_dropdown_option_list,
80
- .pb_dropdown_option_selected,
81
- .pb_dropdown_option_focused,
82
- .pb_dropdown_option_list_focused,
83
- .pb_dropdown_option_selected_focused {
72
+ [class*="pb_dropdown_option"] {
84
73
  padding-left: $space_sm;
85
74
  padding-right: $space_sm;
86
75
  padding-top: $space_xs;
@@ -90,14 +79,11 @@
90
79
  background-color: $bg_light;
91
80
  }
92
81
 
93
- &.pb_dropdown_option_focused,
94
- &.pb_dropdown_option_list_focused,
95
- &.pb_dropdown_option_selected_focused {
82
+ &[class*="_focused"] {
96
83
  background-color: $bg_light;
97
84
  }
98
85
 
99
- &.pb_dropdown_option_list,
100
- &.pb_dropdown_option_list_focused {
86
+ &[class*="_list"] {
101
87
  border-bottom: 1px solid $border_light;
102
88
 
103
89
  &:hover, &:focus {
@@ -106,8 +92,7 @@
106
92
  }
107
93
  }
108
94
  }
109
- &.pb_dropdown_option_selected,
110
- &.pb_dropdown_option_selected_focused {
95
+ &[class*="selected"] {
111
96
  background-color: $primary;
112
97
  color: $white;
113
98
  [class^="pb_body"],
@@ -156,66 +141,41 @@
156
141
  }
157
142
 
158
143
  &.error {
159
- .pb_body_kit_negative {
144
+ [class*=pb_body_kit] {
160
145
  margin-top: $space_xs / 2;
161
146
  }
162
147
 
163
- .dropdown_trigger_wrapper,
164
- .dropdown_trigger_wrapper_focus,
165
- .dropdown_trigger_wrapper_focus_select_only,
166
- .dropdown_trigger_wrapper_select_only {
148
+ [class*="dropdown_trigger_wrapper"] {
167
149
  border-color: $error;
168
150
  box-shadow: none !important;
169
151
  }
170
152
  }
171
153
  }
172
154
 
173
- &.pb_dropdown_default_separators_hidden,
174
- &.pb_dropdown_subtle_separators_hidden {
155
+ &[class*="separators_hidden"] {
175
156
  .dropdown_wrapper {
176
157
  .pb_dropdown_container {
177
158
 
178
- .pb_dropdown_option,
179
- .pb_dropdown_option_list,
180
- .pb_dropdown_option_selected,
181
- .pb_dropdown_option_focused,
182
- .pb_dropdown_option_list_focused,
183
- .pb_dropdown_option_selected_focused {
159
+ [class*="pb_dropdown_option"] {
184
160
  border: none;
185
161
  }
186
162
  }
187
163
  }
188
164
  }
189
165
 
190
- &.pb_dropdown_subtle,
191
- &.pb_dropdown_subtle_separators_hidden {
166
+ &[class*="subtle"] {
192
167
  .dropdown_wrapper {
193
168
  .pb_dropdown_container {
194
169
 
195
- .pb_dropdown_option:first-child,
196
- .pb_dropdown_option_list:first-child,
197
- .pb_dropdown_option_selected:first-child,
198
- .pb_dropdown_option_focused:first-child,
199
- .pb_dropdown_option_list_focused:first-child,
200
- .pb_dropdown_option_selected_focused:first-child {
170
+ [class*="pb_dropdown_option"]:first-child {
201
171
  margin-top: $space_xs;
202
172
  }
203
173
 
204
- .pb_dropdown_option:last-child,
205
- .pb_dropdown_option_list:last-child,
206
- .pb_dropdown_option_selected:last-child,
207
- .pb_dropdown_option_focused:last-child,
208
- .pb_dropdown_option_list_focused:last-child,
209
- .pb_dropdown_option_selected_focused:last-child {
174
+ [class*="pb_dropdown_option"]:last-child {
210
175
  margin-bottom: $space_xs;
211
176
  }
212
177
 
213
- .pb_dropdown_option,
214
- .pb_dropdown_option_list,
215
- .pb_dropdown_option_selected,
216
- .pb_dropdown_option_focused,
217
- .pb_dropdown_option_list_focused,
218
- .pb_dropdown_option_selected_focused {
178
+ [class*="pb_dropdown_option"] {
219
179
  margin: $space_xs;
220
180
  padding: $space_xs;
221
181
  border-radius: $border_radius_md;
@@ -233,44 +193,24 @@
233
193
  }
234
194
  }
235
195
 
236
- .pb_dropdown_option:last-child::after,
237
- .pb_dropdown_option_list:last-child::after,
238
- .pb_dropdown_option_selected:last-child::after,
239
- .pb_dropdown_option_focused:last-child::after,
240
- .pb_dropdown_option_list_focused:last-child::after,
241
- .pb_dropdown_option_selected_focused:last-child::after {
196
+ [class*="pb_dropdown_option"]:last-child::after {
242
197
  display: none;
243
198
  }
244
199
  }
245
200
  }
246
201
 
247
- &.pb_dropdown_subtle_separators_hidden {
202
+ &[class*="separators_hidden"] {
248
203
  .dropdown_wrapper {
249
204
  .pb_dropdown_container {
250
- .pb_dropdown_option:first-child,
251
- .pb_dropdown_option_list:first-child,
252
- .pb_dropdown_option_selected:first-child,
253
- .pb_dropdown_option_focused:first-child,
254
- .pb_dropdown_option_list_focused:first-child,
255
- .pb_dropdown_option_selected_focused:first-child {
205
+ [class*="pb_dropdown_option"]:first-child {
256
206
  margin-top: $space_xs;
257
207
  }
258
208
 
259
- .pb_dropdown_option:last-child,
260
- .pb_dropdown_option_list:last-child,
261
- .pb_dropdown_option_selected:last-child,
262
- .pb_dropdown_option_focused:last-child,
263
- .pb_dropdown_option_list_focused:last-child,
264
- .pb_dropdown_option_selected_focused:last-child {
209
+ [class*="pb_dropdown_option"]:last-child {
265
210
  margin-bottom: $space_xs;
266
211
  }
267
212
 
268
- .pb_dropdown_option,
269
- .pb_dropdown_option_list,
270
- .pb_dropdown_option_selected,
271
- .pb_dropdown_option_focused,
272
- .pb_dropdown_option_list_focused,
273
- .pb_dropdown_option_selected_focused {
213
+ [class*="pb_dropdown_option"] {
274
214
  padding: $space_xxs $space_xs;
275
215
  margin: $space_xxs $space_xs;
276
216
 
@@ -278,8 +218,7 @@
278
218
  height: 0px;
279
219
  }
280
220
 
281
- &.pb_dropdown_option_selected,
282
- &.pb_dropdown_option_selected_focused {
221
+ &[class*="selected"] {
283
222
  border-bottom: none;
284
223
  }
285
224
  }
@@ -290,10 +229,7 @@
290
229
 
291
230
  &.dark {
292
231
  .dropdown_wrapper {
293
- .dropdown_trigger_wrapper,
294
- .dropdown_trigger_wrapper_focus,
295
- .dropdown_trigger_wrapper_focus_select_only,
296
- .dropdown_trigger_wrapper_select_only {
232
+ [class*="dropdown_trigger_wrapper"] {
297
233
  @include pb_body_light_dark;
298
234
  background-color: rgba($white, 0.1) !important;
299
235
  background: none;
@@ -308,7 +244,7 @@
308
244
  [class^="pb_body"] {
309
245
  color: $white;
310
246
  }
311
- &.dropdown_trigger_wrapper_select_only {
247
+ &[class*="_select_only"] {
312
248
  box-shadow: inset 0 -11px 20px rgba($white, 0.05);
313
249
  }
314
250
  .dropdown_input {
@@ -318,10 +254,7 @@
318
254
  }
319
255
 
320
256
  &.error {
321
- .dropdown_trigger_wrapper,
322
- .dropdown_trigger_wrapper_focus,
323
- .dropdown_trigger_wrapper_focus_select_only,
324
- .dropdown_trigger_wrapper_select_only {
257
+ [class*="dropdown_trigger_wrapper"] {
325
258
  border-color: $error_dark;
326
259
  }
327
260
  }
@@ -335,28 +268,19 @@
335
268
  color: $white !important;
336
269
  }
337
270
 
338
- .pb_dropdown_option,
339
- .pb_dropdown_option_list,
340
- .pb_dropdown_option_selected,
341
- .pb_dropdown_option_focused,
342
- .pb_dropdown_option_list_focused,
343
- .pb_dropdown_option_selected_focused {
271
+ [class*="pb_dropdown_option"] {
344
272
  &:hover {
345
273
  background-color: $hover_dark;
346
274
  }
347
275
 
348
- &.pb_dropdown_option_focused,
349
- &.pb_dropdown_option_list_focused,
350
- &.pb_dropdown_option_selected_focused {
276
+ &[class*="_focused"] {
351
277
  background-color: $hover_dark;
352
278
  }
353
279
 
354
- &.pb_dropdown_option_list,
355
- &.pb_dropdown_option_list_focused {
280
+ &[class*="_list"] {
356
281
  border-color: rgba($white, 0.15);
357
282
  }
358
- &.pb_dropdown_option_selected,
359
- &.pb_dropdown_option_selected_focused {
283
+ &[class*="selected"] {
360
284
  background-color: $primary;
361
285
  border-bottom: rgba($white, 0.15);
362
286
  }
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import classnames from 'classnames'
4
4
 
5
5
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps'
6
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
7
7
 
8
8
  import Icon from '../pb_icon/_icon'
9
9
 
@@ -26,7 +26,7 @@ type IconCircleProps = {
26
26
  | "orange"
27
27
  | "green"
28
28
  | "lighter",
29
- }
29
+ } & GlobalProps
30
30
 
31
31
  const IconCircle = (props: IconCircleProps) => {
32
32
  const {
@@ -3,51 +3,45 @@
3
3
  @import "../tokens/spacing";
4
4
  @import "../pb_icon_circle/icon_circle";
5
5
 
6
- [class^=pb_icon_stat_value_kit]{
6
+ .pb_icon_stat_value_kit_horizontal,
7
+ .pb_icon_stat_value_kit_vertical
8
+ {
7
9
  display: flex;
8
10
  align-items: baseline;
9
11
 
10
- &[class*=_vertical] {
12
+ &.pb_icon_stat_value_kit_vertical {
11
13
  flex-direction: column;
12
14
 
13
- &[class*=_center] {
15
+ &.text_align_center {
14
16
  align-items: center;
15
17
 
16
- [class^=pb_title],
17
- [class^=pb_body],
18
- [class^=pb_caption] {
18
+ .pb_title_kit,
19
+ .pb_body_kit,
20
+ .pb_caption_kit_md {
19
21
  text-align: center;
20
22
  }
21
23
  }
22
24
 
23
- &[class*=_right] {
25
+ &.text_align_right {
24
26
  align-items: flex-end;
25
27
 
26
- [class^=pb_title],
27
- [class^=pb_body],
28
- [class^=pb_caption] {
28
+ .pb_title_kit,
29
+ .pb_body_kit,
30
+ .pb_caption_kit_md {
29
31
  text-align: right;
30
32
  }
31
33
  }
32
-
33
- [class^=pb_icon_circle] {
34
- margin-bottom: $space-xs;
35
- }
36
34
  }
37
35
 
38
- &[class*=_horizontal] {
36
+ &.pb_icon_stat_value_kit_horizontal {
39
37
  align-items: center;
40
38
 
41
- &[class*=_center] {
39
+ &.text_align_center {
42
40
  justify-content: center;
43
41
  }
44
42
 
45
- &[class*=_right] {
43
+ &.text_align_right {
46
44
  justify-content: flex-end;
47
45
  }
48
-
49
- [class^=pb_icon_circle] {
50
- margin-right: $space-sm;
51
- }
52
46
  }
53
47
  }
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
- import { globalProps } from '../utilities/globalProps'
5
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Body from '../pb_body/_body'
8
8
  import Caption from '../pb_caption/_caption'
@@ -33,8 +33,7 @@ type IconStatValueProps = {
33
33
  | "yellow"
34
34
  | "orange"
35
35
  | "green"
36
- | "lighter",
37
- }
36
+ } & GlobalProps
38
37
 
39
38
  const IconStatValue = (props: IconStatValueProps): React.ReactElement => {
40
39
  const {
@@ -50,13 +49,13 @@ const IconStatValue = (props: IconStatValueProps): React.ReactElement => {
50
49
  text = '',
51
50
  unit = '',
52
51
  value = 0,
53
- variant = 'lighter',
52
+ variant = 'default',
54
53
  } = props
55
54
  const ariaProps = buildAriaProps(aria)
56
55
  const dataProps = buildDataProps(data)
57
56
  const htmlProps = buildHtmlProps(htmlOptions)
58
57
  const classes = classnames(
59
- buildCss('pb_icon_stat_value_kit', orientation, size, variant), globalProps(props),
58
+ buildCss('pb_icon_stat_value_kit', orientation), globalProps(props),
60
59
  className
61
60
  )
62
61
  const titleSize = function(size: "sm" | "md" | "lg") {
@@ -101,6 +100,8 @@ const IconStatValue = (props: IconStatValueProps): React.ReactElement => {
101
100
  <IconCircle
102
101
  dark={dark}
103
102
  icon={icon}
103
+ marginBottom={orientation == 'vertical' ? 'xs' : undefined}
104
+ marginRight={orientation == 'horizontal' ? 'sm' : undefined}
104
105
  size={size}
105
106
  variant={variant}
106
107
  />
@@ -3,6 +3,8 @@
3
3
  <%= pb_rails("icon_circle", props: {
4
4
  dark: object.dark,
5
5
  icon: object.icon,
6
+ margin_right: object.icon_margin_right,
7
+ margin_bottom: object.icon_margin_bottom,
6
8
  size: object.size,
7
9
  variant: object.variant }) %>
8
10
 
@@ -9,8 +9,8 @@ module Playbook
9
9
  values: %w[sm md lg],
10
10
  default: "sm"
11
11
  prop :variant, type: Playbook::Props::Enum,
12
- values: %w[default royal blue purple teal red yellow green orange lighter],
13
- default: "lighter"
12
+ values: %w[default royal blue purple teal red yellow green orange],
13
+ default: "default"
14
14
 
15
15
  prop :orientation, type: Playbook::Props::Enum,
16
16
  values: %w[vertical horizontal],
@@ -25,7 +25,7 @@ module Playbook
25
25
  prop :value
26
26
 
27
27
  def classname
28
- generate_classname("pb_icon_stat_value_kit", orientation, size, variant)
28
+ generate_classname("pb_icon_stat_value_kit", orientation)
29
29
  end
30
30
 
31
31
  def value_string
@@ -41,6 +41,14 @@ module Playbook
41
41
  3
42
42
  end
43
43
  end
44
+
45
+ def icon_margin_right
46
+ orientation === "horizontal" && "sm"
47
+ end
48
+
49
+ def icon_margin_bottom
50
+ orientation === "vertical" && "xs"
51
+ end
44
52
  end
45
53
  end
46
54
  end
@@ -18,7 +18,7 @@ describe("IconStatValue Kit", () => {
18
18
  )
19
19
 
20
20
  const kit = screen.getByTestId(testId)
21
- expect(kit).toHaveClass("pb_icon_stat_value_kit_horizontal_sm_lighter")
21
+ expect(kit).toHaveClass("pb_icon_stat_value_kit_horizontal")
22
22
  })
23
23
 
24
24
  test("renders icon", () => {
@@ -99,9 +99,10 @@ describe("IconStatValue Kit", () => {
99
99
  value={64.18}
100
100
  />
101
101
  )
102
-
102
+ const size = sizeProp === "sm" ? "3" : sizeProp === "md" ? "2" : "1"
103
103
  const kit = screen.getByTestId(testId)
104
- expect(kit).toHaveClass(`pb_icon_stat_value_kit_horizontal_${sizeProp}_lighter`)
104
+ const title = kit.querySelector(".pb_title_kit")
105
+ expect(title).toHaveClass(`pb_title_${size}`)
105
106
 
106
107
  cleanup()
107
108
  })
@@ -115,8 +116,7 @@ describe("IconStatValue Kit", () => {
115
116
  "teal",
116
117
  "red",
117
118
  "yellow",
118
- "green",
119
- "lighter"].forEach(
119
+ "green"].forEach(
120
120
  (colorProp) => {
121
121
  render(
122
122
  <IconStatValue
@@ -128,9 +128,10 @@ describe("IconStatValue Kit", () => {
128
128
  variant={colorProp}
129
129
  />
130
130
  )
131
-
131
+
132
132
  const kit = screen.getByTestId(testId)
133
- expect(kit).toHaveClass(`pb_icon_stat_value_kit_horizontal_sm_${colorProp}`)
133
+ const iconCircle = kit.querySelector(`.pb_icon_circle_kit_size_sm_${colorProp}`)
134
+ expect(iconCircle).toBeInTheDocument()
134
135
 
135
136
  cleanup()
136
137
  })
@@ -149,7 +150,7 @@ describe("IconStatValue Kit", () => {
149
150
  )
150
151
 
151
152
  const kit = screen.getByTestId(testId)
152
- expect(kit).toHaveClass("pb_icon_stat_value_kit_vertical_sm_lighter")
153
+ expect(kit).toHaveClass("pb_icon_stat_value_kit_vertical")
153
154
  })
154
155
 
155
156
  })