playbook_ui 2.9.0 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/helpers/playbook/pb_doc_helper.rb +5 -1
  4. data/app/pb_kits/playbook/index.js +73 -0
  5. data/app/pb_kits/playbook/packs/examples.js +24 -0
  6. data/app/pb_kits/playbook/packs/kits.js +8 -0
  7. data/app/pb_kits/playbook/packs/pb_badge.js +4 -0
  8. data/app/pb_kits/playbook/packs/pb_checkbox.js +4 -0
  9. data/app/pb_kits/playbook/packs/pb_date_range_inline.js +4 -0
  10. data/app/pb_kits/playbook/packs/pb_date_year_stacked.js +4 -0
  11. data/app/pb_kits/playbook/packs/pb_distribution_bar.js +4 -0
  12. data/app/pb_kits/playbook/packs/pb_fixed_confirmation_toast.js +4 -0
  13. data/app/pb_kits/playbook/packs/pb_home_address_street.js +4 -0
  14. data/app/pb_kits/playbook/packs/pb_loading_inline.js +4 -0
  15. data/app/pb_kits/playbook/packs/site_styles/_kit_style_index.scss +8 -0
  16. data/app/pb_kits/playbook/pb_badge/_badge.html.erb +6 -0
  17. data/app/pb_kits/playbook/pb_badge/_badge.jsx +34 -0
  18. data/app/pb_kits/playbook/pb_badge/_badge.scss +37 -0
  19. data/app/pb_kits/playbook/pb_badge/badge.rb +65 -0
  20. data/app/pb_kits/playbook/pb_badge/docs/_badge_colors.html.erb +107 -0
  21. data/app/pb_kits/playbook/pb_badge/docs/_badge_colors.jsx +82 -0
  22. data/app/pb_kits/playbook/pb_badge/docs/_badge_default.html.erb +16 -0
  23. data/app/pb_kits/playbook/pb_badge/docs/_badge_default.jsx +20 -0
  24. data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded.html.erb +19 -0
  25. data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded.jsx +20 -0
  26. data/app/pb_kits/playbook/pb_badge/docs/example.yml +10 -0
  27. data/app/pb_kits/playbook/pb_badge/docs/index.js +3 -0
  28. data/app/pb_kits/playbook/pb_caption/_caption.html.erb +1 -1
  29. data/app/pb_kits/playbook/pb_caption/_caption.scss +2 -2
  30. data/app/pb_kits/playbook/pb_caption/caption.rb +24 -56
  31. data/app/pb_kits/playbook/pb_checkbox/_checkbox.html.erb +10 -0
  32. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +42 -0
  33. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +66 -0
  34. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +94 -0
  35. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_dark.html.erb +1 -0
  36. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_default.html.erb +1 -0
  37. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_default.jsx +17 -0
  38. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +8 -0
  39. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  40. data/app/pb_kits/playbook/pb_date/date.rb +14 -23
  41. data/app/pb_kits/playbook/pb_date/docs/_date_default.html.erb +3 -3
  42. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.html.erb +22 -0
  43. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx +54 -0
  44. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss +3 -0
  45. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.rb +55 -0
  46. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default.html.erb +1 -0
  47. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default.jsx +12 -0
  48. data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +9 -0
  49. data/app/pb_kits/playbook/pb_date_range_inline/docs/index.js +1 -0
  50. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.html.erb +7 -0
  51. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.jsx +51 -0
  52. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.scss +17 -0
  53. data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.rb +75 -0
  54. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_dark.html.erb +5 -0
  55. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_dark.jsx +14 -0
  56. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default.html.erb +5 -0
  57. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default.jsx +14 -0
  58. data/app/pb_kits/playbook/pb_date_year_stacked/docs/example.yml +9 -0
  59. data/app/pb_kits/playbook/pb_date_year_stacked/docs/index.js +2 -0
  60. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.html.erb +8 -0
  61. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +52 -0
  62. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.scss +31 -0
  63. data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.rb +56 -0
  64. data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_default.html.erb +9 -0
  65. data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_default.jsx +24 -0
  66. data/app/pb_kits/playbook/pb_distribution_bar/docs/example.yml +9 -0
  67. data/app/pb_kits/playbook/pb_distribution_bar/docs/index.js +1 -0
  68. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.html.erb +7 -0
  69. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +58 -0
  70. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +27 -0
  71. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default.html.erb +18 -0
  72. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default.jsx +26 -0
  73. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +9 -0
  74. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  75. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +74 -0
  76. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.html.erb +25 -0
  77. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +64 -0
  78. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.scss +20 -0
  79. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_dark.html.erb +9 -0
  80. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_dark.jsx +18 -0
  81. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +8 -0
  82. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.jsx +17 -0
  83. data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +11 -0
  84. data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +2 -0
  85. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +80 -0
  86. data/app/pb_kits/playbook/pb_kit/dateTime.js +45 -0
  87. data/app/pb_kits/playbook/pb_kit/pb_date_time.rb +68 -0
  88. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.html.erb +6 -0
  89. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.jsx +31 -0
  90. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.scss +19 -0
  91. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_dark.html.erb +13 -0
  92. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_dark.jsx +14 -0
  93. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_light.html.erb +9 -0
  94. data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_light.jsx +14 -0
  95. data/app/pb_kits/playbook/pb_loading_inline/docs/example.yml +11 -0
  96. data/app/pb_kits/playbook/pb_loading_inline/docs/index.js +2 -0
  97. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +67 -0
  98. data/app/pb_kits/playbook/pb_time/docs/_time_default.html.erb +3 -3
  99. data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.html.erb +3 -3
  100. data/app/pb_kits/playbook/pb_time/time.rb +16 -29
  101. data/app/pb_kits/playbook/pb_toggle/toggle.rb +2 -0
  102. data/app/pb_kits/playbook/props.rb +45 -0
  103. data/app/pb_kits/playbook/props/base.rb +27 -0
  104. data/app/pb_kits/playbook/props/boolean.rb +11 -0
  105. data/app/pb_kits/playbook/props/enum.rb +16 -0
  106. data/app/pb_kits/playbook/props/hash.rb +11 -0
  107. data/app/pb_kits/playbook/props/string.rb +8 -0
  108. data/app/pb_kits/playbook/tokens/_colors.scss +2 -1
  109. data/app/pb_kits/playbook/tokens/_transition.scss +1 -0
  110. data/lib/playbook/engine.rb +0 -1
  111. data/lib/playbook/version.rb +1 -1
  112. metadata +148 -22
  113. data/app/pb_kits/playbook/packs/index.js +0 -67
  114. data/lib/tasks/db.rake +0 -10
  115. data/stories/basic.js +0 -18
  116. data/stories/complex.js +0 -15
  117. data/stories/form.js +0 -2
  118. data/stories/index.js +0 -29
@@ -0,0 +1,5 @@
1
+ <%= pb_rails "date_year_stacked", props: { date: Date.today, dark: true } %>
2
+ <br><br>
3
+ <%= pb_rails "date_year_stacked", props: { date: Date.today, align: 'center', dark: true } %>
4
+ <br><br>
5
+ <%= pb_rails "date_year_stacked", props: { date: Date.today, align: 'right', dark: true } %>
@@ -0,0 +1,14 @@
1
+ import React from "react"
2
+ import { DateYearStacked } from "../../"
3
+
4
+ function DateYearStackedDark() {
5
+ return (
6
+ <div>
7
+ <DateYearStacked date={new Date() } dark />
8
+ <DateYearStacked align='center' date={new Date() } dark />
9
+ <DateYearStacked align='right' date={new Date() } dark />
10
+ </div>
11
+ )
12
+ }
13
+
14
+ export default DateYearStackedDark
@@ -0,0 +1,5 @@
1
+ <%= pb_rails "date_year_stacked", props: { date: Date.today } %>
2
+ <br><br>
3
+ <%= pb_rails "date_year_stacked", props: { date: Date.today, align: 'center'} %>
4
+ <br><br>
5
+ <%= pb_rails "date_year_stacked", props: { date: Date.today, align: 'right'} %>
@@ -0,0 +1,14 @@
1
+ import React from "react"
2
+ import { DateYearStacked } from "../../"
3
+
4
+ function DateYearStackedDefault() {
5
+ return (
6
+ <div>
7
+ <DateYearStacked date={new Date() } />
8
+ <DateYearStacked align='center' date={new Date() } />
9
+ <DateYearStacked align='right' date={new Date() } />
10
+ </div>
11
+ )
12
+ }
13
+
14
+ export default DateYearStackedDefault;
@@ -0,0 +1,9 @@
1
+ examples:
2
+
3
+ rails:
4
+ - date_year_stacked_default: Default
5
+ - date_year_stacked_dark: Dark
6
+
7
+ react:
8
+ - date_year_stacked_default: Default
9
+ - date_year_stacked_dark: Dark
@@ -0,0 +1,2 @@
1
+ export {default as DateYearStackedDefault} from './_date_year_stacked_default.jsx';
2
+ export {default as DateYearStackedDark} from './_date_year_stacked_dark.jsx';
@@ -0,0 +1,8 @@
1
+ <%= content_tag(:figure,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname("pb_distribution_bar_#{object.size}")) do %>
5
+ <% object.values.each do |value| %>
6
+ <div class="pb_distribution_value" style="width:<%=value%>%"></div>
7
+ <% end %>
8
+ <% end %>
@@ -0,0 +1,52 @@
1
+ /* @flow */
2
+ /*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
3
+
4
+ import React from 'react'
5
+
6
+ type DistributionBarProps = {
7
+ className?: String,
8
+ data?: String,
9
+ id?: String,
10
+ size?: 'lg' | 'sm',
11
+ values?: Array<Number>,
12
+ }
13
+
14
+ const normalizeCharacters = (values) => {
15
+ return values.map( value => {
16
+ return parseInt(value.toString().replace(/[^0-9.]/gi, ''))
17
+ })
18
+ }
19
+
20
+ const barValues = (normalizedValues) => {
21
+ let arrSum = value => value.reduce((a,b) => (a + b), 0)
22
+ let valueSum = arrSum(normalizedValues)
23
+ return normalizedValues.map((value,i) => {
24
+ return(
25
+ <div
26
+ key={i}
27
+ className={`pb_distribution_value`}
28
+ style={{width:`${value*100/valueSum}%`}}
29
+ />
30
+ )
31
+ })
32
+ }
33
+
34
+
35
+
36
+ const DistributionBar = ({
37
+ className,
38
+ data,
39
+ id,
40
+ size='lg',
41
+ values=[1]
42
+ }: DistributionBarProps) => {
43
+ const normalizedValues = normalizeCharacters(values)
44
+
45
+ return(
46
+ <div className={`pb_distribution_bar_${size}`}>
47
+ {barValues(normalizedValues)}
48
+ </div>
49
+ )
50
+ }
51
+
52
+ export default DistributionBar
@@ -0,0 +1,31 @@
1
+ @import "../tokens/colors";
2
+
3
+ [class^=pb_distribution_bar] {
4
+ $bar_colors: map-values($data_colors);
5
+ $small_bar: 8px;
6
+ $large_bar: 36px;
7
+ display: flex;
8
+ .pb_distribution_value {
9
+ height: 100%;
10
+ display: inline-block;
11
+ @for $i from 1 through length($bar_colors) {
12
+ &:nth-child(#{length($bar_colors)}n+#{$i}) {
13
+ background-color: nth($bar_colors, $i);
14
+ }
15
+ }
16
+ &:first-child {
17
+ border-top-left-radius: 18px;
18
+ border-bottom-left-radius: 18px;
19
+ }
20
+ &:last-child {
21
+ border-top-right-radius: 18px;
22
+ border-bottom-right-radius: 18px;
23
+ }
24
+ }
25
+ &[class*=_sm] {
26
+ height: $small_bar;
27
+ }
28
+ &[class*=_lg] {
29
+ height: $large_bar;
30
+ }
31
+ }
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbDistributionBar
5
+ class DistributionBar < Playbook::PbKit::Base
6
+ PROPS = %i[configured_classname
7
+ configured_data
8
+ configured_id
9
+ configured_size
10
+ configured_values].freeze
11
+
12
+ def initialize(classname: default_configuration,
13
+ data: default_configuration,
14
+ id: default_configuration,
15
+ size: default_configuration,
16
+ values: default_configuration)
17
+ self.configured_classname = classname
18
+ self.configured_data = data
19
+ self.configured_id = id
20
+ self.configured_size = size
21
+ self.configured_values = values
22
+ end
23
+
24
+ def size
25
+ size_options = %w[lg sm]
26
+ one_of_value(configured_size, size_options, "lg")
27
+ end
28
+
29
+ def values
30
+ default_value(values_to_percents, [1])
31
+ end
32
+
33
+ def to_partial_path
34
+ "pb_distribution_bar/distribution_bar"
35
+ end
36
+
37
+ private
38
+
39
+ DEFAULT = Object.new
40
+ private_constant :DEFAULT
41
+ def default_configuration
42
+ DEFAULT
43
+ end
44
+ attr_accessor(*PROPS)
45
+
46
+ def normalize_characters(value)
47
+ return value.to_s.gsub(/(\d\.\d)|[^a-zA-Z\d]/, '\\1').to_i
48
+ end
49
+
50
+ def values_to_percents
51
+ normalized_values = configured_values.map(&method(:normalize_characters))
52
+ normalized_values.map { |value| (value.to_f * 100 / normalized_values.sum ).round(2) }
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,9 @@
1
+ <%= pb_rails("distribution_bar", props: {
2
+ values: [1,2,3,4,5,3,3,7]
3
+ }) %>
4
+
5
+ <br><br>
6
+ <%= pb_rails("distribution_bar", props: {
7
+ values: [1,2,3,4,5,3,3,7],
8
+ size: "sm"
9
+ }) %>
@@ -0,0 +1,24 @@
1
+ import React from "react"
2
+ import DistributionBar from "../_distribution_bar.jsx"
3
+
4
+ function DistributionBarDefault() {
5
+ return (
6
+ <React.Fragment>
7
+ <div>
8
+ <DistributionBar
9
+ values={[1,2,3,4,5,3,3,7]}
10
+ />
11
+ </div>
12
+ <br/>
13
+ <br/>
14
+ <div>
15
+ <DistributionBar
16
+ size='sm'
17
+ values={[1,2,3,4,5,3,3,7]}
18
+ />
19
+ </div>
20
+ </React.Fragment>
21
+ )
22
+ }
23
+
24
+ export default DistributionBarDefault;
@@ -0,0 +1,9 @@
1
+ examples:
2
+
3
+ rails:
4
+ - distribution_bar_default: Default
5
+
6
+
7
+ react:
8
+ - distribution_bar_default: Default
9
+
@@ -0,0 +1 @@
1
+ export {default as DistributionBarDefault} from './_distribution_bar_default.jsx';
@@ -0,0 +1,7 @@
1
+ <%= content_tag(:div,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname(object.kit_class)) do %>
5
+ <%= object.icon %>
6
+ <%= object.text %>
7
+ <% end %>
@@ -0,0 +1,58 @@
1
+ /* @flow */
2
+ /*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
3
+
4
+ import React from 'react'
5
+ import classnames from 'classnames'
6
+ import Title from "../pb_title/_title.jsx"
7
+ import Icon from "../pb_icon/_icon.jsx"
8
+
9
+ type FixedConfirmationToastProps = {
10
+ className?: String,
11
+ data?: String,
12
+ id?: String,
13
+ status?: 'success' | 'error' | 'neutral',
14
+ text: String,
15
+ }
16
+
17
+ const FixedConfirmationToast = ({
18
+ className,
19
+ data,
20
+ id,
21
+ status='neutral',
22
+ text
23
+ }: FixedConfirmationToastProps) => {
24
+ const css = classnames([
25
+ `pb_fixed_confirmation_toast_kit_${status}`,
26
+ className,
27
+ ])
28
+
29
+ const icon = (function(status) {
30
+ switch(status) {
31
+ case "success":
32
+ return "check";
33
+ case "error":
34
+ return "exclamation-triangle";
35
+ case "neutral":
36
+ return "info-circle";
37
+ default:
38
+ return null;
39
+ }
40
+ })(status)
41
+
42
+ const displayIcon = function(icon) {
43
+ if (icon) {
44
+ return (
45
+ <Icon icon={icon} fixed_width={true} className="pb_icon"/>
46
+ )
47
+ }
48
+ }
49
+
50
+ return (
51
+ <div className={css}>
52
+ {displayIcon(icon)}
53
+ <Title size={4} className="pb_fixed_confirmation_toast_text" text={text} />
54
+ </div>
55
+ )
56
+ }
57
+
58
+ export default FixedConfirmationToast
@@ -0,0 +1,27 @@
1
+ @import "../tokens/spacing";
2
+ @import "../tokens/colors";
3
+ @import "../pb_body/body";
4
+
5
+ $pb_pill_height: 25px;
6
+
7
+ [class^=pb_fixed_confirmation_toast_kit] {
8
+ display: inline-flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ padding: $space_xs $space-md;
12
+ border-radius: $pb_pill_height;
13
+
14
+ @each $color_name, $color_value in $status_colors {
15
+ &[class*=_#{$color_name}] {
16
+ background: $color_value;
17
+
18
+ .pb_fixed_confirmation_toast_text {
19
+ color: $white;
20
+ margin: 0 $space_md 0 $space_md;
21
+ }
22
+ .pb_icon {
23
+ color: $white;
24
+ }
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,18 @@
1
+ <%= pb_rails("fixed_confirmation_toast", props: {
2
+ text: "Error Message",
3
+ status: "error"
4
+ })%>
5
+
6
+ <br><br>
7
+
8
+ <%= pb_rails("fixed_confirmation_toast", props: {
9
+ text: "Items Successfully Moved",
10
+ status: "success"
11
+ })%>
12
+
13
+ <br><br>
14
+
15
+ <%= pb_rails("fixed_confirmation_toast", props: {
16
+ text: "Scan to Assign Selected Items",
17
+ status: "neutral"
18
+ })%>
@@ -0,0 +1,26 @@
1
+ import React from "react"
2
+ import FixedConfirmationToast from "../_fixed_confirmation_toast.jsx"
3
+
4
+ function FixedConfirmationToastDefault() {
5
+ return (
6
+ <div>
7
+ <div>
8
+ <FixedConfirmationToast text="Error Message" status="error" />
9
+ </div>
10
+
11
+ <br/><br/>
12
+
13
+ <div>
14
+ <FixedConfirmationToast text="Items Successfully Moved" status="success" />
15
+ </div>
16
+
17
+ <br/><br/>
18
+
19
+ <div>
20
+ <FixedConfirmationToast text="Scan to Assign Selected Items" status="neutral" />
21
+ </div>
22
+ </div>
23
+ )
24
+ }
25
+
26
+ export default FixedConfirmationToastDefault;
@@ -0,0 +1,9 @@
1
+ examples:
2
+
3
+ rails:
4
+ - fixed_confirmation_toast_default: Default
5
+
6
+
7
+ react:
8
+ - fixed_confirmation_toast_default: Default
9
+
@@ -0,0 +1 @@
1
+ export {default as FixedConfirmationToastDefault} from './_fixed_confirmation_toast_default.jsx';
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbFixedConfirmationToast
5
+ class FixedConfirmationToast < Playbook::PbKit::Base
6
+ PROPS = %i[configured_classname
7
+ configured_data
8
+ configured_id
9
+ configured_status
10
+ configured_text].freeze
11
+
12
+ def initialize(classname: default_configuration,
13
+ data: default_configuration,
14
+ id: default_configuration,
15
+ status: default_configuration,
16
+ text: default_configuration)
17
+ self.configured_classname = classname
18
+ self.configured_data = data
19
+ self.configured_id = id
20
+ self.configured_status = status
21
+ self.configured_text = text
22
+ end
23
+
24
+ def text
25
+ if is_set? configured_text
26
+ pb_text = Playbook::PbTitle::Title.new(size: 4, text: configured_text, classname: "pb_fixed_confirmation_toast_text")
27
+ ApplicationController.renderer.render(partial: pb_text, as: :object)
28
+ end
29
+ end
30
+
31
+ def kit_class
32
+ kit_options = [
33
+ "pb_fixed_confirmation_toast_kit",
34
+ status,
35
+ ]
36
+ kit_options.join("_")
37
+ end
38
+
39
+ def status
40
+ status_options = %w[success error neutral]
41
+ one_of_value(configured_status, status_options, "neutral")
42
+ end
43
+
44
+ def icon
45
+ pb_icon = Playbook::PbIcon::Icon.new(icon: icon_value, classname: "pb_icon")
46
+ ApplicationController.renderer.render(partial: pb_icon, as: :object)
47
+ end
48
+
49
+ def icon_value
50
+ case status
51
+ when "success"
52
+ "check"
53
+ when "error"
54
+ "exclamation-triangle"
55
+ when "neutral"
56
+ "info-circle"
57
+ end
58
+ end
59
+
60
+ def to_partial_path
61
+ "pb_fixed_confirmation_toast/fixed_confirmation_toast"
62
+ end
63
+
64
+ private
65
+
66
+ DEFAULT = Object.new
67
+ private_constant :DEFAULT
68
+ def default_configuration
69
+ DEFAULT
70
+ end
71
+ attr_accessor(*PROPS)
72
+ end
73
+ end
74
+ end