playbook_ui 15.1.0.pre.alpha.testingtiptap11043 → 15.1.0.pre.alpha.timelinescss11189

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +9 -0
  3. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +105 -29
  4. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +11 -0
  5. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +2 -2
  6. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.scss +15 -21
  7. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +6 -5
  8. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +2 -0
  9. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +11 -3
  10. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +9 -8
  11. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +36 -9
  12. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +1 -39
  13. data/app/pb_kits/playbook/pb_rich_text_editor/_previewer_mixin.scss +13 -3
  14. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +0 -1
  15. data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +10 -0
  16. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +0 -1
  17. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +0 -1
  18. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +3 -0
  19. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +250 -233
  20. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
  21. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +2 -2
  22. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +10 -10
  23. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +39 -1
  24. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +2 -0
  25. data/app/pb_kits/playbook/utilities/_hover.scss +2 -2
  26. data/app/pb_kits/playbook/utilities/globalProps.ts +2 -2
  27. data/dist/chunks/{_line_graph-Ck_xk6x5.js → _line_graph-BxcVBQsJ.js} +1 -1
  28. data/dist/chunks/_typeahead-eZENQ_Y_.js +6 -0
  29. data/dist/chunks/{_weekday_stacked-CcaJugnT.js → _weekday_stacked-DEdRaOVm.js} +3 -3
  30. data/dist/chunks/vendor.js +1 -1
  31. data/dist/playbook-doc.js +2 -2
  32. data/dist/playbook-rails-react-bindings.js +1 -1
  33. data/dist/playbook-rails.js +1 -1
  34. data/dist/playbook.css +1 -1
  35. data/lib/playbook/hover.rb +5 -1
  36. data/lib/playbook/version.rb +1 -1
  37. metadata +5 -6
  38. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_simple.jsx +0 -37
  39. data/dist/chunks/_typeahead-xcdYzO-v.js +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f802cf7b82f39892f78a8f9d81868f16818697e20e3284ce1acb3e19622eac1
4
- data.tar.gz: 95b5a6b1487a2d77218762c92be71313e0eb8da41e375679bca8097e50f6013e
3
+ metadata.gz: 18b16d003e09f227fdaa17123c1b08e423071f708f49ca524fb7e2e216c714fc
4
+ data.tar.gz: ac831c8bb1bdd89eae2244be43c19974c19d1f8cc8019b7d01ec3cc18152427a
5
5
  SHA512:
6
- metadata.gz: '099f0866c706c372624fb2c28cd02af78610a1b25327bf69ff069bdbdd5223b942141ae1626c9376f59283e6bc46c5234ba7f4b1489f054aa9473ded54d3635b'
7
- data.tar.gz: db2cddd5a53b1e7edf83afe003149a62a0e2169458dbf17a8353f7474ee50a8fb2a3b79087ef20770d4d03f04f4d58aa5fe457032c3e13c70ec523b1e8cf07f1
6
+ metadata.gz: 120b76c6266f100da5befbcc326f54af6f4db972aad12fb97042abecc17f54d593b87764216a11e23dad84ec853d5976ff713a2c86891395b5a70a980b49cbee
7
+ data.tar.gz: 3b6a97952ca69f967cf9d445391c6a67de36ae76ec5534590fcaf2643946b6cd530080a5902d2072be73026acd6022407a73a9181353893b6f6bed0b43e416bc
@@ -146,6 +146,8 @@ export function useTableState({
146
146
 
147
147
  // Pagination configuration
148
148
  const paginationInitializer = useMemo(() => {
149
+ if (!pagination) return {};
150
+
149
151
  return {
150
152
  getPaginationRowModel: getPaginationRowModel(),
151
153
  paginateExpandedRows: false,
@@ -201,6 +203,13 @@ export function useTableState({
201
203
  onRowPinningChange({ top: allPinned });
202
204
  }, [table, pinnedRows?.value?.top?.join(',')]);
203
205
 
206
+ // Set pagination state when pagination is enabled
207
+ useEffect(() => {
208
+ if (pagination && paginationProps?.pageSize) {
209
+ table.setPageSize(paginationProps.pageSize);
210
+ }
211
+ }, [pagination, paginationProps?.pageSize, table]);
212
+
204
213
  // Check if table has any sub-rows
205
214
  const hasAnySubRows = table.getRowModel().rows.some(row => row.subRows && row.subRows.length > 0);
206
215
  const selectedRowsLength = Object.keys(table.getState().rowSelection).length;
@@ -10,9 +10,15 @@
10
10
  @import "./scss_partials/dropdown_animation";
11
11
  @import "dropdown_mixin";
12
12
 
13
- [class*="pb_dropdown"] {
13
+ .pb_dropdown_default,
14
+ .pb_dropdown_subtle,
15
+ .pb_dropdown_default_separators_hidden,
16
+ .pb_dropdown_subtle_separators_hidden {
14
17
  .dropdown_wrapper {
15
- [class*="dropdown_trigger_wrapper"] {
18
+ .dropdown_trigger_wrapper,
19
+ .dropdown_trigger_wrapper_focus,
20
+ .dropdown_trigger_wrapper_focus_select_only,
21
+ .dropdown_trigger_wrapper_select_only {
16
22
  @include pb_body;
17
23
  border: 1px solid $border_light;
18
24
  background-color: $white;
@@ -48,11 +54,11 @@
48
54
  transition: box-shadow 0.15s ease-in-out;
49
55
  }
50
56
 
51
- &[class*="_select_only"] {
57
+ &.dropdown_trigger_wrapper_select_only {
52
58
  box-shadow: inset 0 -11px 20px rgba($primary, 0.05);
53
59
  }
54
60
 
55
- &[class*="_focus"] {
61
+ &.dropdown_trigger_wrapper_focus {
56
62
  box-shadow: 0px 0px 0 1px $primary !important;
57
63
  transition: box-shadow 0.1s ease-in-out;
58
64
  }
@@ -69,7 +75,12 @@
69
75
  z-index: $z_1;
70
76
  width: 100%;
71
77
 
72
- [class*="pb_dropdown_option"] {
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 {
73
84
  padding-left: $space_sm;
74
85
  padding-right: $space_sm;
75
86
  padding-top: $space_xs;
@@ -79,11 +90,14 @@
79
90
  background-color: $bg_light;
80
91
  }
81
92
 
82
- &[class*="_focused"] {
93
+ &.pb_dropdown_option_focused,
94
+ &.pb_dropdown_option_list_focused,
95
+ &.pb_dropdown_option_selected_focused {
83
96
  background-color: $bg_light;
84
97
  }
85
98
 
86
- &[class*="_list"] {
99
+ &.pb_dropdown_option_list,
100
+ &.pb_dropdown_option_list_focused {
87
101
  border-bottom: 1px solid $border_light;
88
102
 
89
103
  &:hover, &:focus {
@@ -92,7 +106,8 @@
92
106
  }
93
107
  }
94
108
  }
95
- &[class*="selected"] {
109
+ &.pb_dropdown_option_selected,
110
+ &.pb_dropdown_option_selected_focused {
96
111
  background-color: $primary;
97
112
  color: $white;
98
113
  [class^="pb_body"],
@@ -141,41 +156,66 @@
141
156
  }
142
157
 
143
158
  &.error {
144
- [class*=pb_body_kit] {
159
+ .pb_body_kit_negative {
145
160
  margin-top: $space_xs / 2;
146
161
  }
147
162
 
148
- [class*="dropdown_trigger_wrapper"] {
163
+ .dropdown_trigger_wrapper,
164
+ .dropdown_trigger_wrapper_focus,
165
+ .dropdown_trigger_wrapper_focus_select_only,
166
+ .dropdown_trigger_wrapper_select_only {
149
167
  border-color: $error;
150
168
  box-shadow: none !important;
151
169
  }
152
170
  }
153
171
  }
154
172
 
155
- &[class*="separators_hidden"] {
173
+ &.pb_dropdown_default_separators_hidden,
174
+ &.pb_dropdown_subtle_separators_hidden {
156
175
  .dropdown_wrapper {
157
176
  .pb_dropdown_container {
158
177
 
159
- [class*="pb_dropdown_option"] {
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 {
160
184
  border: none;
161
185
  }
162
186
  }
163
187
  }
164
188
  }
165
189
 
166
- &[class*="subtle"] {
190
+ &.pb_dropdown_subtle,
191
+ &.pb_dropdown_subtle_separators_hidden {
167
192
  .dropdown_wrapper {
168
193
  .pb_dropdown_container {
169
194
 
170
- [class*="pb_dropdown_option"]:first-child {
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 {
171
201
  margin-top: $space_xs;
172
202
  }
173
203
 
174
- [class*="pb_dropdown_option"]:last-child {
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 {
175
210
  margin-bottom: $space_xs;
176
211
  }
177
212
 
178
- [class*="pb_dropdown_option"] {
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 {
179
219
  margin: $space_xs;
180
220
  padding: $space_xs;
181
221
  border-radius: $border_radius_md;
@@ -193,24 +233,44 @@
193
233
  }
194
234
  }
195
235
 
196
- [class*="pb_dropdown_option"]:last-child::after {
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 {
197
242
  display: none;
198
243
  }
199
244
  }
200
245
  }
201
246
 
202
- &[class*="separators_hidden"] {
247
+ &.pb_dropdown_subtle_separators_hidden {
203
248
  .dropdown_wrapper {
204
249
  .pb_dropdown_container {
205
- [class*="pb_dropdown_option"]:first-child {
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 {
206
256
  margin-top: $space_xs;
207
257
  }
208
258
 
209
- [class*="pb_dropdown_option"]:last-child {
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 {
210
265
  margin-bottom: $space_xs;
211
266
  }
212
267
 
213
- [class*="pb_dropdown_option"] {
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 {
214
274
  padding: $space_xxs $space_xs;
215
275
  margin: $space_xxs $space_xs;
216
276
 
@@ -218,7 +278,8 @@
218
278
  height: 0px;
219
279
  }
220
280
 
221
- &[class*="selected"] {
281
+ &.pb_dropdown_option_selected,
282
+ &.pb_dropdown_option_selected_focused {
222
283
  border-bottom: none;
223
284
  }
224
285
  }
@@ -229,7 +290,10 @@
229
290
 
230
291
  &.dark {
231
292
  .dropdown_wrapper {
232
- [class*="dropdown_trigger_wrapper"] {
293
+ .dropdown_trigger_wrapper,
294
+ .dropdown_trigger_wrapper_focus,
295
+ .dropdown_trigger_wrapper_focus_select_only,
296
+ .dropdown_trigger_wrapper_select_only {
233
297
  @include pb_body_light_dark;
234
298
  background-color: rgba($white, 0.1) !important;
235
299
  background: none;
@@ -244,7 +308,7 @@
244
308
  [class^="pb_body"] {
245
309
  color: $white;
246
310
  }
247
- &[class*="_select_only"] {
311
+ &.dropdown_trigger_wrapper_select_only {
248
312
  box-shadow: inset 0 -11px 20px rgba($white, 0.05);
249
313
  }
250
314
  .dropdown_input {
@@ -254,7 +318,10 @@
254
318
  }
255
319
 
256
320
  &.error {
257
- [class*="dropdown_trigger_wrapper"] {
321
+ .dropdown_trigger_wrapper,
322
+ .dropdown_trigger_wrapper_focus,
323
+ .dropdown_trigger_wrapper_focus_select_only,
324
+ .dropdown_trigger_wrapper_select_only {
258
325
  border-color: $error_dark;
259
326
  }
260
327
  }
@@ -268,19 +335,28 @@
268
335
  color: $white !important;
269
336
  }
270
337
 
271
- [class*="pb_dropdown_option"] {
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 {
272
344
  &:hover {
273
345
  background-color: $hover_dark;
274
346
  }
275
347
 
276
- &[class*="_focused"] {
348
+ &.pb_dropdown_option_focused,
349
+ &.pb_dropdown_option_list_focused,
350
+ &.pb_dropdown_option_selected_focused {
277
351
  background-color: $hover_dark;
278
352
  }
279
353
 
280
- &[class*="_list"] {
354
+ &.pb_dropdown_option_list,
355
+ &.pb_dropdown_option_list_focused {
281
356
  border-color: rgba($white, 0.15);
282
357
  }
283
- &[class*="selected"] {
358
+ &.pb_dropdown_option_selected,
359
+ &.pb_dropdown_option_selected_focused {
284
360
  background-color: $primary;
285
361
  border-bottom: rgba($white, 0.15);
286
362
  }
@@ -21,6 +21,15 @@
21
21
  ]
22
22
  %>
23
23
 
24
+ <%
25
+ example_typeahead_options = [
26
+ { label: 'Orange', value: '#FFA500' },
27
+ { label: 'Red', value: '#FF0000' },
28
+ { label: 'Green', value: '#00FF00' },
29
+ { label: 'Blue', value: '#0000FF' },
30
+ ]
31
+ %>
32
+
24
33
  <% treeData = [{
25
34
  label: "Power Home Remodeling",
26
35
  value: "Power Home Remodeling",
@@ -89,6 +98,8 @@
89
98
 
90
99
  <%= pb_form_with(scope: :example, method: :get, url: "", validate: true) do |form| %>
91
100
  <%= form.typeahead :example_typeahead_validation, props: { data: { typeahead_example2: true, user: {} }, label: true, placeholder: "Search for a user", required: true, validation: { message: "Please select a user." } } %>
101
+ <%= form.typeahead :example_typeahead_validation_react, props: { options: example_typeahead_options, pills: true, label: "Example Typeahead (React Rendered)", placeholder: "Search for a user", required: true, validation: { message: "Please select a color." } } %>
102
+ <%= form.typeahead :example_typeahead_validation_react_2, props: { options: example_typeahead_options, pills: true, label: "Example Typeahead 2 (React Rendered)", placeholder: "Search for a user", required: true } %>
92
103
  <%= form.text_field :example_text_field_validation, props: { label: true, required: true } %>
93
104
  <%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field", hidden_inputs: true } %>
94
105
  <%= form.email_field :example_email_field_validation, props: { label: true, required: true } %>
@@ -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
  })
@@ -89,7 +89,18 @@ $positions: (
89
89
  }
90
90
  }
91
91
 
92
- [class^=pb_multiple_users_stacked_kit] {
92
+ .pb_multiple_users_stacked_kit,
93
+ .pb_multiple_users_stacked_kit_single,
94
+ .pb_multiple_users_stacked_kit_bubble,
95
+ .pb_multiple_users_stacked_kit_single_bubble,
96
+ .pb_multiple_users_stacked_kit_bubble_size_sm,
97
+ .pb_multiple_users_stacked_kit_bubble_size_md,
98
+ .pb_multiple_users_stacked_kit_bubble_size_lg,
99
+ .pb_multiple_users_stacked_kit_bubble_size_xl,
100
+ .pb_multiple_users_stacked_kit_single_bubble_size_sm,
101
+ .pb_multiple_users_stacked_kit_single_bubble_size_md,
102
+ .pb_multiple_users_stacked_kit_single_bubble_size_lg,
103
+ .pb_multiple_users_stacked_kit_single_bubble_size_xl {
93
104
  $container_size: map-get($avatar-sizes, "xs");
94
105
  $bubble_container_size: map-get($avatar-sizes, "sm");
95
106
  $overlap: -15px;
@@ -103,7 +114,8 @@ $positions: (
103
114
  position: relative;
104
115
  flex-shrink: 0;
105
116
  flex-grow: 0;
106
- [class^=pb_avatar_kit].pb_multiple_users_stacked_item {
117
+ .pb_avatar_kit_size_xs.pb_multiple_users_stacked_item,
118
+ .pb_avatar_kit_size_md.pb_multiple_users_stacked_item {
107
119
  @include avatar-size($stacked_size);
108
120
  &.dark {
109
121
  .avatar_wrapper {
@@ -117,10 +129,17 @@ $positions: (
117
129
  }
118
130
  }
119
131
  }
120
- &[class*=_single] .pb_multiple_users_stacked_item {
132
+ &.pb_multiple_users_stacked_kit_single .pb_multiple_users_stacked_item,
133
+ &.pb_multiple_users_stacked_kit_single_bubble .pb_multiple_users_stacked_item,
134
+ &.pb_multiple_users_stacked_kit_single_bubble_size_sm .pb_multiple_users_stacked_item,
135
+ &.pb_multiple_users_stacked_kit_single_bubble_size_md .pb_multiple_users_stacked_item,
136
+ &.pb_multiple_users_stacked_kit_single_bubble_size_lg .pb_multiple_users_stacked_item,
137
+ &.pb_multiple_users_stacked_kit_single_bubble_size_xl .pb_multiple_users_stacked_item {
121
138
  @include avatar-size(28px);
122
139
  }
123
- [class^=pb_avatar_kit].second_item, [class^=pb_badge_kit].second_item {
140
+ .pb_avatar_kit_size_xs.second_item,
141
+ .pb_avatar_kit_size_md.second_item,
142
+ .pb_badge_kit_primary_rounded.second_item {
124
143
  @include position((bottom: 0, right: 0));
125
144
  z-index: 2;
126
145
  background: tint($primary, 90%);
@@ -143,7 +162,8 @@ $positions: (
143
162
 
144
163
  // Iterate over each size to adjust the bubble container only when class contains "_bubble_"
145
164
  @each $size_name, $size_value in $avatar-sizes {
146
- &[class*=_bubble_][class*=_size_#{$size_name}] {
165
+ &.pb_multiple_users_stacked_kit_bubble_size_#{$size_name},
166
+ &.pb_multiple_users_stacked_kit_single_bubble_size_#{$size_name} {
147
167
  // Set bubble container size based on the class
148
168
  $bubble_container_size: $size_value;
149
169
  $container_size: $size_value;
@@ -161,7 +181,8 @@ $positions: (
161
181
  background-color: $card_dark;
162
182
  }
163
183
 
164
- [class^=pb_avatar_kit].pb_multiple_users_stacked_item {
184
+ .pb_avatar_kit_size_xs.pb_multiple_users_stacked_item,
185
+ .pb_avatar_kit_size_md.pb_multiple_users_stacked_item {
165
186
  @include avatar-size($bubble_container_size * 0.45); // Adjust the size of stacked avatars
166
187
 
167
188
  &.dark {
@@ -175,7 +196,8 @@ $positions: (
175
196
  }
176
197
  }
177
198
 
178
- [class^=pb_avatar_kit] {
199
+ .pb_avatar_kit_size_xs,
200
+ .pb_avatar_kit_size_md {
179
201
  // First Item
180
202
  &.first_item {
181
203
  @include position(map-get(map-get($positions, 'first-item-double'), $size_name));
@@ -235,8 +257,13 @@ $positions: (
235
257
  }
236
258
  }
237
259
 
238
- &[class*=_single_bubble] {
239
- [class^=pb_avatar_kit].first_item {
260
+ &.pb_multiple_users_stacked_kit_single_bubble,
261
+ &.pb_multiple_users_stacked_kit_single_bubble_size_sm,
262
+ &.pb_multiple_users_stacked_kit_single_bubble_size_md,
263
+ &.pb_multiple_users_stacked_kit_single_bubble_size_lg,
264
+ &.pb_multiple_users_stacked_kit_single_bubble_size_xl {
265
+ .pb_avatar_kit_size_xs.first_item,
266
+ .pb_avatar_kit_size_md.first_item {
240
267
  @include position((top: 0, left: 0));
241
268
  @include avatar-size($bubble_container_size);
242
269
  }