playbook_ui 14.6.2 → 14.7.0.pre.alpha.dependabotnpmandyarnintltelinput24704448

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +3 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +8 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +21 -28
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +37 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +13 -2
  7. data/app/pb_kits/playbook/pb_card/_card.tsx +11 -4
  8. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -2
  9. data/app/pb_kits/playbook/pb_currency/_currency.tsx +16 -6
  10. data/app/pb_kits/playbook/pb_currency/currency.rb +38 -11
  11. data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
  12. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.html.erb +7 -0
  13. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.jsx +18 -0
  14. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.md +3 -0
  15. data/app/pb_kits/playbook/pb_currency/docs/example.yml +3 -1
  16. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  17. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
  18. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +8 -7
  19. data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
  20. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
  21. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
  22. data/app/pb_kits/playbook/pb_flex/flex_item.rb +7 -2
  23. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +6 -2
  24. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +30 -26
  25. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +24 -1
  26. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +25 -2
  27. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +3 -0
  28. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +1 -0
  29. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +46 -8
  30. data/app/pb_kits/playbook/pb_link/_link.scss +66 -0
  31. data/app/pb_kits/playbook/pb_link/_link.tsx +107 -0
  32. data/app/pb_kits/playbook/pb_link/docs/_link_color.html.erb +30 -0
  33. data/app/pb_kits/playbook/pb_link/docs/_link_color.jsx +40 -0
  34. data/app/pb_kits/playbook/pb_link/docs/_link_disabled.html.erb +5 -0
  35. data/app/pb_kits/playbook/pb_link/docs/_link_disabled.jsx +15 -0
  36. data/app/pb_kits/playbook/pb_link/docs/_link_icon.html.erb +15 -0
  37. data/app/pb_kits/playbook/pb_link/docs/_link_icon.jsx +25 -0
  38. data/app/pb_kits/playbook/pb_link/docs/_link_tag.html.erb +35 -0
  39. data/app/pb_kits/playbook/pb_link/docs/_link_tag.jsx +45 -0
  40. data/app/pb_kits/playbook/pb_link/docs/_link_underline.html.erb +5 -0
  41. data/app/pb_kits/playbook/pb_link/docs/_link_underline.jsx +15 -0
  42. data/app/pb_kits/playbook/pb_link/docs/example.yml +16 -0
  43. data/app/pb_kits/playbook/pb_link/docs/index.js +5 -0
  44. data/app/pb_kits/playbook/pb_link/link.html.erb +21 -0
  45. data/app/pb_kits/playbook/pb_link/link.rb +44 -0
  46. data/app/pb_kits/playbook/pb_link/link.test.jsx +92 -0
  47. data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
  48. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +67 -1
  49. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +1 -0
  50. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
  51. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +5 -1
  52. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +37 -0
  53. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.tsx +67 -0
  54. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading_mixins.scss +40 -0
  55. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.jsx +51 -0
  56. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.md +1 -0
  57. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.jsx +26 -0
  58. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.md +1 -0
  59. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -0
  60. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.jsx +11 -0
  61. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +59 -0
  62. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.md +3 -0
  63. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.jsx +20 -0
  64. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.md +3 -0
  65. data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +13 -0
  66. data/app/pb_kits/playbook/pb_skeleton_loading/docs/index.js +5 -0
  67. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +12 -0
  68. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +8 -0
  69. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.test.jsx +81 -0
  70. data/app/pb_kits/playbook/pb_timeline/_item.tsx +59 -23
  71. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +8 -0
  72. data/app/pb_kits/playbook/pb_timeline/detail.html.erb +3 -0
  73. data/app/pb_kits/playbook/pb_timeline/detail.rb +11 -0
  74. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +43 -0
  75. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +68 -0
  76. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md +2 -0
  77. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +2 -1
  78. data/app/pb_kits/playbook/pb_timeline/docs/index.js +1 -0
  79. data/app/pb_kits/playbook/pb_timeline/item.html.erb +17 -21
  80. data/app/pb_kits/playbook/pb_timeline/item.rb +4 -0
  81. data/app/pb_kits/playbook/pb_timeline/label.html.erb +12 -0
  82. data/app/pb_kits/playbook/pb_timeline/label.rb +13 -0
  83. data/app/pb_kits/playbook/pb_timeline/step.html.erb +14 -0
  84. data/app/pb_kits/playbook/pb_timeline/step.rb +16 -0
  85. data/app/pb_kits/playbook/pb_timeline/subcomponents/Detail.tsx +29 -0
  86. data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +38 -0
  87. data/app/pb_kits/playbook/pb_timeline/subcomponents/Step.tsx +42 -0
  88. data/app/pb_kits/playbook/pb_timeline/subcomponents/index.tsx +3 -0
  89. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +84 -0
  90. data/app/pb_kits/playbook/tokens/_typography.scss +35 -0
  91. data/app/pb_kits/playbook/utilities/_hover.scss +46 -43
  92. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +4 -0
  93. data/app/pb_kits/playbook/utilities/globalProps.ts +44 -2
  94. data/dist/chunks/_typeahead-CFuWkfWK.js +22 -0
  95. data/dist/chunks/_weekday_stacked-OvN7ix-I.js +45 -0
  96. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  97. data/dist/chunks/vendor.js +1 -1
  98. data/dist/menu.yml +7 -1
  99. data/dist/playbook-doc.js +1 -1
  100. data/dist/playbook-rails-react-bindings.js +1 -1
  101. data/dist/playbook-rails.js +1 -1
  102. data/dist/playbook.css +1 -1
  103. data/lib/playbook/hover.rb +4 -1
  104. data/lib/playbook/kit_base.rb +43 -5
  105. data/lib/playbook/version.rb +2 -2
  106. metadata +61 -9
  107. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
  108. data/dist/chunks/_typeahead-BV_n6U5W.js +0 -22
  109. data/dist/chunks/_weekday_stacked-Cy__g00H.js +0 -45
  110. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
@@ -0,0 +1,45 @@
1
+ import React from 'react'
2
+ import { Link } from 'playbook-ui'
3
+
4
+ const LinkTag = (props) => (
5
+ <div>
6
+ <Link
7
+ href="#tag"
8
+ icon="arrow-up-right-from-square"
9
+ tag="h1"
10
+ text="h1 link example"
11
+ {...props}
12
+ />
13
+ <Link
14
+ href="#tag2"
15
+ tag="h3"
16
+ text="h3 link example"
17
+ underline
18
+ {...props}
19
+ />
20
+ <Link
21
+ color="destructive"
22
+ href="#tag3"
23
+ tag="h6"
24
+ text="h6 link example"
25
+ {...props}
26
+ />
27
+ <Link
28
+ href="#tag4"
29
+ iconRight="chevron-right"
30
+ tag="p"
31
+ text="p link example"
32
+ {...props}
33
+ />
34
+ <div>
35
+ This is a <Link
36
+ href="#tag5"
37
+ tag="span"
38
+ text="span link example"
39
+ {...props}
40
+ />
41
+ </div>
42
+ </div>
43
+ )
44
+
45
+ export default LinkTag
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("link", props: {
2
+ text: "link example",
3
+ href: "#underline",
4
+ underline: true,
5
+ }) %>
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import { Link } from 'playbook-ui'
3
+
4
+ const LinkUnderline = (props) => (
5
+ <div>
6
+ <Link
7
+ href="#underline"
8
+ text="link example"
9
+ underline
10
+ {...props}
11
+ />
12
+ </div>
13
+ )
14
+
15
+ export default LinkUnderline
@@ -0,0 +1,16 @@
1
+ examples:
2
+
3
+ rails:
4
+ - link_color: Color
5
+ - link_underline: Underline
6
+ - link_icon: Icon
7
+ - link_disabled: Disabled
8
+ - link_tag: Tag
9
+
10
+
11
+ react:
12
+ - link_color: Color
13
+ - link_underline: Underline
14
+ - link_icon: Icon
15
+ - link_disabled: Disabled
16
+ - link_tag: Tag
@@ -0,0 +1,5 @@
1
+ export { default as LinkColor } from './_link_color.jsx'
2
+ export { default as LinkUnderline } from './_link_underline.jsx'
3
+ export { default as LinkIcon } from './_link_icon.jsx'
4
+ export { default as LinkDisabled } from './_link_disabled.jsx'
5
+ export { default as LinkTag } from './_link_tag.jsx'
@@ -0,0 +1,21 @@
1
+ <% link_content = proc do %>
2
+ <% if object.icon.present? %>
3
+ <%= pb_rails("icon", props: { icon: object.icon, fixed_width: true, size: "xs", margin_right: "xxs" }) %>
4
+ <% end %>
5
+ <%= object.content %>
6
+ <% if object.icon_right.present? %>
7
+ <%= pb_rails("icon", props: { icon: object.icon_right, fixed_width: true, size: "xs", margin_left: "xxs" }) %>
8
+ <% end %>
9
+ <% end %>
10
+
11
+ <% if object.tag == "a" %>
12
+ <%= pb_content_tag(object.tag, { href: object.href }) do %>
13
+ <%= link_content.call %>
14
+ <% end %>
15
+ <% else %>
16
+ <%= pb_content_tag(:a, { href: object.href }) do %>
17
+ <%= content_tag(object.tag) do %>
18
+ <%= link_content.call %>
19
+ <% end %>
20
+ <% end %>
21
+ <% end %>
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbLink
5
+ class Link < ::Playbook::KitBase
6
+ prop :color, type: Playbook::Props::Enum,
7
+ values: %w[default body muted destructive],
8
+ default: "default"
9
+ prop :disabled, type: Playbook::Props::Boolean,
10
+ default: false
11
+ prop :href
12
+ prop :icon
13
+ prop :icon_right
14
+ prop :tag, type: Playbook::Props::Enum,
15
+ values: %w[a h1 h2 h3 h4 h5 h6 p span div],
16
+ default: "a"
17
+ prop :text
18
+ prop :underline, type: Playbook::Props::Boolean,
19
+ default: false
20
+
21
+ def classname
22
+ generate_classname("pb_link_kit", color_class, underline_class, disabled_class)
23
+ end
24
+
25
+ def content
26
+ text
27
+ end
28
+
29
+ private
30
+
31
+ def color_class
32
+ color == "default" ? nil : color
33
+ end
34
+
35
+ def disabled_class
36
+ disabled ? "disabled" : nil
37
+ end
38
+
39
+ def underline_class
40
+ underline ? "underline" : nil
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,92 @@
1
+ import React from 'react'
2
+ import { ensureAccessible, renderKit, render, screen } from '../utilities/test-utils'
3
+
4
+ import { Link } from 'playbook-ui'
5
+
6
+ const link = 'https://www.google.com'
7
+
8
+ const props = {
9
+ data: { testid: 'default' },
10
+ href: link,
11
+ }
12
+
13
+ test('returns namespaced class name', () => {
14
+ const kit = renderKit(Link , props)
15
+ expect(kit).toBeInTheDocument()
16
+ expect(kit).toHaveClass('pb_link_kit')
17
+ expect(kit).toHaveAttribute('href', link)
18
+ })
19
+
20
+ it("should be accessible", async () => {
21
+ ensureAccessible(Link, props)
22
+ })
23
+
24
+ test('with colors', () => {
25
+ ['default', 'body', 'muted', 'destructive'].forEach((color) => {
26
+ const testId = `colors-test-${color}`
27
+ render(
28
+ <Link
29
+ color={color}
30
+ data={{ testid: testId }}
31
+ text="Test colors"
32
+ />
33
+ )
34
+
35
+ const kit = screen.getByTestId(testId)
36
+ expect(kit).toHaveClass(`pb_link_kit_${color}`)
37
+ })
38
+ })
39
+
40
+ test('disable prop', () => {
41
+ render(
42
+ <Link
43
+ data={{ testid: 'disable-test' }}
44
+ disabled
45
+ />
46
+ )
47
+
48
+ const kit = screen.getByTestId('disable-test')
49
+
50
+ expect(kit).toHaveClass('pb_link_kit_disabled')
51
+ })
52
+
53
+ test('underline prop', () => {
54
+ render(
55
+ <Link
56
+ data={{ testid: 'underline-test' }}
57
+ underline
58
+ />
59
+ )
60
+
61
+ const kit = screen.getByTestId('underline-test')
62
+
63
+ expect(kit).toHaveClass('pb_link_kit_underline')
64
+ })
65
+
66
+ test('adds icon', () => {
67
+ render(
68
+ <Link
69
+ data={{ testid: 'icon-test' }}
70
+ icon="arrow-up-right-from-square"
71
+ />
72
+ )
73
+
74
+ const kit = screen.getByTestId('icon-test')
75
+
76
+ const icon = kit.querySelector('.pb_icon_kit')
77
+ expect(icon).toBeInTheDocument();
78
+ })
79
+
80
+ test('adds icon right', () => {
81
+ render(
82
+ <Link
83
+ data={{ testid: 'icon-right-test' }}
84
+ iconRight="chevron-right"
85
+ />
86
+ )
87
+
88
+ const kit = screen.getByTestId('icon-right-test')
89
+
90
+ const icon = kit.querySelector('.pb_icon_kit')
91
+ expect(icon).toBeInTheDocument();
92
+ })
@@ -21,7 +21,7 @@ import classnames from "classnames";
21
21
  import { globalProps, GlobalProps } from "../utilities/globalProps";
22
22
  import { uniqueId } from 'lodash';
23
23
 
24
- type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth'>
24
+ type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth' | 'maxHeight' | 'minHeight'>
25
25
 
26
26
  type PbPopoverProps = {
27
27
  aria?: { [key: string]: string };
@@ -10,6 +10,24 @@
10
10
  $pb_selectable_card_indicator_size: 22px;
11
11
  $pb_selectable_card_border: 2px;
12
12
 
13
+ $pb_selectable_space_classes: (
14
+ xxs: $space_xxs,
15
+ xs: $space_xs,
16
+ sm: $space_sm,
17
+ md: $space_md,
18
+ lg: $space_lg,
19
+ xl: $space_xl,
20
+ );
21
+ $pb_selectable_paddings: (
22
+ p: "padding",
23
+ pr: "padding-right",
24
+ pl: "padding-left",
25
+ pt: "padding-top",
26
+ pb: "padding-bottom",
27
+ px: ("padding-left", "padding-right"),
28
+ py: ("padding-top", "padding-bottom")
29
+ );
30
+
13
31
  [class^=pb_selectable_card_kit] {
14
32
  display: block;
15
33
  margin-bottom: 0;
@@ -28,7 +46,6 @@ $pb_selectable_card_border: 2px;
28
46
  padding: $space_sm;
29
47
  margin-bottom: $space_sm;
30
48
  cursor: pointer;
31
- outline: 1px solid transparent;
32
49
 
33
50
  @media (hover:hover) {
34
51
  &:hover {
@@ -74,6 +91,7 @@ $pb_selectable_card_border: 2px;
74
91
 
75
92
  position: relative;
76
93
  @include pb_card_selected;
94
+ padding: calc(#{$space_sm} - 1px);
77
95
  transition-property: none;
78
96
  transition-duration: 0s;
79
97
 
@@ -88,6 +106,54 @@ $pb_selectable_card_border: 2px;
88
106
  background-color: $royal;
89
107
  }
90
108
  }
109
+
110
+ // Selected card has 1px more border
111
+ // Remove 1px so content does not "jump"
112
+ @each $position_name,
113
+ $position in $pb_selectable_paddings {
114
+ @each $space_name,
115
+ $space in $pb_selectable_space_classes {
116
+ ~ label.#{$position_name}_#{$space_name} {
117
+ @if type-of($position)=="list" {
118
+ @each $coordinate in $position {
119
+ #{$coordinate}: calc(#{$space} - 1px) !important;
120
+ }
121
+ }
122
+
123
+ @else {
124
+ #{$position}: calc(#{$space} - 1px) !important;
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+ &.display_input {
133
+ input[type="checkbox"],
134
+ input[type="radio"] {
135
+ &:checked {
136
+ ~label {
137
+ border-width: $pb_card_border_width;
138
+ outline: 1px solid $primary;
139
+ }
140
+
141
+ }
142
+ }
143
+
144
+ > label {
145
+ outline: 1px solid transparent;
146
+ padding: $space_sm;
147
+ }
148
+
149
+ &.dark {
150
+ input[type="checkbox"],
151
+ input[type="radio"] {
152
+ &:checked ~ label {
153
+ border-width: $pb_card_border_width;
154
+ outline: 1px solid $primary;
155
+ }
156
+ }
91
157
  }
92
158
  }
93
159
 
@@ -67,6 +67,7 @@ const SelectableCard = (props: SelectableCardProps) => {
67
67
  'disabled': disabled,
68
68
  'enabled': !disabled,
69
69
  }),
70
+ variant === 'displayInput' ? 'display_input' : '',
70
71
  { error },
71
72
  dark ? 'dark' : '',
72
73
  className
@@ -25,7 +25,7 @@
25
25
  <% end %>
26
26
  <div class="separator"></div>
27
27
  <div class="psuedo_separator"></div>
28
- <%= pb_rails("card", props: { padding: "sm", status: object.status, border_none: true }) do %>
28
+ <%= pb_rails("card", props: { padding: "sm", status: object.status, border_none: true, dark: object.dark }) do %>
29
29
  <% if content.nil? %>
30
30
  <%= pb_rails("body", props: { text: object.text }) %>
31
31
  <% else %>
@@ -25,7 +25,7 @@ module Playbook
25
25
 
26
26
  def classname
27
27
  [
28
- generate_classname_without_spacing("pb_selectable_card_kit", checked_class, enable_disabled_class),
28
+ generate_classname_without_spacing("pb_selectable_card_kit", checked_class, enable_disabled_class) + display_input_class,
29
29
  error_class,
30
30
  dark_props,
31
31
  ].compact.join(" ")
@@ -79,6 +79,10 @@ module Playbook
79
79
  def error_class
80
80
  error ? "error" : nil
81
81
  end
82
+
83
+ def display_input_class
84
+ variant == "display_input" ? " display_input" : ""
85
+ end
82
86
  end
83
87
  end
84
88
  end
@@ -0,0 +1,37 @@
1
+ @import 'skeleton_loading_mixins';
2
+
3
+ .pb_skeleton_loading {
4
+ display: "flex";
5
+ flex-direction: "column";
6
+ height: 100%;
7
+ .color_default {
8
+ @include skeleton-shimmer($silver);
9
+ }
10
+ .color_white {
11
+ @include skeleton-shimmer-light($white);
12
+ }
13
+ .dark {
14
+ @include skeleton-shimmer($border_dark);
15
+ }
16
+ .gap_xxs {
17
+ margin-top: 4px;
18
+ }
19
+ .gap_xs {
20
+ margin-top: 8px;
21
+ }
22
+ .gap_sm {
23
+ margin-top: 16px;
24
+ }
25
+ .gap_md {
26
+ margin-top: 24px;
27
+ }
28
+ .gap_lg {
29
+ margin-top: 32px;
30
+ }
31
+ .gap_xl {
32
+ margin-top: 40px;
33
+ }
34
+ .gap_xxl {
35
+ margin-top: 48px;
36
+ }
37
+ }
@@ -0,0 +1,67 @@
1
+
2
+ import React from 'react'
3
+ import classnames from 'classnames'
4
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
6
+ import { Sizes } from '../types'
7
+
8
+
9
+ type SkeletonLoadingProps = {
10
+ aria?: { [key: string]: string },
11
+ className?: string,
12
+ data?: { [key: string]: string },
13
+ id?: string,
14
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
15
+ height?: string,
16
+ width?: string,
17
+ borderRadius?: string,
18
+ gap?: Sizes | "none",
19
+ stack?: number,
20
+ color?: "default" | "white",
21
+ dark?: boolean,
22
+ } & GlobalProps
23
+
24
+ const SkeletonLoading = (props: SkeletonLoadingProps): React.ReactElement => {
25
+ const {
26
+ aria = {},
27
+ className,
28
+ data = {},
29
+ id,
30
+ htmlOptions = {},
31
+ height = "16px",
32
+ width = "100%",
33
+ borderRadius = "sm",
34
+ gap = "xxs",
35
+ stack = 1,
36
+ color = "default",
37
+ dark = false,
38
+ } = props
39
+
40
+ const ariaProps = buildAriaProps(aria)
41
+ const dataProps = buildDataProps(data)
42
+ const htmlProps = buildHtmlProps(htmlOptions)
43
+ const skeletonContainerCss = classnames(buildCss('pb_skeleton_loading'), globalProps(props), className)
44
+ const gapClass = gap !== 'none' ? `gap_${gap}` : ''
45
+ const innerSkeletonCss = classnames(`border_radius_${borderRadius}`,`color_${color}`, dark && 'dark', )
46
+ const innerSizeStyle = { height, width }
47
+
48
+ return (
49
+ <div
50
+ {...ariaProps}
51
+ {...dataProps}
52
+ {...htmlProps}
53
+ className={skeletonContainerCss}
54
+ id={id}
55
+ >
56
+ {Array.from({ length: Number(stack) }).map((_, index) => (
57
+ <div
58
+ className={classnames(buildCss('pb_skeleton_loading_item'), innerSkeletonCss, index > 0 && gapClass)}
59
+ key={index}
60
+ style={innerSizeStyle}
61
+ />
62
+ ))}
63
+ </div>
64
+ )
65
+ }
66
+
67
+ export default SkeletonLoading
@@ -0,0 +1,40 @@
1
+ // Animation
2
+ @keyframes wave {
3
+ 0% {
4
+ background-position: -468px 0;
5
+ }
6
+ 100% {
7
+ background-position: 468px 0;
8
+ }
9
+ }
10
+
11
+ // Shimmer animation and gradient mixin based on color
12
+ @mixin skeleton-shimmer($color) {
13
+ background: $color;
14
+ background-color: $color;
15
+ background-image: linear-gradient(
16
+ to left,
17
+ $color 0%,
18
+ lighten($color, 1%) 50%,
19
+ lighten($color, 1%) 60%,
20
+ $color 80%,
21
+ $color 100%
22
+ );
23
+ background-repeat: no-repeat;
24
+ animation: wave 1.5s linear infinite forwards;
25
+ }
26
+
27
+ @mixin skeleton-shimmer-light($color) {
28
+ background: $color;
29
+ background-color: $color;
30
+ background-image: linear-gradient(
31
+ to left,
32
+ $color 0%,
33
+ darken($color, 1%) 50%,
34
+ darken($color, 1%) 60%,
35
+ $color 80%,
36
+ $color 100%
37
+ );
38
+ background-repeat: no-repeat;
39
+ animation: wave 1.5s linear infinite forwards;
40
+ }
@@ -0,0 +1,51 @@
1
+ import React from 'react'
2
+ import { Flex, SkeletonLoading } from "playbook-ui"
3
+
4
+
5
+ const SkeletonLoadingBorderRadius = (props) => (
6
+ <Flex justify="evenly">
7
+ <SkeletonLoading
8
+ borderRadius="rounded"
9
+ height="50px"
10
+ width="100px"
11
+ {...props}
12
+ />
13
+ <SkeletonLoading
14
+ borderRadius="xl"
15
+ height="50px"
16
+ width="100px"
17
+ {...props}
18
+ />
19
+ <SkeletonLoading
20
+ borderRadius="lg"
21
+ height="50px"
22
+ width="100px"
23
+ {...props}
24
+ />
25
+ <SkeletonLoading
26
+ borderRadius="md"
27
+ height="50px"
28
+ width="100px"
29
+ {...props}
30
+ />
31
+ <SkeletonLoading
32
+ height="50px"
33
+ width="100px"
34
+ {...props}
35
+ />
36
+ <SkeletonLoading
37
+ borderRadius="xs"
38
+ height="50px"
39
+ width="100px"
40
+ {...props}
41
+ />
42
+ <SkeletonLoading
43
+ borderRadius="none"
44
+ height="50px"
45
+ width="100px"
46
+ {...props}
47
+ />
48
+ </Flex>
49
+ )
50
+
51
+ export default SkeletonLoadingBorderRadius
@@ -0,0 +1 @@
1
+ The `borderRadius` prop accepts all of our [BorderRadius](https://playbook.powerapp.cloud/visual_guidelines/border_radius) tokens, with `sm` as default.
@@ -0,0 +1,26 @@
1
+ import React from 'react'
2
+ import { Card, SkeletonLoading } from "playbook-ui"
3
+
4
+
5
+ const SkeletonLoadingColor = (props) => (
6
+ <div>
7
+ <Card
8
+ borderNone
9
+ {...props}
10
+ >
11
+ <SkeletonLoading {...props}/>
12
+ </Card>
13
+ <Card
14
+ background="light"
15
+ borderNone
16
+ {...props}
17
+ >
18
+ <SkeletonLoading
19
+ color="white"
20
+ {...props}
21
+ />
22
+ </Card>
23
+ </div>
24
+ )
25
+
26
+ export default SkeletonLoadingColor
@@ -0,0 +1 @@
1
+ The SkeletonLoading component has a default and a white `color` variant.
@@ -0,0 +1 @@
1
+ <%= pb_rails("skeleton_loading") %>
@@ -0,0 +1,11 @@
1
+ import React from 'react'
2
+ import { SkeletonLoading } from "playbook-ui"
3
+
4
+
5
+ const SkeletonLoadingDefault = (props) => (
6
+ <div>
7
+ <SkeletonLoading {...props} />
8
+ </div>
9
+ )
10
+
11
+ export default SkeletonLoadingDefault