playbook_ui 7.1.0 → 7.1.1.pre.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/data/menu.yml +1 -1
  4. data/app/pb_kits/playbook/index.js +1 -0
  5. data/app/pb_kits/playbook/pb_background/_background.html.erb +14 -0
  6. data/app/pb_kits/playbook/pb_background/_background.jsx +64 -0
  7. data/app/pb_kits/playbook/pb_background/_background.scss +15 -0
  8. data/app/pb_kits/playbook/pb_background/background.rb +36 -0
  9. data/app/pb_kits/playbook/pb_background/docs/_background_default.html.erb +41 -0
  10. data/app/pb_kits/playbook/pb_background/docs/_background_default.jsx +75 -0
  11. data/app/pb_kits/playbook/pb_background/docs/example.yml +8 -0
  12. data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
  13. data/lib/playbook/version.rb +1 -1
  14. metadata +12 -18
  15. data/lib/generators/kit/USAGE +0 -5
  16. data/lib/generators/kit/kit_generator.rb +0 -95
  17. data/lib/generators/kit/templates/kit_example_rails.erb.tt +0 -1
  18. data/lib/generators/kit/templates/kit_example_react.erb.tt +0 -10
  19. data/lib/generators/kit/templates/kit_example_yml.erb.tt +0 -9
  20. data/lib/generators/kit/templates/kit_html.erb.tt +0 -7
  21. data/lib/generators/kit/templates/kit_js.erb.tt +0 -1
  22. data/lib/generators/kit/templates/kit_jsx.erb.tt +0 -68
  23. data/lib/generators/kit/templates/kit_ruby.erb.tt +0 -11
  24. data/lib/generators/kit/templates/kit_ruby_spec.erb.tt +0 -11
  25. data/lib/generators/kit/templates/kit_scss.erb +0 -3
  26. data/lib/tasks/changelog.rake +0 -14
  27. data/lib/tasks/pb_release.rake +0 -88
  28. data/lib/tasks/playbook_tasks.rake +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f444fe64c94fe52134b58d54feab40314cc5c10a273dca136a837dd4f32bdae2
4
- data.tar.gz: 242b3eb07882d6e290cd1784e1916b129a4d65d3a49119bea18ac09f96890460
3
+ metadata.gz: 595c0820f16b2b3e0946f41382f7a3668b23852960c36a3e910f7a220dc4681a
4
+ data.tar.gz: 39a721f24fa92d169e229c89920d12603c6758fc462633336fb105cce690c6c2
5
5
  SHA512:
6
- metadata.gz: 295ff9b7e1d2612ea7a405e40241869d5ee31e2762961a32edb0ddb6443407d514929148c719e7c68a78bf62f9736e8520c22afc055aae15abd375be4eaa0a0e
7
- data.tar.gz: 66d67a743c7c465f8b68ae80f55b0438d196713ec917c9fcd104988f7969814f13c89af20f0fa9e84d5bde3dd5118a93e8638fcb6bd2eb32d2c9012ef98da614
6
+ metadata.gz: 825198798b8e0409757b0fc9cbca50e78cc7181cbfce089d986b086dd9ecd91e292f30d16b0c461e49010845d2451b946e5a916e5b36cb72793cba55b5c83e2a
7
+ data.tar.gz: da7db430a98af504a913692fa19aa894968b0bc8f9eb8e70fe06fc39cf143ff650ebd896e1a27a3a041146405c2e805028811224fdfe14347d875b27cbd1ef69
@@ -83,3 +83,4 @@
83
83
  @import 'pb_time_stacked/time_stacked';
84
84
  @import 'pb_weekday_stacked/weekday_stacked';
85
85
  @import './utilities/spacing';
86
+
@@ -7,6 +7,7 @@ samples:
7
7
  kits:
8
8
  - avatar
9
9
  - avatar_action_button
10
+ - background
10
11
  - buttons:
11
12
  - button
12
13
  - button_toolbar
@@ -20,7 +21,6 @@ kits:
20
21
  - gauge
21
22
  - legend
22
23
  - line_graph
23
-
24
24
  - filter
25
25
  - fixed_confirmation_toast
26
26
  - flex
@@ -5,6 +5,7 @@ import 'lazysizes'
5
5
  // React Component JSX Imports from the React Kits
6
6
  export Avatar from './pb_avatar/_avatar.jsx'
7
7
  export AvatarActionButton from './pb_avatar_action_button/_avatar_action_button.jsx'
8
+ export Background from 'pb_background/_background.jsx'
8
9
  export Badge from './pb_badge/_badge.jsx'
9
10
  export BarGraph from './pb_bar_graph/_bar_graph.jsx'
10
11
  export Body from './pb_body/_body.jsx'
@@ -0,0 +1,14 @@
1
+ <%= content_tag(object.tag,
2
+ aria: object.aria,
3
+ data: object.data,
4
+ id: object.id) do %>
5
+ <% if object.image_url.present? %>
6
+ <div class="<%= object.classname %>" style="background-image: url(<%= object.image_url %>); background-size: cover">
7
+ <%= capture(&object.children) %>
8
+ </div>
9
+ <% else %>
10
+ <div class="<%= object.classname %>">
11
+ <%= capture(&object.children) %>
12
+ </div>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,64 @@
1
+ /* @flow */
2
+
3
+ import React from 'react'
4
+ import classnames from 'classnames'
5
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
+ import { globalProps } from '../utilities/globalProps.js'
7
+
8
+ type BackgroundProps = {
9
+ aria?: object,
10
+ backgroundColor?: 'gradient' | 'dark' | 'light' | 'white',
11
+ children?: array<React.ReactNode> | React.ReactNode,
12
+ className?: string,
13
+ data?: object,
14
+ id?: string,
15
+ imageUrl?: string,
16
+ padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
17
+ tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
18
+ }
19
+
20
+ const Background = (props: BackgroundProps) => {
21
+ const {
22
+ aria = {},
23
+ backgroundColor = 'light',
24
+ children,
25
+ className,
26
+ data = {},
27
+ id,
28
+ imageUrl = '',
29
+ padding = 'md',
30
+ tag = 'div',
31
+ } = props
32
+
33
+ const ariaProps = buildAriaProps(aria)
34
+ const dataProps = buildDataProps(data)
35
+ const classes = classnames(buildCss('pb_background_kit'), className, globalProps(props, { padding }))
36
+ const Tag = `${tag}`
37
+ const backgroundStyle = {
38
+ backgroundImage: `url(${imageUrl})`,
39
+ backgroundSize: 'cover',
40
+ }
41
+
42
+ return (
43
+ <Tag
44
+ {...ariaProps}
45
+ {...dataProps}
46
+ id={id}
47
+ >
48
+ <If condition={imageUrl}>
49
+ <div
50
+ className={classes + 'lazyload blur_up'}
51
+ style={backgroundStyle}
52
+ >
53
+ { children }
54
+ </div>
55
+ <Else />
56
+ <div className={classes + `bg_${backgroundColor}`}>
57
+ { children }
58
+ </div>
59
+ </If>
60
+ </Tag>
61
+ )
62
+ }
63
+
64
+ export default Background
@@ -0,0 +1,15 @@
1
+ [class^=pb_background_kit] {
2
+ max-width: 100%;
3
+ max-height: 100%;
4
+
5
+ .blur_up {
6
+ -webkit-filter: blur(6px);
7
+ filter: blur(6px);
8
+ transition: filter 550ms, -webkit-filter 550ms;
9
+ }
10
+
11
+ .blur_up.lazyloaded {
12
+ -webkit-filter: blur(0);
13
+ filter: blur(0);
14
+ }
15
+ }
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbBackground
5
+ class Background
6
+ include Playbook::Props
7
+
8
+ partial "pb_background/background"
9
+
10
+ prop :background_color, type: Playbook::Props::Enum,
11
+ values: %w[gradient dark light white],
12
+ default: "light"
13
+ prop :image_url
14
+ prop :padding, type: Playbook::Props::Enum,
15
+ values: %w[none xs sm md lg xl],
16
+ default: "md"
17
+ prop :tag, type: Playbook::Props::Enum,
18
+ values: %w[h1 h2 h3 h4 h5 h6 p div span],
19
+ default: "div"
20
+
21
+ def classname
22
+ generate_classname("pb_background_kit", image_classname, background_color_classname, padding, separator: " ")
23
+ end
24
+
25
+ private
26
+
27
+ def image_classname
28
+ image_url.present? ? "lazyload blur_up" : ""
29
+ end
30
+
31
+ def background_color_classname
32
+ !image_url.present? ? "bg_#{background_color}" : ""
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,41 @@
1
+ <%= pb_rails("background", props: { background_color: "gradient" }) do %>
2
+ Background Kit Gradient Color
3
+ <% end %>
4
+
5
+ <%= pb_rails("background", props: { background_color: "dark" }) do %>
6
+ <%= pb_rails("flex", props: { horizontal: "center"}) do %>
7
+ <%= pb_rails("flex/flex_item") do %>
8
+ <%= pb_rails("title", props: { dark: true, size: 2, text: "Background Kit Dark" })%>
9
+ <% end %>
10
+ <% end %>
11
+ <% end %>
12
+
13
+ <%= pb_rails("background", props: { background_color: "light", padding: "xl" }) do %>
14
+ <%= pb_rails("flex", props: { horizontal: "right"}) do %>
15
+ <%= pb_rails("flex/flex_item") do %>
16
+ <%= pb_rails("body", props: { text: "Background Kit Light" })%>
17
+ <% end %>
18
+ <% end %>
19
+ <% end %>
20
+
21
+ <%= pb_rails("background", props: { background_color: "white", padding: "lg" }) do %>
22
+ <%= pb_rails("flex") do %>
23
+ <%= pb_rails("flex/flex_item") do %>
24
+ <%= pb_rails("title", props: { size: 3, text: "Background Kit White" })%>
25
+ <% end %>
26
+ <% end %>
27
+ <% end %>
28
+
29
+ <%= 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 %>
30
+ <%= pb_rails("flex", props: { horizontal: "center", orientation: "column" }) do %>
31
+ <%= pb_rails("flex/flex_item") do %>
32
+ <%= pb_rails("title", props: { dark: true, size: 1, text: "Background Kit Image" })%>
33
+ <% end %>
34
+ <%= pb_rails("flex/flex_item", props: { padding: "lg" }) do %>
35
+ <%= pb_rails("card", props: { shadow: "deepest" }) do %>
36
+ 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.
37
+ -Cesar Chavez
38
+ <% end %>
39
+ <% end %>
40
+ <% end %>
41
+ <% end %>
@@ -0,0 +1,75 @@
1
+ import React from 'react'
2
+ import { Background } from '../../'
3
+ import { Body, Card, Flex, FlexItem, Title } from '../../'
4
+
5
+ const BackgroundDefault = () => (
6
+ <div>
7
+ <Background
8
+ backgroundColor="gradient"
9
+ >
10
+ {'Background Kit Gradient Color'}
11
+ </Background>
12
+ <Background
13
+ backgroundColor="dark"
14
+ >
15
+ <Flex
16
+ horizontal="center"
17
+ orientation="row"
18
+ >
19
+ <FlexItem>
20
+ <Title
21
+ dark
22
+ size={2}
23
+ text="Background Kit Dark"
24
+ />
25
+ </FlexItem>
26
+ </Flex>
27
+ </Background>
28
+ <Background
29
+ backgroundColor="light"
30
+ padding="xl"
31
+ >
32
+ <Flex
33
+ horizontal="right"
34
+ orientation="row"
35
+ >
36
+ <FlexItem>
37
+ <Body
38
+ text="Background Kit Light"
39
+ />
40
+ </FlexItem>
41
+ </Flex>
42
+ </Background>
43
+ <Background
44
+ backgroundColor="white"
45
+ padding="lg"
46
+ >
47
+ <Title
48
+ size={3}
49
+ text="Background Kit White"
50
+ />
51
+ </Background>
52
+ <Background imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80">
53
+ <Flex
54
+ orientation="column"
55
+ vertical="center"
56
+ >
57
+ <FlexItem>
58
+ <Title
59
+ dark
60
+ padding="lg"
61
+ size={1}
62
+ text="Background Kit Image"
63
+ />
64
+ </FlexItem>
65
+ <FlexItem padding="lg">
66
+ <Card shadow="deepest">
67
+ {'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'}
68
+ </Card>
69
+ </FlexItem>
70
+ </Flex>
71
+ </Background>
72
+ </div>
73
+ )
74
+
75
+ export default BackgroundDefault
@@ -0,0 +1,8 @@
1
+ examples:
2
+
3
+ rails:
4
+ - background_default: Default
5
+
6
+ react:
7
+ - background_default: Default
8
+
@@ -0,0 +1 @@
1
+ export { default as BackgroundDefault } from './_background_default.jsx'
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Playbook
3
- VERSION = "7.1.0"
3
+ VERSION = "7.1.1.pre.alpha1"
4
4
  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: 7.1.0
4
+ version: 7.1.1.pre.alpha1
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: 2020-10-09 00:00:00.000000000 Z
12
+ date: 2020-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -445,6 +445,14 @@ files:
445
445
  - app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb
446
446
  - app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml
447
447
  - app/pb_kits/playbook/pb_avatar_action_button/docs/index.js
448
+ - app/pb_kits/playbook/pb_background/_background.html.erb
449
+ - app/pb_kits/playbook/pb_background/_background.jsx
450
+ - app/pb_kits/playbook/pb_background/_background.scss
451
+ - app/pb_kits/playbook/pb_background/background.rb
452
+ - app/pb_kits/playbook/pb_background/docs/_background_default.html.erb
453
+ - app/pb_kits/playbook/pb_background/docs/_background_default.jsx
454
+ - app/pb_kits/playbook/pb_background/docs/example.yml
455
+ - app/pb_kits/playbook/pb_background/docs/index.js
448
456
  - app/pb_kits/playbook/pb_badge/_badge.html.erb
449
457
  - app/pb_kits/playbook/pb_badge/_badge.jsx
450
458
  - app/pb_kits/playbook/pb_badge/_badge.scss
@@ -1836,24 +1844,10 @@ files:
1836
1844
  - app/pb_kits/playbook/vendor.js
1837
1845
  - fonts/fontawesome-min.js
1838
1846
  - fonts/regular-min.js
1839
- - lib/generators/kit/USAGE
1840
- - lib/generators/kit/kit_generator.rb
1841
- - lib/generators/kit/templates/kit_example_rails.erb.tt
1842
- - lib/generators/kit/templates/kit_example_react.erb.tt
1843
- - lib/generators/kit/templates/kit_example_yml.erb.tt
1844
- - lib/generators/kit/templates/kit_html.erb.tt
1845
- - lib/generators/kit/templates/kit_js.erb.tt
1846
- - lib/generators/kit/templates/kit_jsx.erb.tt
1847
- - lib/generators/kit/templates/kit_ruby.erb.tt
1848
- - lib/generators/kit/templates/kit_ruby_spec.erb.tt
1849
- - lib/generators/kit/templates/kit_scss.erb
1850
1847
  - lib/playbook.rb
1851
1848
  - lib/playbook/engine.rb
1852
1849
  - lib/playbook/version.rb
1853
1850
  - lib/playbook_ui.rb
1854
- - lib/tasks/changelog.rake
1855
- - lib/tasks/pb_release.rake
1856
- - lib/tasks/playbook_tasks.rake
1857
1851
  homepage: http://playbook.powerapp.cloud
1858
1852
  licenses:
1859
1853
  - MIT
@@ -1869,9 +1863,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1869
1863
  version: '0'
1870
1864
  required_rubygems_version: !ruby/object:Gem::Requirement
1871
1865
  requirements:
1872
- - - ">="
1866
+ - - ">"
1873
1867
  - !ruby/object:Gem::Version
1874
- version: '0'
1868
+ version: 1.3.1
1875
1869
  requirements: []
1876
1870
  rubygems_version: 3.1.4
1877
1871
  signing_key:
@@ -1,5 +0,0 @@
1
- Description:
2
- Create a new Playbook kit
3
-
4
- Example:
5
- rails g kit "button"
@@ -1,95 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class KitGenerator < Rails::Generators::NamedBase
4
- desc "This generator creates a new Playbook Kit"
5
- source_root File.expand_path("templates", __dir__)
6
- class_option :props, type: :array, default: []
7
-
8
- def create_templates
9
- kit_name = name.strip.downcase
10
- @kit_name_uppercase = kit_name.upcase
11
- @kit_name_lowercase = kit_name
12
- @kit_name_capitalize = kit_name.capitalize
13
- @kit_name_underscore = kit_name.parameterize.underscore
14
- @kit_name_pascal = kit_name.titleize.gsub(/\s+/, "")
15
-
16
- kit_props = options[:props].concat(%w[id:string classname:string data:object aria:object])
17
- @kit_props = kit_props.map { |hash| [hash.partition(":").first, hash.partition(":").last] }.to_h
18
- @kit_props = @kit_props.sort.to_h
19
- @unique_props = @kit_props.symbolize_keys.without(:id, :classname, :data, :aria)
20
-
21
- @kit_class_init = []
22
- @kit_props.each do |key, _val|
23
- @kit_class_init.push("#{key.parameterize.underscore}: default_configuration".to_sym)
24
- end
25
-
26
- @kit_class_val = []
27
- @kit_props.each do |key, _value|
28
- @kit_class_val.push("self.configured_#{key.parameterize.underscore} = #{key.parameterize.underscore}")
29
- end
30
-
31
- full_kit_directory = "app/pb_kits/playbook/pb_#{@kit_name_underscore}"
32
-
33
- # Check if kit already exists =======================
34
- if File.directory?(full_kit_directory)
35
- say_status "#{@kit_name_capitalize} kit already exists.",
36
- "Please choose another name or manually make changes to the existing kit.",
37
- :red
38
- return
39
- else
40
- # Add kit to Playbook menu ==========================
41
- open("app/pb_kits/playbook/data/menu.yml", "a") do |f|
42
- f.puts " - #{@kit_name_underscore}"
43
- end
44
- say_status "complete",
45
- "#{@kit_name_capitalize} kit added to Playbook menu.",
46
- :green
47
-
48
- # Generate SCSS files ==============================
49
- template "kit_scss.erb", "#{full_kit_directory}/_#{@kit_name_underscore}.scss"
50
- open("app/pb_kits/playbook/_playbook.scss", "a") do |f|
51
- f.puts "\n@" + "import " + "\'" + "pb_#{@kit_name_underscore}/#{@kit_name_underscore}" + "\';"
52
- end
53
- say_status "complete",
54
- "#{@kit_name_capitalize} kit stylesheet successfully created and imported.",
55
- :green
56
-
57
- # Ask user if Rails version should be generated ======
58
- if yes?("Create RAILS #{@kit_name_underscore} kit? (y/N)")
59
- @rails_kit = true
60
- template "kit_ruby.erb", "#{full_kit_directory}/#{@kit_name_underscore}.rb"
61
- template "kit_html.erb", "#{full_kit_directory}/_#{@kit_name_underscore}.html.erb"
62
- template "kit_example_rails.erb", "#{full_kit_directory}/docs/_#{@kit_name_underscore}_default.html.erb"
63
- template "kit_ruby_spec.erb", "spec/pb_kits/playbook/kits/#{@kit_name_underscore}_spec.rb"
64
- say_status "complete",
65
- "#{@kit_name_capitalize} rails kit successfully created.",
66
- :green
67
- end
68
-
69
- # Ask user if React version should be generated ======
70
- if yes?("Create REACT #{@kit_name_pascal} kit? (y/N)")
71
- @react_kit = true
72
- template "kit_jsx.erb", "#{full_kit_directory}/_#{@kit_name_underscore}.jsx"
73
- template "kit_example_react.erb", "#{full_kit_directory}/docs/_#{@kit_name_underscore}_default.jsx"
74
- template "kit_js.erb", "#{full_kit_directory}/docs/index.js"
75
-
76
- # Import kit examples ===========================
77
- append_to_file("app/pb_kits/playbook/packs/react-examples.js") do
78
- "import * as #{@kit_name_pascal} from 'pb_#{@kit_name_underscore}/docs'\nWebpackerReact.setup(#{@kit_name_pascal})\n"
79
- end
80
- append_to_file("app/pb_kits/playbook/index.js") do
81
- "\nexport #{@kit_name_pascal} from 'pb_#{@kit_name_underscore}/_#{@kit_name_underscore}.jsx'"
82
- end
83
-
84
- say_status "complete",
85
- "#{@kit_name_capitalize} react kit successfully created.",
86
- :green
87
- end
88
-
89
- # Create kit example.yml
90
- template "kit_example_yml.erb", "#{full_kit_directory}/docs/example.yml"
91
-
92
- `rubocop --safe-auto-correct #{full_kit_directory}`
93
- end
94
- end
95
- end
@@ -1 +0,0 @@
1
- <%%= pb_rails("<%= @kit_name_underscore %>") %>
@@ -1,10 +0,0 @@
1
- import React from 'react'
2
- import { <%= @kit_name_pascal %> } from '../../'
3
-
4
- const <%= @kit_name_pascal %>Default = () => (
5
- <div>
6
- <<%= @kit_name_pascal %> />
7
- </div>
8
- )
9
-
10
- export default <%= @kit_name_pascal %>Default
@@ -1,9 +0,0 @@
1
- examples:
2
- <% if @rails_kit %>
3
- rails:
4
- - <%= @kit_name_underscore %>_default: Default
5
- <% end %>
6
- <% if @react_kit %>
7
- react:
8
- - <%= @kit_name_underscore %>_default: Default
9
- <% end %>
@@ -1,7 +0,0 @@
1
- <%%= content_tag(:div,
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id) do %>
6
- <span><%= @kit_name_uppercase %> CONTENT</span>
7
- <%% end %>
@@ -1 +0,0 @@
1
- export { default as <%= @kit_name_pascal %>Default } from './_<%= @kit_name_underscore %>_default.jsx'
@@ -1,68 +0,0 @@
1
- <%
2
- break_lines = lambda do |list, spaces = 2, separator = ","|
3
- list.join("#{separator}\n#{" " * spaces}") + separator
4
- end
5
-
6
- type_name = "#{@kit_name_pascal}Props"
7
-
8
- props_types = @kit_props.map do |key, val|
9
- prop_name = key == "classname" ? "className" : key.camelize(:lower)
10
- prop_type = case val
11
- when "enum", "one_of" then "'option_1' | 'option_2'"
12
- when "boolean", "bool" then "boolean"
13
- when "object", "obj" then "object"
14
- else "string"
15
- end
16
-
17
- "#{prop_name}?: #{prop_type}"
18
- end
19
- puts props_types.inspect
20
-
21
- props_names = @kit_props.keys.map do |key|
22
- case key
23
- when "classname" || "className"
24
- "className"
25
- when "aria"
26
- "aria = {}"
27
- when "data"
28
- "data = {}"
29
- else
30
- key
31
- end
32
- end
33
-
34
- %>
35
-
36
- /* @flow */
37
-
38
- import React from 'react'
39
- import classnames from 'classnames'
40
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
41
- import { globalProps } from '../utilities/globalProps.js'
42
-
43
- type <%= type_name %> = {
44
- <%= break_lines.call(props_types) %>
45
- }
46
-
47
- const <%= @kit_name_pascal %> = (props: <%= type_name %>) => {
48
- const {
49
- <%= break_lines.call(props_names) %>
50
- } = props
51
-
52
- const ariaProps = buildAriaProps(aria)
53
- const dataProps = buildDataProps(data)
54
- const classes = classnames(buildCss('pb_<%= @kit_name_underscore %>'), globalProps(props), className)
55
-
56
- return (
57
- <div
58
- {...ariaProps}
59
- {...dataProps}
60
- className={classes}
61
- id={id}
62
- >
63
- {className}
64
- </div>
65
- )
66
- }
67
-
68
- export default <%= @kit_name_pascal %>
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Playbook
4
- module Pb<%= @kit_name_pascal %>
5
- class <%= @kit_name_pascal %>
6
- include Playbook::Props
7
-
8
- partial "<%= "pb_#{@kit_name_underscore}/#{@kit_name_underscore}" %>"
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../../../app/pb_kits/playbook/pb_<%= @kit_name_underscore %>/<%= @kit_name_underscore %>"
4
-
5
- RSpec.describe Playbook::Pb<%= @kit_name_capitalize %>::<%= @kit_name_capitalize %> do
6
- subject { Playbook::Pb<%= @kit_name_capitalize %>::<%= @kit_name_capitalize %> }
7
-
8
- it { is_expected.to define_partial }
9
-
10
- # Do not leave this file blank. Use other spec files for example tests.
11
- end
@@ -1,3 +0,0 @@
1
- <%= ".pb_#{@kit_name_underscore}" %> {
2
-
3
- }
@@ -1,14 +0,0 @@
1
- require 'github_changelog_generator/task'
2
-
3
- GitHubChangelogGenerator::RakeTask.new :changelog do |config|
4
- config.user = 'powerhome'
5
- config.project = 'playbook'
6
- config.since_tag = Playbook::VERSION
7
- config.header = ''
8
- config.issues = false
9
- config.base = 'CHANGELOG.md'
10
- config.enhancement_prefix = '**Kit Enhancements:**'
11
- config.bug_prefix = '**Fixed Bugs:**'
12
- config.max_issues = 75
13
- config.add_sections = {"New Kits":{"prefix":"**New Kits:**","labels":["new kit"]},"Improvements": {"prefix":"**Improvements:**","labels":["improvement"]},"Breaking": {"prefix":"**Breaking Changes:**","labels":["breaking"]}}
14
- end
@@ -1,88 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- namespace :pb_release do
4
- desc "Update the version number in preparation to release"
5
- task version: :environment do
6
- puts "\n"
7
- puts "*" * 20 + " Create New Playbook Release " + "*" * 20
8
- ack = "\nFirst, before creating a new version please make sure you are familiar with SemVer guidlines: "
9
- ack += "\nhttps://semver.org/#semantic-versioning-specification-semver. "
10
- ack += "\n\nDoing so will ensure the proper version is selected for the release. "
11
- ack += "\nSee also: https://github.com/powerhome/playbook/wiki/Releasing-a-New-Version#determining-the-version."
12
- ack += "\n\nReady to start? y/N"
13
- STDOUT.puts ack
14
- agreed = STDIN.gets.chomp.downcase
15
-
16
- if agreed == "y"
17
- old_version = Playbook::VERSION
18
- STDOUT.puts "What would you like the next release number to be? Currently #{old_version}"
19
- new_version = STDIN.gets.chomp
20
- puts "Ok great, let's make version #{new_version}"
21
- puts "\n\n"
22
-
23
- # Update package.json
24
- package = File.read("package.json")
25
- new_package = package.gsub(/"version": "#{old_version}",/, "\"version\": \"#{new_version}\",")
26
- File.open("package.json", "w") { |file| file.puts new_package }
27
- puts "Updated package.json"
28
-
29
- # Update version.rb
30
- version_rb = File.read("lib/playbook/version.rb")
31
- new_version_rb = version_rb.gsub(/VERSION = "#{old_version}".freeze/, "VERSION = \"#{new_version}\".freeze")
32
- File.open("lib/playbook/version.rb", "w") { |file| file.puts new_version_rb }
33
- puts "Updated lib/playbook/version.rb"
34
-
35
- # Update gemfile.lock
36
- gemfile = File.read("Gemfile.lock")
37
- new_gemfile = gemfile.gsub(/playbook_ui \(#{Regexp.escape(old_version)}\)/, "playbook_ui (#{new_version})")
38
- File.open("Gemfile.lock", "w") { |file| file.puts new_gemfile }
39
- puts "Updated Gemfile.lock"
40
- puts "\n\n"
41
-
42
- puts "\nCreating dist files"
43
- `yarn release`
44
-
45
- puts "Commit your changes and create a PR to merge to master"
46
- end
47
- end
48
-
49
- desc "Publish to RubyGems, NPM, and Create a Tag"
50
- task push: :environment do
51
- version = Playbook::VERSION
52
- puts "You about to release version #{version}. Is that correct? (y/N)"
53
- input = STDIN.gets.chomp
54
- raise Nope unless input.downcase == "y"
55
-
56
- # RubyGems
57
- puts "\nCreating Gem..."
58
- `gem build playbook_ui.gemspec`
59
- puts "\nPushing to RubyGems..."
60
- `gem push playbook_ui-#{version}.gem`
61
- puts "\nPushed to RubyGems. Now lets clean up..."
62
- `rm -rf playbook_ui-*.gem`
63
-
64
- # NPM
65
- puts "\nGenerating distribution files"
66
- `docker-compose run web yarn release`
67
- puts "\nOrganizing distribution files"
68
- `rm dist/playbook-rails.css && mv dist/playbook-react.css dist/playbook.css`
69
- puts "\nCreating NPM package..."
70
- `npm pack`
71
- puts "\nPublishing to NPM..."
72
- `npm publish playbook-ui-#{version}.tgz`
73
- puts "\nPublished to NPM. Now lets clean up..."
74
- `rm -rf playbook-ui-*.tgz`
75
-
76
- # Tags
77
- puts "\nPushed to NPM. Now lets create a tag..."
78
- puts "\nWrite a brief tag release description. You can edit this later on GitHub."
79
- description = STDIN.gets.chomp
80
- puts "\nCreating Tag..."
81
- `git tag -a #{version} -m "#{description}"`
82
- puts "\nPushing Tag to GitHub..."
83
- `git push origin #{version}`
84
-
85
- puts "\n\n"
86
- puts "Complete! Don't forget to add your release notes https://github.com/powerhome/playbook/releases/tag/#{version}"
87
- end
88
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "webpacker"
4
-
5
- namespace :playbook do
6
- namespace :webpacker do
7
- desc "Install deps with yarn"
8
- task :yarn_install do
9
- Dir.chdir(File.join(__dir__, "../..")) do
10
- system "yarn install --no-progress --production"
11
- end
12
- end
13
-
14
- desc "Compile JavaScript packs using webpack for production with digests"
15
- task compile: %i[yarn_install environment] do
16
- ::Webpacker.with_node_env("production") do
17
- if Playbook.webpacker.commands.compile
18
- # Successful compilation!
19
- else
20
- # Failed compilation
21
- exit!
22
- end
23
- end
24
- end
25
- end
26
- end