playbook_ui 14.10.0.pre.alpha.play16825206 → 14.10.0.pre.alpha.play16825301

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +11 -16
  3. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +8 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -3
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +1 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.html.erb +43 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.html.erb +58 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/index.js +185 -92
  12. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +55 -8
  14. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +17 -14
  15. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +78 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -3
  17. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +13 -2
  18. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +2 -6
  19. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +6 -4
  20. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +11 -9
  21. data/app/pb_kits/playbook/pb_badge/_badge.scss +4 -2
  22. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.scss +3 -1
  23. data/app/pb_kits/playbook/pb_button/_button.scss +3 -1
  24. data/app/pb_kits/playbook/pb_card/_card.scss +21 -3
  25. data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +18 -0
  26. data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +40 -0
  27. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +4 -2
  28. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +3 -1
  29. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss +5 -3
  30. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss +6 -4
  31. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +4 -2
  32. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +10 -8
  33. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +24 -15
  34. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx +3 -1
  35. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx +4 -1
  36. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx +1 -1
  37. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +6 -4
  38. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +3 -1
  39. data/app/pb_kits/playbook/pb_label_value/_label_value.scss +4 -2
  40. data/app/pb_kits/playbook/pb_message/_message_mixins.scss +3 -1
  41. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +3 -1
  42. data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +5 -3
  43. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +10 -8
  44. data/app/pb_kits/playbook/pb_pill/_pill.scss +4 -2
  45. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +4 -2
  46. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +4 -2
  47. data/app/pb_kits/playbook/pb_select/_select.scss +5 -3
  48. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +5 -3
  49. data/app/pb_kits/playbook/pb_table/_table.tsx +8 -1
  50. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  51. data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
  52. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +3 -1
  53. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +18 -0
  54. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +22 -1
  55. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +80 -0
  56. data/app/pb_kits/playbook/pb_textarea/_textarea.scss +3 -1
  57. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.scss +5 -4
  58. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +4 -2
  59. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -5
  60. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb +4 -5
  61. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx +4 -4
  62. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md +1 -1
  63. data/app/pb_kits/playbook/pb_timeline/timeline.rb +6 -6
  64. data/app/pb_kits/playbook/pb_toggle/_toggle.scss +5 -3
  65. data/dist/chunks/_typeahead-C2iCBqxQ.js +36 -0
  66. data/dist/chunks/_weekday_stacked-CWnbnW7m.js +45 -0
  67. data/dist/chunks/vendor.js +1 -1
  68. data/dist/playbook-doc.js +1 -1
  69. data/dist/playbook-rails-react-bindings.js +1 -1
  70. data/dist/playbook-rails.js +1 -1
  71. data/dist/playbook.css +1 -1
  72. data/lib/playbook/version.rb +1 -1
  73. metadata +6 -4
  74. data/dist/chunks/_typeahead-CbKUtXZa.js +0 -22
  75. data/dist/chunks/_weekday_stacked-CEpLoHbM.js +0 -45
@@ -226,3 +226,83 @@ test('returns masked ssn value', () => {
226
226
 
227
227
  expect(input.value).toBe('123-45-6789')
228
228
  })
229
+
230
+ const TextInputCreditCardMask = (props) => {
231
+ const [creditCard, setValue] = useState('')
232
+ const handleOnChange = ({ target }) => {
233
+ setValue(target.value)
234
+ }
235
+
236
+ return (
237
+ <TextInput
238
+ mask="creditCard"
239
+ onChange={handleOnChange}
240
+ value={creditCard}
241
+ {...props}
242
+ />
243
+ )
244
+ }
245
+
246
+ test('returns masked credit card value', () => {
247
+ render(
248
+ <TextInputCreditCardMask
249
+ data={{ testid: testId }}
250
+ />
251
+ )
252
+
253
+ const kit = screen.getByTestId(testId)
254
+
255
+ const input = within(kit).getByRole('textbox')
256
+
257
+ fireEvent.change(input, { target: { value: '1234567890123456' } })
258
+
259
+ expect(input.value).toBe('1234 5678 9012 3456')
260
+
261
+ fireEvent.change(input, { target: { value: '1234' } })
262
+
263
+ expect(input.value).toBe('1234')
264
+
265
+ fireEvent.change(input, { target: { value: '' } })
266
+
267
+ expect(input.value).toBe('')
268
+ })
269
+
270
+ const TextInputCVVMask = (props) => {
271
+ const [cvv, setValue] = useState('')
272
+ const handleOnChange = ({ target }) => {
273
+ setValue(target.value)
274
+ }
275
+
276
+ return (
277
+ <TextInput
278
+ mask="cvv"
279
+ onChange={handleOnChange}
280
+ value={cvv}
281
+ {...props}
282
+ />
283
+ )
284
+ }
285
+
286
+ test('returns masked CVV value', () => {
287
+ render(
288
+ <TextInputCVVMask
289
+ data={{ testid: testId }}
290
+ />
291
+ )
292
+
293
+ const kit = screen.getByTestId(testId)
294
+
295
+ const input = within(kit).getByRole('textbox')
296
+
297
+ fireEvent.change(input, { target: { value: '1234' } })
298
+
299
+ expect(input.value).toBe('1234')
300
+
301
+ fireEvent.change(input, { target: { value: '123' } })
302
+
303
+ expect(input.value).toBe('123')
304
+
305
+ fireEvent.change(input, { target: { value: '' } })
306
+
307
+ expect(input.value).toBe('')
308
+ })
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  @import "../pb_body/body_mixins";
2
4
  @import "./textarea_mixin";
3
5
  @import "../tokens/spacing";
@@ -60,7 +62,7 @@
60
62
 
61
63
  &.error {
62
64
  [class*=pb_body_kit] {
63
- margin-top: $space_xs / 2;
65
+ margin-top: math.div($space_xs, 2);
64
66
  }
65
67
  textarea {
66
68
  border-color: $error;
@@ -1,3 +1,4 @@
1
+ @use "sass:math";
1
2
 
2
3
  [class^=pb_time_range_inline_kit] {
3
4
  &[class*=_center] {
@@ -22,14 +23,14 @@
22
23
  display: flex;
23
24
  align-items: center;
24
25
  [class*=pb_time_range_inline_arrow] {
25
- margin-left: $space_xs/2;
26
- margin-right: $space_xs/2;
26
+ margin-left: math.div($space_xs, 2);
27
+ margin-right:math.div($space_xs, 2);
27
28
  }
28
29
  [class*=pb_time_range_inline_timezone] {
29
- margin-left: $space_xs/2;
30
+ margin-left: math.div($space_xs, 2);
30
31
  }
31
32
  [class*=pb_time_range_inline_icon] {
32
- margin-right: $space_xs/2;
33
+ margin-right: math.div($space_xs, 2);
33
34
  }
34
35
  }
35
36
  }
@@ -1,12 +1,14 @@
1
+ @use "sass:math";
2
+
1
3
  @import "../tokens/colors";
2
4
  @import "../tokens/spacing";
3
5
  @import "../tokens/opacity";
4
6
  @import "../tokens/typography";
5
7
 
6
8
  $connector_width: 2px;
7
- $icon_margin: $space_xs/2;
9
+ $icon_margin: math.div($space_xs, 2);
8
10
  $icon_height: 28px;
9
- $height_from_top: $icon_height/2 - $connector_width/2;
11
+ $height_from_top: (math.div($icon_height, 2)) - (math.div($connector_width, 2));
10
12
 
11
13
  // Add gap variables
12
14
  $gap_xs: $height_from_top + $space_xs;
@@ -20,7 +20,7 @@ type TimelineProps = {
20
20
  id?: string,
21
21
  orientation?: string,
22
22
  showDate?: boolean,
23
- gap?: 'xs' | 'sm' | 'md' | 'lg' | 'none',
23
+ itemGap?: 'xs' | 'sm' | 'md' | 'lg' | 'none',
24
24
  } & GlobalProps
25
25
 
26
26
  const Timeline = ({
@@ -32,15 +32,15 @@ const Timeline = ({
32
32
  id,
33
33
  orientation = 'horizontal',
34
34
  showDate = false,
35
- gap = 'none',
35
+ itemGap = 'none',
36
36
  ...props
37
37
  }: TimelineProps): React.ReactElement => {
38
38
  const ariaProps = buildAriaProps(aria)
39
39
  const dataProps = buildDataProps(data)
40
40
  const htmlProps = buildHtmlProps(htmlOptions)
41
41
  const dateStyle = showDate === true ? '_with_date' : ''
42
- const gapStyle = gap === 'none' ? '' : `gap_${gap}`
43
- const timelineCss = buildCss('pb_timeline_kit', `${orientation}`, dateStyle, gapStyle)
42
+ const itemGapStyle = itemGap === 'none' ? '' : `gap_${itemGap}`
43
+ const timelineCss = buildCss('pb_timeline_kit', `${orientation}`, dateStyle, itemGapStyle)
44
44
 
45
45
  return (
46
46
  <div
@@ -60,4 +60,4 @@ Timeline.Step = TimelineStep
60
60
  Timeline.Label = TimelineLabel
61
61
  Timeline.Detail = TimelineDetail
62
62
 
63
- export default Timeline
63
+ export default Timeline
@@ -1,6 +1,6 @@
1
1
  <%= pb_rails("flex", props: { justify: "evenly" }) do %>
2
2
  <%= pb_rails("flex/flex_item") do %>
3
- <%= pb_rails("timeline", props: {orientation: "vertical", gap: "xs"}) do %>
3
+ <%= pb_rails("timeline", props: {orientation: "vertical", item_gap: "xs"}) do %>
4
4
  <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
5
5
  <%= pb_rails("body", props: {
6
6
  text: "Conversation started",
@@ -23,7 +23,7 @@
23
23
  <% end %>
24
24
 
25
25
  <%= pb_rails("flex/flex_item") do %>
26
- <%= pb_rails("timeline", props: {orientation: "vertical", gap: "sm"}) do %>
26
+ <%= pb_rails("timeline", props: {orientation: "vertical", item_gap: "sm"}) do %>
27
27
  <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
28
28
  <%= pb_rails("body", props: {
29
29
  text: "Conversation started",
@@ -46,7 +46,7 @@
46
46
  <% end %>
47
47
 
48
48
  <%= pb_rails("flex/flex_item") do %>
49
- <%= pb_rails("timeline", props: {orientation: "vertical", gap: "md"}) do %>
49
+ <%= pb_rails("timeline", props: {orientation: "vertical", item_gap: "md"}) do %>
50
50
  <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
51
51
  <%= pb_rails("body", props: {
52
52
  text: "Conversation started",
@@ -69,7 +69,7 @@
69
69
  <% end %>
70
70
 
71
71
  <%= pb_rails("flex/flex_item") do %>
72
- <%= pb_rails("timeline", props: {orientation: "vertical", gap: "lg"}) do %>
72
+ <%= pb_rails("timeline", props: {orientation: "vertical", item_gap: "lg"}) do %>
73
73
  <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
74
74
  <%= pb_rails("body", props: {
75
75
  text: "Conversation started",
@@ -91,4 +91,3 @@
91
91
  <% end %>
92
92
  <% end %>
93
93
  <% end %>
94
-
@@ -10,7 +10,7 @@ const TimelineWithGap = (props) => (
10
10
  <Flex justify="evenly">
11
11
  <FlexItem>
12
12
  <Timeline
13
- gap="xs"
13
+ itemGap="xs"
14
14
  orientation="vertical"
15
15
  >
16
16
  <Timeline.Item
@@ -51,7 +51,7 @@ const TimelineWithGap = (props) => (
51
51
  </FlexItem>
52
52
  <FlexItem>
53
53
  <Timeline
54
- gap="sm"
54
+ itemGap="sm"
55
55
  orientation="vertical"
56
56
  >
57
57
  <Timeline.Item
@@ -92,7 +92,7 @@ const TimelineWithGap = (props) => (
92
92
  </FlexItem>
93
93
  <FlexItem>
94
94
  <Timeline
95
- gap="md"
95
+ itemGap="md"
96
96
  orientation="vertical"
97
97
  >
98
98
  <Timeline.Item
@@ -134,7 +134,7 @@ const TimelineWithGap = (props) => (
134
134
  </FlexItem>
135
135
  <FlexItem>
136
136
  <Timeline
137
- gap="lg"
137
+ itemGap="lg"
138
138
  orientation="vertical"
139
139
  >
140
140
  <Timeline.Item
@@ -1 +1 @@
1
- Use the optional `gap` prop to render the timeline kit with adjusted spacing between nodes. The `gap` prop will only work when utilized with a vertical timeline. Horizontal timelines will show no difference in spacing.
1
+ Use the optional `itemGap` prop to render the timeline kit with adjusted spacing between nodes. The `itemGap` prop will only work when utilized with a vertical timeline. Horizontal timelines will show no difference in spacing.
@@ -8,15 +8,15 @@ module Playbook
8
8
  default: "horizontal"
9
9
  prop :show_date, type: Playbook::Props::Boolean,
10
10
  default: false
11
- prop :gap, type: Playbook::Props::Enum,
12
- values: %w[xs sm md lg none],
13
- default: "none"
11
+ prop :item_gap, type: Playbook::Props::Enum,
12
+ values: %w[xs sm md lg none],
13
+ default: "none"
14
14
 
15
15
  def classname
16
16
  generate_classname("pb_timeline_kit",
17
17
  orientation,
18
18
  date_class,
19
- gap_class)
19
+ item_gap_class)
20
20
  end
21
21
 
22
22
  private
@@ -25,8 +25,8 @@ module Playbook
25
25
  show_date ? "with_date" : nil
26
26
  end
27
27
 
28
- def gap_class
29
- gap == "none" ? nil : "gap_#{gap}"
28
+ def item_gap_class
29
+ item_gap == "none" ? nil : "gap_#{item_gap}"
30
30
  end
31
31
  end
32
32
  end
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  @import "../tokens/colors";
2
4
 
3
5
  $color_checkbox_success: $data_1;
@@ -8,7 +10,7 @@ $transition: .2s ease-in-out;
8
10
  [class^=pb_toggle_kit] {
9
11
  position: relative;
10
12
  $width: 44px;
11
- $height: $width / 2;
13
+ $height: math.div($width, 2);
12
14
  $border_success: 3px solid $color_checkbox_success;
13
15
  $border_default: 3px solid $color_checkbox_default;
14
16
 
@@ -27,7 +29,7 @@ $transition: .2s ease-in-out;
27
29
  &:after {
28
30
  transition: $transition;
29
31
  content: "";
30
- width: $width / 2 - 4px;
32
+ width: math.div($width, 2) - 4px;
31
33
  height: $height - 4px;
32
34
  background-color: $color_checkbox_default;
33
35
  border-radius: 50%;
@@ -68,7 +70,7 @@ $transition: .2s ease-in-out;
68
70
  background-color: $color_checkbox_success;
69
71
 
70
72
  &:after {
71
- left: $width / 2 + 2px;
73
+ left: math.div($width, 2) + 2px;
72
74
  background-color: $white;
73
75
  }
74
76
  }