playbook_ui 10.25.0.pre.alpha3 → 10.25.1

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: 4f77b529bab08c5e077aa7829bad23c1de7d37fca85d285242bfde38a561aa9d
4
- data.tar.gz: 21085e13de08866111e1027e7e7e076d0ff8431ef1f488b403cc16e5280a0e69
3
+ metadata.gz: 8be95036b076c3fbe7bdf059733bbcd3fe287731d38c671214167c465094b5f5
4
+ data.tar.gz: 38dd59dbdaddae412dc128c5aa33b149ef671365c3e4a4e836a9c6bbc2e5d5a6
5
5
  SHA512:
6
- metadata.gz: 859a417e402619765fefd8bae70cd9299f3594ab4837c5891bd2ccbc1b08a9555b6c4761a81e3f6bb41768b915aa36e36c423bc0c48721b3578668948740c425
7
- data.tar.gz: 34600c5b6ffc0ec0c27378d2572137b96716e6ff1f0df6c0cfd96992807fd4708b125e78acc213da8059dc8ff703258fc44776014e1e1d50baa78c169d4900f2
6
+ metadata.gz: a4b2119448938ad199474fdbfabe230b62a759b5c36b51e732aa21ed2468996aee3d99e7898c7087a1998ef2a93bd0d7df9c5c2758048107b547d379c1efae9e
7
+ data.tar.gz: 4263f916d2e535d823ff3fe1421ec2e0a43a201d56f0520057d77b2efa93fd029332d42deafaf3a460ca2dab4fe6eddfaae6108e66390c46cbd0deeb3265dae2
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
 
@@ -9,13 +7,13 @@ import { globalProps } from '../utilities/globalProps'
9
7
  import Highlight from '../pb_highlight/_highlight'
10
8
 
11
9
  type BodyProps = {
12
- aria?: object,
10
+ aria?: {[key: string]: string},
13
11
  className?: string,
14
- children?: array<React.ReactChild>,
12
+ children?: React.ReactChild[],
15
13
  color?: 'default' | 'light' | 'lighter' | 'link',
16
14
  dark?: boolean,
17
- data?: object,
18
- highlightedText?: array<string>,
15
+ data?: {[key: string]: string},
16
+ highlightedText?: string[],
19
17
  highlighting?: boolean,
20
18
  id?: string,
21
19
  status?: 'negative' | 'neutral' | 'positive',
@@ -24,30 +22,31 @@ type BodyProps = {
24
22
  variant: null | 'link',
25
23
  }
26
24
 
27
- const Body = (props: BodyProps) => {
25
+ const Body = (props: BodyProps): React.ReactElement => {
28
26
  const {
29
27
  aria = {},
30
- className,
31
28
  children,
29
+ className,
32
30
  color = '',
33
31
  data = {},
34
32
  highlightedText = [],
35
33
  highlighting = false,
36
- id,
37
- status,
34
+ id = '',
35
+ status = null,
38
36
  tag = 'div',
39
- text,
37
+ text = '',
40
38
  variant = null,
41
39
  } = props
42
40
 
43
- const ariaProps = buildAriaProps(aria)
44
- const dataProps = buildDataProps(data)
41
+ const ariaProps: {[key: string]: any} = buildAriaProps(aria)
42
+ const dataProps: {[key: string]: any} = buildDataProps(data)
45
43
  const classes = classnames(
46
44
  buildCss('pb_body_kit', color, variant, status),
47
45
  globalProps(props),
48
46
  className
49
47
  )
50
- const Tag = `${tag}`
48
+ const Tag: React.ReactElement | any = `${tag}`
49
+
51
50
 
52
51
  return (
53
52
  <Tag
@@ -56,11 +55,17 @@ const Body = (props: BodyProps) => {
56
55
  className={classes}
57
56
  id={id}
58
57
  >
59
- <If condition={highlighting}>
60
- <Highlight highlightedText={highlightedText}>{text || children}</Highlight>
61
- <Else />
62
- { text || children }
63
- </If>
58
+ { highlighting && (
59
+ <Highlight
60
+ highlightedText={highlightedText}
61
+ text={text}
62
+ >
63
+ {children}
64
+ </Highlight>
65
+ ) }
66
+ { !highlighting && (
67
+ text || children
68
+ ) }
64
69
  </Tag>
65
70
  )
66
71
  }
@@ -3,12 +3,14 @@
3
3
  import React from 'react'
4
4
  import { get } from 'lodash'
5
5
  import classnames from 'classnames'
6
+
6
7
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
8
  import { globalProps } from '../utilities/globalProps'
9
+ import { ProductColors, CategoryColors, BackgroundColors } from '../types'
8
10
 
9
11
  type CardPropTypes = {
10
12
  aria?: object,
11
- background?: "white" | "dark" | "light" | "windows" | "siding" | "doors" | "solar" | "roofing" | "gutters" | "insulation" | "none",
13
+ background?: BackgroundColors | ProductColors | "none",
12
14
  borderNone?: boolean,
13
15
  borderRadius?: "xs" | "sm" | "md" | "lg" | "xl" | "none" | "rounded",
14
16
  children: array<React.ReactNode> | React.ReactNode,
@@ -24,7 +26,7 @@ type CardPropTypes = {
24
26
  }
25
27
 
26
28
  type CardHeaderProps = {
27
- headerColor?: string,
29
+ headerColor?: BackgroundColors | ProductColors | CategoryColors | "none",
28
30
  children: array<React.ReactNode> | React.ReactNode,
29
31
  className?: string,
30
32
  padding?: string,
@@ -1,6 +1,5 @@
1
1
  @import "card_mixin";
2
2
 
3
-
4
3
  [class^=pb_card_kit] {
5
4
  @include pb_card;
6
5
 
@@ -30,6 +29,9 @@
30
29
  @each $color_name, $color_value in $pb_card_header_colors {
31
30
  &[class*=_#{$color_name}] {
32
31
  @include pb_card_header_color($color_value);
32
+ [class^=pb_body_kit] {
33
+ color: lightenText($color_value);
34
+ }
33
35
  }
34
36
  }
35
37
  &[class*=_white] {
@@ -9,7 +9,6 @@ $pb_card_border_width: 1px;
9
9
  $pb_card_border_radius: $border_rad_heavier;
10
10
  $pb_card_highlight_colors: map-merge(map-merge($status_colors, $product_colors), $category_colors);
11
11
  $pb_card_highlight_size: 4px;
12
- $pb_card_header_colors: map-merge($category_colors, $product_colors);
13
12
  $pb_card_header_border_radius: $border_rad_heavy;
14
13
 
15
14
  $additional_colors: (
@@ -19,6 +18,7 @@ $additional_colors: (
19
18
  "none": none,
20
19
  );
21
20
  $background_colors: map-merge($product_colors, $additional_colors);
21
+ $pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors), $category_colors);
22
22
 
23
23
  @mixin pb_card_selected($border_color: $primary) {
24
24
  border-color: $border_color;
@@ -1,6 +1,6 @@
1
1
  <%= pb_rails("title", props: { text: "Category Colors", tag: "h4", size: 4 }) %>
2
-
3
- <br>
2
+
3
+ <br>
4
4
 
5
5
  <%= pb_rails("card", props: { padding: "none", header: true}) do %>
6
6
  <%= pb_rails("card/card_header", props: { padding: "sm" }) do %>
@@ -11,7 +11,7 @@
11
11
  <% end %>
12
12
  <% end %>
13
13
 
14
- <br>
14
+ <br>
15
15
 
16
16
  <%= pb_rails("card", props: { padding: "none", header: true}) do %>
17
17
  <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "category_2" }) do %>
@@ -25,7 +25,7 @@
25
25
 
26
26
  <br>
27
27
 
28
- <%= pb_rails("title", props: { text: "Product Colors", tag: "h4", size: 4 }) %>
28
+ <%= pb_rails("title", props: { text: "Product Colors", tag: "h4", size: 4 }) %>
29
29
 
30
30
  <br>
31
31
 
@@ -48,3 +48,29 @@
48
48
  Body
49
49
  <% end %>
50
50
  <% end %>
51
+
52
+ <br>
53
+
54
+ <%= pb_rails("title", props: { text: "Background Colors", tag: "h4", size: 4 }) %>
55
+
56
+ <br>
57
+
58
+ <%= pb_rails("card", props: { padding: "none", header: true}) do %>
59
+ <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "white" }) do %>
60
+ <%= pb_rails("body", props: { text: "White" }) %>
61
+ <% end %>
62
+ <%= pb_rails("card/card_body", props: { padding: "md" }) do %>
63
+ Body
64
+ <% end %>
65
+ <% end %>
66
+
67
+ <br>
68
+
69
+ <%= pb_rails("card", props: { padding: "none", header: true}) do %>
70
+ <%= pb_rails("card/card_header", props: { padding: "sm", header_color: "bg_dark" }) do %>
71
+ <%= pb_rails("body", props: { text: "Dark" }) %>
72
+ <% end %>
73
+ <%= pb_rails("card/card_body", props: { padding: "md" }) do %>
74
+ Body
75
+ <% end %>
76
+ <% end %>
@@ -111,6 +111,58 @@ const CardHeader = (props) => {
111
111
  </Card.Body>
112
112
  </Card>
113
113
 
114
+ <br />
115
+
116
+ <Title
117
+ {...props}
118
+ size={4}
119
+ tag="h4"
120
+ text="Background Colors"
121
+ />
122
+
123
+ <br />
124
+
125
+ <Card
126
+ {...props}
127
+ padding="none"
128
+ >
129
+ <Card.Header
130
+ headerColor="white"
131
+ >
132
+ <Body
133
+ {...props}
134
+ text="White"
135
+ />
136
+ </Card.Header>
137
+ <Card.Body>
138
+ <Body
139
+ {...props}
140
+ text="Body"
141
+ />
142
+ </Card.Body>
143
+ </Card>
144
+
145
+ <br />
146
+
147
+ <Card
148
+ {...props}
149
+ padding="none"
150
+ >
151
+ <Card.Header
152
+ headerColor="dark"
153
+ >
154
+ <Body
155
+ {...props}
156
+ text="Dark"
157
+ />
158
+ </Card.Header>
159
+ <Card.Body>
160
+ <Body
161
+ {...props}
162
+ text="Body"
163
+ />
164
+ </Card.Body>
165
+ </Card>
114
166
  </div>
115
167
  )
116
168
  }
@@ -1 +1 @@
1
- Card headers passes category and product colors only. List of all category and product colors can be viewed <a href="https://playbook.powerapp.cloud/utilities" target="_blank">here</a>.
1
+ Card headers pass category, product, and background colors only. List of all category, product, and background colors can be viewed <a href="https://playbook.powerapp.cloud/utilities" target="_blank">here</a>.
@@ -1,8 +1,8 @@
1
1
  /* @flow */
2
2
 
3
3
  import React, { useEffect, useRef } from 'react'
4
- import Body from '../pb_body/_body.jsx'
5
- import Icon from '../pb_icon/_icon.jsx'
4
+ import Body from '../pb_body/_body'
5
+ import Icon from '../pb_icon/_icon'
6
6
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
7
  import classnames from 'classnames'
8
8
  import { globalProps } from '../utilities/globalProps'
@@ -0,0 +1,38 @@
1
+ /* eslint-disable react/no-multi-comp */
2
+ /* @flow */
3
+
4
+ import React, { useState } from "react";
5
+ import { FileUpload, List, ListItem } from "../..";
6
+
7
+ const AcceptedFilesList = ({ files }: FileList) => (
8
+ <List>
9
+ {files.map((file) => (
10
+ <ListItem key={file.name}>{file.name}</ListItem>
11
+ ))}
12
+ </List>
13
+ );
14
+
15
+ const FileUploadCustomDescription = (props) => {
16
+ const [filesToUpload, setFilesToUpload] = useState([]);
17
+
18
+ const handleOnFilesAccepted = (files) => {
19
+ setFilesToUpload([...filesToUpload, ...files]);
20
+ };
21
+
22
+ return (
23
+ <div>
24
+ <AcceptedFilesList
25
+ files={filesToUpload}
26
+ {...props}
27
+ />
28
+ <FileUpload
29
+ accept={['application/pdf','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']}
30
+ acceptedFilesDescription="Adobe (.pdf) and Microsoft (.xslx)"
31
+ onFilesAccepted={handleOnFilesAccepted}
32
+ {...props}
33
+ />
34
+ </div>
35
+ );
36
+ };
37
+
38
+ export default FileUploadCustomDescription;
@@ -0,0 +1 @@
1
+ Sometimes you may want to create a custom description that is easier for users to read. In this case, you can use the `acceptedFilesDescription` prop.
@@ -5,4 +5,5 @@ examples:
5
5
  react:
6
6
  - file_upload_default: Default List of files to upload
7
7
  - file_upload_accept: Accept only certain types of files
8
+ - file_upload_custom_description: Add your one accepted files description
8
9
 
@@ -1,2 +1,3 @@
1
1
  export { default as FileUploadDefault } from './_file_upload_default.jsx'
2
2
  export { default as FileUploadAccept } from './_file_upload_accept.jsx'
3
+ export { default as FileUploadCustomDescription } from './_file_upload_custom_description.jsx'
@@ -1,28 +1,30 @@
1
- /* @flow */
2
1
  /* eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
3
2
  import Highlighter from 'react-highlight-words'
4
3
  import React from 'react'
5
4
  import classnames from 'classnames'
6
- import { globalProps } from '../utilities/globalProps'
5
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
7
6
 
8
7
  type HighlightProps = {
9
8
  className?: string,
10
- data?: string,
9
+ data?: {[key: string]: string},
11
10
  id?: string,
12
- children?: React.Node,
11
+ children?: React.ReactChild[] | string,
13
12
  text?: string,
14
- highlightedText?: array<string>,
15
- }
13
+ highlightedText?: string[],
14
+ } & GlobalProps
16
15
 
17
- const Highlight = (props: HighlightProps) => {
16
+ const Highlight = (props: HighlightProps): React.ReactElement => {
18
17
  const {
19
- className = 'pb_highlight_kit',
20
18
  children,
21
- data,
22
- id,
23
- text,
19
+ className = 'pb_highlight_kit',
20
+ data = {},
24
21
  highlightedText = ['highlight'],
22
+ id = '',
23
+ text = '',
25
24
  } = props
25
+
26
+ const highlightContent: any = text || children;
27
+
26
28
  return (
27
29
  <Highlighter
28
30
  autoEscape
@@ -31,7 +33,7 @@ const Highlight = (props: HighlightProps) => {
31
33
  highlightTag="mark"
32
34
  id={id}
33
35
  searchWords={highlightedText}
34
- textToHighlight={text || children}
36
+ textToHighlight={highlightContent}
35
37
  />
36
38
  )
37
39
  }
@@ -15,11 +15,11 @@ const HighlightDefault = (props) => (
15
15
  {' '}
16
16
  {'Hello this is a'}
17
17
  {' '}
18
- <Highlight>{' highlight wrapped'}</Highlight>
18
+ <Highlight text=" highlight wrapped"/>
19
19
  </Body>
20
20
  <br />
21
21
  <Body
22
- highlightedText={['highlighted in the Body Kit ']}
22
+ highlightedText={['highlighted', 'Body Kit ']}
23
23
  highlighting
24
24
  text="This is text highlighted in the Body Kit using the text prop."
25
25
  {...props}
@@ -2,7 +2,7 @@
2
2
  /*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
3
3
 
4
4
  import React, { forwardRef } from 'react'
5
- import Body from '../pb_body/_body.jsx'
5
+ import Body from '../pb_body/_body'
6
6
  import classnames from 'classnames'
7
7
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
8
  import { globalProps } from '../utilities/globalProps'
@@ -1,5 +1,5 @@
1
1
  //=====================================
2
- // DEPRECIATED COLOR CLASS
2
+ // DEPRICATED COLOR CLASS
3
3
  //
4
4
  // Updated color override classes are generated at:
5
5
  // app/pb_kits/playbook/utilities/_colors.scss
@@ -6,6 +6,14 @@
6
6
  @return mix($bg_dark, $color, $percentage);
7
7
  }
8
8
 
9
+ @function lightenText($color, $threshold: 47) {
10
+ $text_color: $text_lt_default;
11
+ @if ((type-of($color) == color) and (lightness($color) < $threshold)) {
12
+ $text_color: $text_dk_default;
13
+ }
14
+ @return $text_color;
15
+ }
16
+
9
17
  @mixin background-color($colors-list) {
10
18
  @each $name, $color in $colors-list {
11
19
  .#{$name} {
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "10.24.0"
5
- VERSION = "10.25.0.pre.alpha3"
4
+ PREVIOUS_VERSION = "10.25.0"
5
+ VERSION = "10.25.1"
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.25.0.pre.alpha3
4
+ version: 10.25.1
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-04-11 00:00:00.000000000 Z
12
+ date: 2022-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -101,14 +101,14 @@ dependencies:
101
101
  requirements:
102
102
  - - '='
103
103
  - !ruby/object:Gem::Version
104
- version: 2.50.0
104
+ version: 2.48.0
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - '='
110
110
  - !ruby/object:Gem::Version
111
- version: 2.50.0
111
+ version: 2.48.0
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: webpacker-react
114
114
  requirement: !ruby/object:Gem::Requirement
@@ -379,8 +379,8 @@ files:
379
379
  - app/pb_kits/playbook/pb_bar_graph/docs/_description.md
380
380
  - app/pb_kits/playbook/pb_bar_graph/docs/example.yml
381
381
  - app/pb_kits/playbook/pb_bar_graph/docs/index.js
382
- - app/pb_kits/playbook/pb_body/_body.jsx
383
382
  - app/pb_kits/playbook/pb_body/_body.scss
383
+ - app/pb_kits/playbook/pb_body/_body.tsx
384
384
  - app/pb_kits/playbook/pb_body/_body_mixins.scss
385
385
  - app/pb_kits/playbook/pb_body/body.html.erb
386
386
  - app/pb_kits/playbook/pb_body/body.rb
@@ -814,6 +814,8 @@ files:
814
814
  - app/pb_kits/playbook/pb_file_upload/_file_upload.scss
815
815
  - app/pb_kits/playbook/pb_file_upload/docs/_description.md
816
816
  - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
817
+ - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx
818
+ - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.md
817
819
  - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_default.jsx
818
820
  - app/pb_kits/playbook/pb_file_upload/docs/example.yml
819
821
  - app/pb_kits/playbook/pb_file_upload/docs/index.js
@@ -995,8 +997,8 @@ files:
995
997
  - app/pb_kits/playbook/pb_hashtag/docs/index.js
996
998
  - app/pb_kits/playbook/pb_hashtag/hashtag.html.erb
997
999
  - app/pb_kits/playbook/pb_hashtag/hashtag.rb
998
- - app/pb_kits/playbook/pb_highlight/_highlight.jsx
999
1000
  - app/pb_kits/playbook/pb_highlight/_highlight.scss
1001
+ - app/pb_kits/playbook/pb_highlight/_highlight.tsx
1000
1002
  - app/pb_kits/playbook/pb_highlight/docs/_description.md
1001
1003
  - app/pb_kits/playbook/pb_highlight/docs/_footer.md
1002
1004
  - app/pb_kits/playbook/pb_highlight/docs/_highlight_default.html.erb
@@ -2153,7 +2155,7 @@ files:
2153
2155
  - lib/playbook_ui.rb
2154
2156
  homepage: http://playbook.powerapp.cloud
2155
2157
  licenses:
2156
- - MIT
2158
+ - ISC
2157
2159
  metadata: {}
2158
2160
  post_install_message:
2159
2161
  rdoc_options: []
@@ -2166,9 +2168,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
2166
2168
  version: '0'
2167
2169
  required_rubygems_version: !ruby/object:Gem::Requirement
2168
2170
  requirements:
2169
- - - ">"
2171
+ - - ">="
2170
2172
  - !ruby/object:Gem::Version
2171
- version: 1.3.1
2173
+ version: '0'
2172
2174
  requirements: []
2173
2175
  rubygems_version: 3.1.6
2174
2176
  signing_key: