playbook_ui 10.21.0.pre.alpha.jd1 → 10.21.0.pre.alpha.jg1

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: 1c31d281357f8dc7925b97fa9b6afaf1a5b058119086ad716ee72f9d86c7a221
4
- data.tar.gz: 154d9accb2a7412eb67a71fc73504da468eb3ca786b8f887667733b9a019e397
3
+ metadata.gz: 89c2b4d5b904ea641d5c4e5e1a436bdb70f5b8ad5292d6a9491f66dfba2406f2
4
+ data.tar.gz: 9246be8a7160010539031d1be35b247d9dc90a7f62f5cdfb7257785fdda564c4
5
5
  SHA512:
6
- metadata.gz: 5c804f0c7103265e31c1aa49d87996cddab6cc611b60c41c5d8c5dd99a4fe784bdb9e16a59720857593bfbd17cd90f7ccc8549aea096803d62eb757488851a28
7
- data.tar.gz: 5e8d5c37aa6ae27821507353fb3943339a9b4cf2a04fd683b6ae3d0cece1060949160e2b8adf1e862c28577d83944d4f993fa86536fc4aad79d3b09f1ae78818
6
+ metadata.gz: 88d2c607e9942698c68473dbf6c3a468a0db61f4bad82c992497df0784d272936bd038ac11914f3ec07e16523872c592212cee958f007856911d4b31fd11523c
7
+ data.tar.gz: fb7262bf896606e9f7a4e39673962702a1d187cb19557317f9848cc1e8844b9b29c0aed208c4bc8acceaaf81941b23c03f990d5f917b0398f4104311aa68d281
@@ -6,6 +6,7 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
6
  import { globalProps } from '../utilities/globalProps.js'
7
7
 
8
8
  type BackgroundProps = {
9
+ alt?: string,
9
10
  aria?: object,
10
11
  backgroundColor?: 'gradient' | 'dark' | 'light' | 'white' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'primary' | 'category_1' | 'category_2' | 'category_3' | 'category_4' | 'category_5' | 'category_6' | 'category_7' | 'category_8' | 'category_9' | 'category_10' | 'category_11' | 'category_12' | 'category_13' | 'category_14' | 'category_15' | 'category_16' | 'category_17' | 'category_18' | 'category_19' | 'category_20' | 'category_21',
11
12
  children?: array<React.ReactNode> | React.ReactNode,
@@ -15,10 +16,12 @@ type BackgroundProps = {
15
16
  imageUrl?: string,
16
17
  padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
17
18
  tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
19
+ transition?: 'fade' | 'blur' | 'scale',
18
20
  }
19
21
 
20
22
  const Background = (props: BackgroundProps) => {
21
23
  const {
24
+ alt = '',
22
25
  aria = {},
23
26
  backgroundColor = 'light',
24
27
  children,
@@ -27,22 +30,24 @@ const Background = (props: BackgroundProps) => {
27
30
  id,
28
31
  imageUrl = '',
29
32
  tag = 'div',
33
+ transition = '',
30
34
  } = props
31
35
 
32
36
  const ariaProps = buildAriaProps(aria)
33
37
  const dataProps = buildDataProps(data)
34
38
 
35
- const classes = classnames(buildCss('pb_background_kit'), globalProps(props), `pb_background_color_${backgroundColor}`, className)
36
- const Tag = `${tag}`
37
39
  const backgroundStyle = {
38
40
  backgroundImage: `url(${imageUrl})`,
39
41
  backgroundSize: 'cover',
40
42
  }
43
+ const classes = classnames(buildCss('pb_background_kit'), 'lazyload', backgroundStyle, transition, globalProps(props), `pb_background_color_${backgroundColor}`, className)
44
+ const Tag = `${tag}`
41
45
 
42
46
  return (
43
47
  <>
44
48
  <If condition={imageUrl}>
45
49
  <Tag
50
+ alt={alt}
46
51
  style={backgroundStyle}
47
52
  {...ariaProps}
48
53
  {...dataProps}
@@ -22,14 +22,30 @@ $background_colors: map-merge($additional_colors, $merge_kits2);
22
22
  }
23
23
  };
24
24
 
25
- .blur_up {
26
- -webkit-filter: blur(6px);
27
- filter: blur(6px);
28
- transition: filter 550ms, -webkit-filter 550ms;
25
+ &.fade {
26
+ opacity: 0;
27
+ &.lazyloaded {
28
+ opacity: 1;
29
+ transition: opacity 400ms ease-in;
30
+ }
29
31
  }
30
-
31
- .blur_up.lazyloaded {
32
- -webkit-filter: blur(0);
33
- filter: blur(0);
32
+
33
+ &.blur {
34
+ filter: blur(5px);
35
+ &.lazyloaded {
36
+ -webkit-filter: blur(0);
37
+ filter: blur(0);
38
+ transition: filter 400ms ease-in;
39
+ }
40
+ }
41
+
42
+ &.scale {
43
+ opacity: 0;
44
+ transform: scale(0.9);
45
+ &.lazyloaded {
46
+ opacity: 1;
47
+ transform: scale(1);
48
+ transition: 700ms ease-in;
49
+ }
34
50
  }
35
51
  }
@@ -12,18 +12,18 @@ module Playbook
12
12
  values: %w[h1 h2 h3 h4 h5 h6 p div span],
13
13
  default: "div"
14
14
 
15
+ prop :transition, type: Playbook::Props::Enum,
16
+ values: ["blur", "fade", "scale", nil],
17
+ default: nil
18
+
15
19
  def classname
16
- generate_classname("pb_background_kit", image_classname, background_color_classname, separator: " ")
20
+ generate_classname("pb_background_kit", image_classname, separator: " ")
17
21
  end
18
22
 
19
23
  private
20
24
 
21
25
  def image_classname
22
- image_url.present? ? "lazyload blur_up" : ""
23
- end
24
-
25
- def background_color_classname
26
- !image_url.present? ? "pb_background_color_#{background_color}" : ""
26
+ image_url.present? ? "lazyload #{transition}" : "pb_background_color_#{background_color}"
27
27
  end
28
28
  end
29
29
  end
@@ -1,5 +1,5 @@
1
- <%= pb_rails("background", props: { image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", padding: "lg" }) do %>
2
- <%= pb_rails("flex", props: { horizontal: "center", orientation: "column" }) do %>
1
+ <%= pb_rails("background", props: { classname: "background-image", image_url: "https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80", padding: "lg" }) do %>
2
+ <%= pb_rails("flex", props: { horizontal: "center", orientation: "column", margin_bottom: "xl" }) do %>
3
3
  <%= pb_rails("flex/flex_item") do %>
4
4
  <%= pb_rails("title", props: { dark: true, size: 1, text: "Background Kit Image" })%>
5
5
  <% end %>
@@ -11,3 +11,51 @@
11
11
  <% end %>
12
12
  <% end %>
13
13
  <% end %>
14
+
15
+
16
+ <%= pb_rails("flex", props: { margin_top: "lg" }) do %>
17
+ <%= pb_rails("flex/flex_item", props: {fixed_size: "250px"}) do %>
18
+ <%= pb_rails("select", props: {
19
+ id: "transition-dropdown",
20
+ label: "",
21
+ blank_selection: "Select a Transition...",
22
+ options: [
23
+ {
24
+ value: 'fade',
25
+ },
26
+ {
27
+ value: 'blur',
28
+ },
29
+ {
30
+ value: 'scale',
31
+ },
32
+ ]
33
+ }) %>
34
+ <% end %>
35
+ <% end %>
36
+
37
+ <script>
38
+ window.addEventListener('DOMContentLoaded', () => {
39
+ const transitionDropdown = document.querySelector("#transition-dropdown")
40
+ var option = ''
41
+
42
+ transitionDropdown.addEventListener('change', function() {
43
+ if (this.value === '') {
44
+ (transitionDropdown).className = (transitionDropdown).className + ' _disabled'
45
+ } else {
46
+ (transitionDropdown).removeAttribute("disabled");
47
+ (transitionDropdown).className = (transitionDropdown)
48
+ option = this.value
49
+ }
50
+ });
51
+
52
+ const updateTransition = (transition) => {
53
+ const imageTransition = document.querySelector('.background-image')
54
+ imageTransition.classList.remove("fade", "blur", "scale", "lazyloaded")
55
+ imageTransition.classList.add(transition, "lazyload")
56
+ }
57
+ (transitionDropdown).addEventListener('change', function() {
58
+ updateTransition(option)
59
+ })
60
+ });
61
+ </script>
@@ -1,36 +1,79 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
2
  import { Background } from '../..'
3
- import { Card, Flex, FlexItem, Title } from '../..'
3
+ import { Card, Flex, FlexItem, Select, Title } from '../..'
4
4
 
5
- const BackgroundImage = (props) => (
6
- <Background imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80">
7
- <Flex
8
- orientation="column"
9
- vertical="center"
10
- {...props}
11
- >
12
- <FlexItem>
13
- <Title
14
- dark
15
- padding="lg"
16
- size={1}
17
- text="Background Kit Image"
18
- {...props}
19
- />
20
- </FlexItem>
21
- <FlexItem
22
- padding="lg"
5
+ const BackgroundImage = (props) => {
6
+ const [transition, setTransition] = useState('')
7
+
8
+ const handleTransition = ({ target }) => {
9
+ setTransition(target.value)
10
+ }
11
+
12
+ const options = [
13
+ {
14
+ value: 'fade',
15
+ },
16
+ {
17
+ value: 'blur',
18
+ },
19
+ {
20
+ value: 'scale',
21
+ },
22
+ ]
23
+
24
+ return (
25
+ <>
26
+ <Background
27
+ alt="colorful background"
28
+ className="background lazyload"
29
+ imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
30
+ transition={transition}
23
31
  {...props}
24
32
  >
25
- <Card
26
- shadow="deepest"
33
+ <Flex
34
+ orientation="column"
35
+ vertical="center"
27
36
  {...props}
28
37
  >
29
- {'We cannot seek achievement for ourselves and forget about progress and prosperity for our community... Our ambitions must be broad enough to include the aspirations and needs of others, for their sakes and for our own. - Cesar Chavez'}
30
- </Card>
31
- </FlexItem>
32
- </Flex>
33
- </Background>
34
- )
38
+ <FlexItem>
39
+ <Title
40
+ dark
41
+ padding="lg"
42
+ size={1}
43
+ text="Background Kit Image"
44
+ {...props}
45
+ />
46
+ </FlexItem>
47
+ <FlexItem
48
+ padding="lg"
49
+ {...props}
50
+ >
51
+ <Card
52
+ shadow="deepest"
53
+ {...props}
54
+ >
55
+ {
56
+ 'We cannot seek achievement for ourselves and forget about progress and prosperity for our community... Our ambitions must be broad enough to include the aspirations and needs of others, for their sakes and for our own. - Cesar Chavez'
57
+ }
58
+ </Card>
59
+ </FlexItem>
60
+ </Flex>
61
+ </Background>
62
+ <Flex marginTop="xl">
63
+ <FlexItem fixedSize="250px">
64
+ <Select
65
+ blankSelection="Select a Transition..."
66
+ label=""
67
+ name="dropdown"
68
+ onChange={handleTransition}
69
+ options={options}
70
+ transition={transition}
71
+ {...props}
72
+ />
73
+ </FlexItem>
74
+ </Flex>
75
+ </>
76
+ )
77
+ }
35
78
 
36
79
  export default BackgroundImage
@@ -0,0 +1 @@
1
+ To add a lazyload on the background image simply use the `transition` prop and one of the three string options `"fade"`, `"blur"`, or `"scale"`.
@@ -34,7 +34,7 @@ const Image = (props: ImageProps) => {
34
34
 
35
35
  const ariaProps = buildAriaProps(aria)
36
36
  const classes = classnames(
37
- buildCss('pb_image_kit', size ? `size_${size}` : null),
37
+ buildCss('pb_image_kit', size),
38
38
  'lazyload',
39
39
  transition,
40
40
  { rounded },
@@ -14,7 +14,7 @@ $image-sizes: (
14
14
  object-fit: cover;
15
15
 
16
16
  @each $name, $size in $image-sizes {
17
- &[class*=size_#{$name}] {
17
+ &[class*=_#{$name}] {
18
18
  width: $size;
19
19
  height: $size;
20
20
  object-fit: cover;
@@ -35,7 +35,7 @@ $image-sizes: (
35
35
  transition: opacity 300ms ease-in;
36
36
  }
37
37
  }
38
-
38
+
39
39
  &.blur {
40
40
  filter: blur(5px);
41
41
  &.lazyloaded {
@@ -44,7 +44,7 @@ $image-sizes: (
44
44
  transition: filter 300ms ease-in;
45
45
  }
46
46
  }
47
-
47
+
48
48
  &.scale {
49
49
  opacity: 0;
50
50
  transform: scale(0.9);
@@ -27,7 +27,7 @@ module Playbook
27
27
  end
28
28
 
29
29
  def size_class
30
- size == "none" ? nil : "_size_#{size}"
30
+ size == "none" ? nil : "_#{size}"
31
31
  end
32
32
 
33
33
  def transition_class
@@ -26,7 +26,7 @@ test('default classname', () => {
26
26
 
27
27
  test('size = xs', () => {
28
28
  const kit = renderKit(Image, props, { size: 'xs' })
29
- expect(kit).toHaveClass('pb_image_kit_size_xs lazyload')
29
+ expect(kit).toHaveClass('pb_image_kit_xs lazyload')
30
30
  })
31
31
 
32
32
  test('transition = blur', () => {
@@ -129,10 +129,6 @@ const RichTextEditor = (props: RichTextEditorProps) => {
129
129
  trixRef.current.addEventListener('click', handleClick)
130
130
  }, [])
131
131
 
132
- useEffect(() => {
133
- trixRef.current.editor.loadHTML(value)
134
- }, [value])
135
-
136
132
  const RichTextEditorClass = 'pb_rich_text_editor_kit'
137
133
  const SimpleClass = simple ? 'simple' : ''
138
134
  const FocusClass = focus ? 'focus-editor-targets' : ''
@@ -4,12 +4,12 @@
4
4
 
5
5
 
6
6
  [class^=pb_text_input_kit] {
7
- margin-bottom: $space_sm;
8
7
  .pb_text_input_kit_label {
9
8
  margin-bottom: $space_xs;
10
9
  display: block;
11
10
  }
12
11
  .text_input_wrapper {
12
+ margin-bottom: $space_sm;
13
13
  display: block;
14
14
  input::placeholder,
15
15
  .text_input .placeholder {
@@ -75,17 +75,3 @@ test('returns additional class name', () => {
75
75
  const kit = screen.getByTestId(testId)
76
76
  expect(kit).toHaveClass(`${kitClass} dark error`)
77
77
  })
78
-
79
- test('returns additional class name', () => {
80
- render(
81
- <TextInput
82
- data={{ testid: testId }}
83
- label="First Name"
84
- marginBottom="lg"
85
- placeholder="Enter first name"
86
- />
87
- )
88
-
89
- const kit = screen.getByTestId(testId)
90
- expect(kit).toHaveClass(`${kitClass} mb_lg`)
91
- })
data/dist/reset.css CHANGED
@@ -1,61 +1,2 @@
1
- /* CLEAN UP AND REMOVE */
2
- /* Headings */
3
- /* Standard Font Weights */
4
- /* Non_Standard Font Weights */
5
- /*=====================================
6
- Base colors should not be documented.
7
- Only document color use.
8
-
9
- Colors -----------------------------*/
10
- /* Specialty Gradient -----------------*/
11
- /* Interface colors -------------------*/
12
- /* Main colors ------------------------*/
13
- /*=====================================
14
-
15
- Background colors ------------------*/
16
- /* Card colors ------------------*/
17
- /* Active colors ----------------------*/
18
- /* Hover colors -----------------------*/
19
- /* Focus colors -----------------------*/
20
- /* Border colors ----------------------*/
21
- /* Shadow colors ----------------------*/
22
- /* Text colors ------------------------*/
23
- /* Data colors ------------------------*/
24
- /* Status colors ----------------------*/
25
- /* Link colors ------------------------*/
26
- /* Product colors ---------------------*/
27
- /* Category colors ---------------------*/
28
- * {
29
- box-sizing: border-box;
30
- margin: 0;
31
- padding: 0; }
32
- *:before, *:after {
33
- box-sizing: border-box; }
34
-
35
- html {
36
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
37
- height: 100vh;
38
- overflow-x: hidden; }
39
-
40
- body {
41
- font-family: "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans_serif;
42
- font-size: 16px;
43
- line-height: 1.5;
44
- background-color: #F3F7FB;
45
- height: 100%;
46
- letter-spacing: 0;
47
- font-weight: 400;
48
- font-style: normal;
49
- text-rendering: optimizeLegibility;
50
- -moz-font-feature-settings: "liga" on;
51
- color: #242B42;
52
- margin: 0 !important;
53
- padding: 0 !important;
54
- box-sizing: border-box;
55
- min-height: 100vh;
56
- padding: 50px; }
57
-
58
- a {
59
- text-decoration: none;
60
- color: #0056CF; }
1
+ *{box-sizing:border-box;margin:0;padding:0}*:before,*:after{box-sizing:border-box}html{-webkit-tap-highlight-color:rgba(0,0,0,0);height:100vh;overflow-x:hidden}body{font-family:"Proxima Nova","Helvetica Neue",Helvetica,Arial,sans_serif;font-size:16px;line-height:1.5;background-color:#F3F7FB;height:100%;letter-spacing:0;font-weight:400;font-style:normal;text-rendering:optimizeLegibility;-moz-font-feature-settings:"liga" on;color:#242B42;margin:0 !important;padding:0 !important;box-sizing:border-box;min-height:100vh;padding:50px}a{text-decoration:none;color:#0056CF}
61
2
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "10.20.0"
5
- VERSION = "10.21.0.pre.alpha.jd1"
5
+ VERSION = "10.21.0.pre.alpha.jg1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.21.0.pre.alpha.jd1
4
+ version: 10.21.0.pre.alpha.jg1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-02-02 00:00:00.000000000 Z
12
+ date: 2022-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -330,6 +330,7 @@ files:
330
330
  - app/pb_kits/playbook/pb_background/docs/_background_gradient.jsx
331
331
  - app/pb_kits/playbook/pb_background/docs/_background_image.html.erb
332
332
  - app/pb_kits/playbook/pb_background/docs/_background_image.jsx
333
+ - app/pb_kits/playbook/pb_background/docs/_background_image.md
333
334
  - app/pb_kits/playbook/pb_background/docs/_background_light.html.erb
334
335
  - app/pb_kits/playbook/pb_background/docs/_background_light.jsx
335
336
  - app/pb_kits/playbook/pb_background/docs/_background_status.html.erb