playbook_ui 10.25.0.pre.treeshaking1 → 10.25.0

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: aefb339d6c0b9b986bb10dd16b045f6012cb6b2819ee1d924a1651aa2d4e13fd
4
- data.tar.gz: d658abf6db94843cb077d1a93647c0e0b2b11586eb1a745b922cf1612532e8ab
3
+ metadata.gz: 5787076b1b4c285e67e4c71a89d98b6c78768fb2ed6fb92500a53a9b336eff2b
4
+ data.tar.gz: 9f83e659e948d30274f39cb02b6806c620a7cfa44aaab529481e8a1bd29c1f8f
5
5
  SHA512:
6
- metadata.gz: 0507f95acaa25aeb202b2b801ded2a85f58d88a425b363b9b5906a9497c9ff869cc8b49cd30034d74f455393dca771fe606904b71b5056b89c20b040fd7d39c3
7
- data.tar.gz: b19ca53b6d78eeea25a9098f847ac43f8baf617352d5c5dccc037cf2e196e15abbff9e9050738054c9bd856f1e3c925901fb6efcaca3393223559ae56de98272
6
+ metadata.gz: a8d3751c1bf0bd5fd88870161c5f92ed1437007b3931d422e86206bb46e437aa285d18289817e7304d0ad7cd23b8889c8cbb9b4e51be3e63f316ea817f67bb8e
7
+ data.tar.gz: d64982803deee6c1a08c949ca493d7fc74b4e8b56047190df2d1fc98c1db9922f8a95066cd63897430150da2784ccdddd597af50662a9e0ab818ac83318dce8a
@@ -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}
@@ -1,9 +1,8 @@
1
1
  /* @flow */
2
2
  /*eslint-disable flowtype/space-before-type-colon */
3
3
 
4
- import moment from 'moment'
4
+ import moment from 'moment-timezone'
5
5
  import 'moment-strftime'
6
- import 'moment-timezone'
7
6
 
8
7
  type DateTimeType = {
9
8
  value: String | Date,
@@ -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} {
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "action_view/railtie"
4
4
  require "webpacker/react"
5
+ require "view_component"
5
6
 
6
7
  module Playbook
7
8
  class Engine < ::Rails::Engine
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "10.24.0"
5
- VERSION = "10.25.0.pre.treeshaking1"
5
+ VERSION = "10.25.0"
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.treeshaking1
4
+ version: 10.25.0
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-04 00:00:00.000000000 Z
12
+ date: 2022-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -57,16 +57,16 @@ dependencies:
57
57
  name: react-rails
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: '2.6'
62
+ version: 2.6.1
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: '2.6'
69
+ version: 2.6.1
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: redcarpet
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -99,16 +99,16 @@ dependencies:
99
99
  name: view_component
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - "~>"
102
+ - - '='
103
103
  - !ruby/object:Gem::Version
104
- version: '2.47'
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.47'
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
@@ -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: