playbook_ui 14.24.0.pre.alpha.play23649479 → 14.24.0.pre.alpha.reactupgradetest9656

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +4 -1
  3. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +175 -26
  4. data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +2 -1
  5. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.html.erb +1 -1
  6. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +78 -12
  7. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.html.erb +9 -21
  8. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +10 -1
  9. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +2 -0
  10. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +24 -0
  11. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +3 -0
  12. data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +1 -0
  13. data/app/pb_kits/playbook/pb_dropdown/index.js +3 -0
  14. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -2
  15. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +22 -0
  16. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +43 -0
  17. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +1 -0
  18. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  19. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  20. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +2 -1
  21. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -1
  22. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +6 -0
  23. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +11 -1
  24. data/dist/chunks/_line_graph-C17mbReK.js +1 -0
  25. data/dist/chunks/{_typeahead-CKvqSXWH.js → _typeahead-S1QZZ4ft.js} +2 -2
  26. data/dist/chunks/{_weekday_stacked-tedYzlIq.js → _weekday_stacked-CbCxfysG.js} +3 -3
  27. data/dist/chunks/componentRegistry-B0YbRR45.js +1 -0
  28. data/dist/chunks/lib-7ookneKo.js +34 -0
  29. data/dist/chunks/{pb_form_validation-CA_noofR.js → pb_form_validation-B-5l-l7v.js} +1 -1
  30. data/dist/chunks/vendor.js +1 -1
  31. data/dist/playbook-doc.js +2 -2
  32. data/dist/playbook-rails-react-bindings.js +1 -1
  33. data/dist/playbook-rails.js +1 -1
  34. data/lib/playbook/engine.rb +0 -1
  35. data/lib/playbook/kit_base.rb +20 -2
  36. data/lib/playbook/version.rb +1 -1
  37. metadata +18 -26
  38. data/dist/chunks/_line_graph-BsZ3DcJo.js +0 -1
  39. data/dist/chunks/lib-BplzvaaY.js +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9be43cefc6c49eebecc1cc7526b3dd1e7ccf55544dbdc1adf92f81ff22768867
4
- data.tar.gz: 85f5fd95aef9a42e578af9a00448e49cb74e3dac79fb6824f0dcc919c257ead6
3
+ metadata.gz: 552aff01486bb4ad720c0b4973b0153c73effaa236876820794fd7d25fa5c795
4
+ data.tar.gz: e3e53e9f91f91216d806d3a63c6869826c361dbf265659f7eb18cd831c2f3237
5
5
  SHA512:
6
- metadata.gz: 1261c1fb78b71682d0b4f04b3051def634b429b3915f1566f15ddf6bc3cbcec7508f7d6c1c2dc08ef9a474c918271398a67e74788bb72dd7a599dbe0089a7d6b
7
- data.tar.gz: fc343526ed3f7b8d5ba4f1cdcc96b96726e664a47a636627fc9a432b98a28ce32720aca491bf68a5617965aa7133841a589ac1999c63f748bab2c6542e205f71
6
+ metadata.gz: 6986ae6d81e6a358f59d73c98a6c94f64fa5771fec4a54f0bfd25bad3bc089df3765ece2efa5def2efaaeaea71d7e4064dcbc174365e3f8a4d837da10ae65f5b
7
+ data.tar.gz: 2bdc809201cdebae095d683ce618bca8ddd6d00d05bff60f82831933ae7878f8b62d9c92d377a3b3455cd7a2954a1e031ab3a3a9205dd7b66748fdb3f049cff8
@@ -134,13 +134,15 @@ export const RegularTableView = ({
134
134
  const columnDefinitions = table.options.meta?.columnDefinitions || [];
135
135
  // Row pinning
136
136
  function PinnedRow({ row }: { row: Row<any> }) {
137
+ const customRowStyle = rowStyling?.length > 0 && rowStyling?.find((s: GenericObject) => s?.rowId === row.id);
137
138
  return (
138
139
  <tr
139
140
  className={classnames(
140
141
  `pinned-row`,
141
142
  )}
142
143
  style={{
143
- backgroundColor: 'white',
144
+ backgroundColor: customRowStyle?.backgroundColor ? customRowStyle?.backgroundColor : 'white',
145
+ color: customRowStyle?.fontColor,
144
146
  position: 'sticky',
145
147
  top:
146
148
  row.getIsPinned() === 'top'
@@ -153,6 +155,7 @@ export const RegularTableView = ({
153
155
  collapsibleTrail={collapsibleTrail}
154
156
  columnDefinitions={columnDefinitions}
155
157
  columnPinning={columnPinning}
158
+ customRowStyle={customRowStyle}
156
159
  loading={loading}
157
160
  row={row}
158
161
  stickyLeftColumn={stickyLeftColumn}
@@ -1,41 +1,190 @@
1
- import React, { useMemo } from "react"
1
+ import React, { useState, useEffect } from "react";
2
+ import { globalProps } from "../utilities/globalProps";
2
3
  import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
3
- import Highcharts from "highcharts"
4
- import HighchartsReact from "highcharts-react-official"
5
4
 
6
- import barGraphTheme from "./barGraphTheme"
5
+ import HighchartsReact from "highcharts-react-official";
6
+ import Highcharts from "highcharts";
7
+ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
8
+ import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
9
+ import mapColors from "../pb_dashboard/pbChartsColorsHelper";
10
+ import { merge } from '../utilities/object'
11
+
12
+ import classnames from "classnames";
7
13
 
8
14
  type BarGraphProps = {
9
- options: Record<string, unknown>
10
- containerProps?: React.HTMLProps<HTMLDivElement>
11
- data?: Record<string, unknown>
12
- }
15
+ align?: "left" | "right" | "center";
16
+ axisTitle: { name: string; }[] | string;
17
+ dark?: boolean;
18
+ xAxisCategories: [];
19
+ yAxisMin: number;
20
+ yAxisMax: number;
21
+ chartData: { name: string; data: number[], yAxis: number }[];
22
+ className?: string;
23
+ customOptions?: Partial<Highcharts.Options>;
24
+ id: string;
25
+ pointStart: number;
26
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
27
+ subTitle?: string;
28
+ title: string;
29
+ type?: string;
30
+ legend?: boolean;
31
+ toggleLegendClick?: boolean;
32
+ height?: string;
33
+ colors: string[];
34
+ layout?: "horizontal" | "vertical" | "proximate";
35
+ verticalAlign?: "top" | "middle" | "bottom";
36
+ x?: number;
37
+ y?: number;
38
+ aria?: { [key: string]: string };
39
+ data?: { [key: string]: string };
40
+ stacking?: "normal" | "percent"
41
+ axisFormat?: { format: string; }[] | string;
42
+ };
13
43
 
14
- const BarGraph = ({
15
- options,
16
- containerProps = {},
17
- data = {}
18
- }: BarGraphProps): React.ReactElement => {
19
44
 
45
+ const BarGraph = ({
46
+ aria = {},
47
+ data = {},
48
+ align = "center",
49
+ axisTitle,
50
+ dark = false,
51
+ chartData,
52
+ className = "pb_bar_graph",
53
+ colors,
54
+ htmlOptions = {},
55
+ customOptions = {},
56
+ axisFormat,
57
+ id,
58
+ pointStart,
59
+ stacking,
60
+ subTitle,
61
+ type = "column",
62
+ title = "Title",
63
+ xAxisCategories,
64
+ yAxisMin,
65
+ yAxisMax,
66
+ legend = false,
67
+ toggleLegendClick = true,
68
+ height,
69
+ layout = "horizontal",
70
+ verticalAlign = "bottom",
71
+ x = 0,
72
+ y = 0,
73
+ ...props
74
+ }: BarGraphProps): React.ReactElement => {
75
+ const ariaProps = buildAriaProps(aria);
20
76
  const dataProps = buildDataProps(data)
77
+ const htmlProps = buildHtmlProps(htmlOptions);
78
+ const setupTheme = () => {
79
+ dark
80
+ ? Highcharts.setOptions(highchartsDarkTheme)
81
+ : Highcharts.setOptions(highchartsTheme);
82
+ };
83
+ setupTheme();
84
+
85
+ const staticOptions = {
86
+ title: {
87
+ text: title,
88
+ },
89
+ chart: {
90
+ height: height,
91
+ type: type,
92
+ },
93
+ subtitle: {
94
+ text: subTitle,
95
+ },
96
+ yAxis: [{
97
+ labels: {
98
+ format: typeof axisFormat === 'string' ? axisFormat : (axisFormat && axisFormat[0] ? axisFormat[0].format : "")
21
99
 
22
- const mergedOptions = useMemo(() => {
23
- if (!options || typeof options !== "object") {
24
- // eslint-disable-next-line no-console
25
- console.error("❌ Invalid options passed to <BarGraph />", options)
26
- return {}
27
- }
100
+ },
101
+ min: yAxisMin,
102
+ max: yAxisMax,
103
+ opposite: false,
104
+ title: {
105
+ text: Array.isArray(axisTitle) ? (axisTitle.length > 0 ? axisTitle[0].name : null) : axisTitle,
106
+ },
107
+ plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
108
+ value: 0,
109
+ zIndex: 10,
110
+ color: "#E4E8F0"
111
+ }],
112
+ }],
113
+ xAxis: {
114
+ categories: xAxisCategories,
115
+ },
116
+ legend: {
117
+ enabled: legend,
118
+ align: align,
119
+ verticalAlign: verticalAlign,
120
+ layout: layout,
121
+ x: x,
122
+ y: y,
123
+ },
124
+ colors:
125
+ colors !== undefined && colors.length > 0
126
+ ? mapColors(colors)
127
+ : highchartsTheme.colors,
128
+ plotOptions: {
129
+ series: {
130
+ stacking: stacking,
131
+ pointStart: pointStart,
132
+ borderWidth: stacking ? 0 : "",
133
+ events: {},
134
+ dataLabels: {
135
+ enabled: false,
136
+ },
137
+ },
138
+ },
139
+ series: chartData,
140
+ credits: false,
141
+ };
28
142
 
29
- return Highcharts.merge({}, barGraphTheme, options)
30
- }, [options])
143
+ if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
144
+ staticOptions.yAxis.push({
145
+ labels: {
146
+ format: typeof axisFormat === 'string' ? axisFormat : axisFormat[1].format,
147
+ },
148
+ min: yAxisMin,
149
+ max: yAxisMax,
150
+ opposite: true,
151
+ title: {
152
+ text: axisTitle[1].name,
153
+ },
154
+ plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
155
+ value: 0,
156
+ zIndex: 10,
157
+ color: "#E4E8F0"
158
+ }],
159
+ });
160
+ }
161
+
162
+ if (!toggleLegendClick) {
163
+ staticOptions.plotOptions.series.events = { legendItemClick: () => false };
164
+ }
165
+
166
+ const filteredProps: any = {...props};
167
+ delete filteredProps.verticalAlign;
168
+
169
+ const [options, setOptions] = useState({});
170
+
171
+ useEffect(() => {
172
+ setOptions(merge(staticOptions, customOptions));
173
+ }, [chartData]);
31
174
 
32
175
  return (
33
176
  <HighchartsReact
34
- containerProps={{ ...containerProps, ...dataProps }}
177
+ containerProps={{
178
+ className: classnames(globalProps(filteredProps), className),
179
+ id: id,
180
+ ...ariaProps,
181
+ ...dataProps,
182
+ ...htmlProps
183
+ }}
35
184
  highcharts={Highcharts}
36
- options={mergedOptions}
185
+ options={options}
37
186
  />
38
- )
39
- }
187
+ );
188
+ };
40
189
 
41
- export default BarGraph
190
+ export default BarGraph;
@@ -20,8 +20,9 @@ const testId = 'bargraph1';
20
20
  test('bargraph uses exact classname', () => {
21
21
  render(
22
22
  <BarGraph
23
- containerProps={{ className: 'super_important_class' }}
23
+ className='super_important_class'
24
24
  data={{ testid: testId }}
25
+ id='bar-default'
25
26
  />
26
27
  );
27
28
 
@@ -1 +1 @@
1
- <%= react_component('BarGraph', object.react_props) %>
1
+ <%= react_component('BarGraph', object.chart_options) %>
@@ -3,25 +3,91 @@
3
3
  module Playbook
4
4
  module PbBarGraph
5
5
  class BarGraph < Playbook::KitBase
6
- prop :options, default: {}
7
- prop :container_props, default: {}
6
+ prop :align, type: Playbook::Props::Enum,
7
+ values: %w[left right center],
8
+ default: "center"
9
+ prop :axis_title
10
+ prop :axis_format
11
+ prop :chart_data, type: Playbook::Props::Array,
12
+ default: []
13
+ prop :custom_options, default: {}
14
+ prop :orientation, type: Playbook::Props::Enum,
15
+ values: %w[vertical horizontal],
16
+ default: "vertical"
17
+ prop :point_start, type: Playbook::Props::Numeric
18
+ prop :stacking
19
+ prop :subtitle
20
+ prop :title
21
+ prop :x_axis_categories, type: Playbook::Props::Array,
22
+ default: []
23
+ prop :y_axis_min, type: Playbook::Props::Numeric
24
+ prop :y_axis_max, type: Playbook::Props::Numeric
25
+ prop :legend, type: Playbook::Props::Boolean,
26
+ default: false
27
+ prop :toggle_legend_click, type: Playbook::Props::Boolean,
28
+ default: true
29
+ prop :height
30
+ prop :colors, type: Playbook::Props::Array,
31
+ default: []
32
+ prop :layout, type: Playbook::Props::Enum,
33
+ values: %w[horizontal vertical proximate],
34
+ default: "horizontal"
35
+ prop :vertical_align, type: Playbook::Props::Enum,
36
+ values: %w[top middle bottom],
37
+ default: "bottom"
38
+ prop :x, type: Playbook::Props::Numeric
39
+ prop :y, type: Playbook::Props::Numeric
8
40
 
9
- def chart_options
10
- options
41
+ def chart_type
42
+ orientation == "horizontal" ? "bar" : "column"
11
43
  end
12
44
 
13
- def react_props
45
+ def standard_options
14
46
  {
15
- options: options,
16
- containerProps: container_props_hash,
47
+ align: align,
48
+ id: id,
49
+ className: classname,
50
+ chartData: chart_data,
51
+ dark: dark ? "dark" : "",
52
+ type: chart_type,
53
+ title: title,
54
+ stacking: stacking,
55
+ subTitle: subtitle,
56
+ axisTitle: axis_title,
57
+ axisFormat: axis_format,
58
+ pointStart: point_start,
59
+ xAxisCategories: x_axis_categories,
60
+ yAxisMin: y_axis_min,
61
+ yAxisMax: y_axis_max,
62
+ legend: legend,
63
+ toggleLegendClick: toggle_legend_click,
64
+ height: height,
65
+ colors: colors,
66
+ layout: layout,
67
+ verticalAlign: vertical_align,
68
+ x: x,
69
+ y: y,
17
70
  }
18
71
  end
19
72
 
20
- def container_props_hash
21
- container_props.merge({
22
- id: id,
23
- className: classname,
24
- }).compact
73
+ def chart_options
74
+ standard_options.deep_merge(custom_options)
75
+ end
76
+
77
+ def vertical_align_props
78
+ if vertical_align
79
+ if object.vertical_align
80
+ original_result = super
81
+ class_to_remove = "vertical_align_#{object.vertical_align}"
82
+
83
+ modified_result = original_result.gsub(class_to_remove, "").strip
84
+ modified_result.empty? ? nil : modified_result
85
+ else
86
+ super
87
+ end
88
+ else
89
+ super
90
+ end
25
91
  end
26
92
 
27
93
  def classname
@@ -15,24 +15,12 @@
15
15
  data: [1111,677,3245,500,200]
16
16
  }] %>
17
17
 
18
-
19
- <% chart_options = {
20
- series: data,
21
- title: {
22
- text: 'Solar Employment Growth by Sector, 2010-2016',
23
- },
24
- subtitle: {
25
- text: 'Source: thesolarfoundation.com',
26
- },
27
- xAxis: {
28
- categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
29
- },
30
- yAxis: {
31
- title: {
32
- text: 'Number of Employees',
33
- },
34
- },
35
- }
36
- %>
37
-
38
- <%= pb_rails("bar_graph", props: {options: chart_options}) %>
18
+ <%= pb_rails("bar_graph", props: {
19
+ axis_title: 'Number of Employees',
20
+ chart_data: data,
21
+ id: "bar-default",
22
+ y_axis_min: 0,
23
+ x_axis_categories:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
24
+ subtitle: 'Source: thesolarfoundation.com',
25
+ title: 'Solar Employment Growth by Sector, 2010-2016',
26
+ }) %>
@@ -1,5 +1,14 @@
1
1
  <%= pb_content_tag do %>
2
- <%= pb_rails("button", props: {type: object.type, loading: object.loading, link: object.link, new_window:object.new_window, variant: object.variant, target: object.target, disabled: object.disabled, dark: object.dark}) do %>
2
+ <%= pb_rails("button", props: {
3
+ type: object.type,
4
+ loading: object.loading,
5
+ link: object.link,
6
+ new_window: object.new_window,
7
+ variant: object.variant,
8
+ target: object.target,
9
+ disabled: object.disabled,
10
+ dark: object.dark
11
+ }.merge(object.input_options)) do %>
3
12
  <%= pb_rails("icon", props: {icon: object.icon, fixed_width: true, dark: object.dark}) %>
4
13
  <% end %>
5
14
  <% end %>
@@ -21,6 +21,8 @@ module Playbook
21
21
  prop :size, type: Playbook::Props::Enum,
22
22
  values: %w[default sm],
23
23
  default: "default"
24
+ prop :input_options, type: Playbook::Props::HashProp,
25
+ default: {}
24
26
 
25
27
  def classname
26
28
  generate_classname("pb_circle_icon_button_kit") + size_class
@@ -0,0 +1,24 @@
1
+ <%= pb_rails("circle_icon_button", props: {
2
+ icon: "plus",
3
+ input_options: {
4
+ data: { "test-id": "add-button", remote: true },
5
+ }
6
+ }) %>
7
+ <br/>
8
+ <%= pb_rails("circle_icon_button", props: {
9
+ icon: "pen",
10
+ variant: "secondary",
11
+ input_options: {
12
+ data: { "test-id": "edit-button" },
13
+ classname: "custom-secondary-button-class"
14
+ }
15
+ }) %>
16
+ <br/>
17
+ <%= pb_rails("circle_icon_button", props: {
18
+ icon: "user",
19
+ variant: "link",
20
+ input_options: {
21
+ data: { "test-id": "user-button" },
22
+ id: "user-button-id"
23
+ }
24
+ }) %>
@@ -0,0 +1,3 @@
1
+ Use the `input_options` prop to pass additional attributes directly to the internal Playbook Button component. While the wrapper div has access to the standard `data` prop from KitBase, `input_options` allows you to attach attributes specifically to the internal button element.
2
+
3
+ This is particularly useful when you need data attributes or other HTML attributes to apply to the button itself.
@@ -5,6 +5,7 @@ examples:
5
5
  - circle_icon_button_link: Link
6
6
  - circle_icon_button_loading: Loading
7
7
  - circle_icon_button_size: Size
8
+ - circle_icon_button_input_options: Input Options
8
9
 
9
10
  react:
10
11
  - circle_icon_button_default: Default
@@ -284,6 +284,9 @@ export default class PbDropdown extends PbEnhancedElement {
284
284
  this.adjustDropdownHeight();
285
285
  }
286
286
  });
287
+ this.element.querySelector(DROPDOWN_INPUT).value = Array.from(this.selectedOptions)
288
+ .map((opt) => JSON.parse(opt).id)
289
+ .join(",");
287
290
  } else {
288
291
  options.forEach((option) => {
289
292
  option.classList.remove("pb_dropdown_option_selected");
@@ -52,7 +52,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
52
52
  } = props;
53
53
 
54
54
  const returnedIcon = icon || iconMap[status]
55
- const iconClass = icon ? "custom_icon" : ""
55
+ const iconClass = icon && icon !== "none" ? "custom_icon" : ""
56
56
 
57
57
  const css = classnames(
58
58
  `pb_fixed_confirmation_toast_kit_${status}`,
@@ -92,7 +92,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
92
92
  onClick={handleClick}
93
93
  {...htmlProps}
94
94
  >
95
- {returnedIcon && (
95
+ {returnedIcon && icon !== "none" && (
96
96
  <Icon
97
97
  className="pb_icon"
98
98
  fixedWidth
@@ -0,0 +1,22 @@
1
+ <%= pb_rails("fixed_confirmation_toast", props: {
2
+ text: "Error Message",
3
+ status: "error",
4
+ icon: "none",
5
+ closeable: true
6
+ })%>
7
+
8
+ <br><br>
9
+
10
+ <%= pb_rails("fixed_confirmation_toast", props: {
11
+ text: "Items Successfully Moved",
12
+ status: "success",
13
+ icon: "none"
14
+ })%>
15
+
16
+ <br><br>
17
+
18
+ <%= pb_rails("fixed_confirmation_toast", props: {
19
+ text: "Scan to Assign Selected Items",
20
+ status: "neutral",
21
+ icon: "none"
22
+ })%>
@@ -0,0 +1,43 @@
1
+ import React from 'react'
2
+
3
+ import FixedConfirmationToast from '../_fixed_confirmation_toast'
4
+
5
+ const FixedConfirmationToastNoIcon = (props) => {
6
+ return (
7
+ <div>
8
+ <div>
9
+ <FixedConfirmationToast
10
+ closeable
11
+ icon="none"
12
+ status="error"
13
+ text="Error Message"
14
+ {...props}
15
+ />
16
+ </div>
17
+
18
+ <br />
19
+
20
+ <div>
21
+ <FixedConfirmationToast
22
+ icon="none"
23
+ status="success"
24
+ text="Items Successfully Moved"
25
+ {...props}
26
+ />
27
+ </div>
28
+
29
+ <br />
30
+
31
+ <div>
32
+ <FixedConfirmationToast
33
+ icon="none"
34
+ status="neutral"
35
+ text="Scan to Assign Selected Items"
36
+ {...props}
37
+ />
38
+ </div>
39
+ </div>
40
+ )
41
+ }
42
+
43
+ export default FixedConfirmationToastNoIcon
@@ -0,0 +1 @@
1
+ Setting `icon` prop to "none" will render the fixed confirmation toast without the left side icon.
@@ -8,6 +8,7 @@ examples:
8
8
  - fixed_confirmation_toast_auto_close: Click to Show Auto Close
9
9
  - fixed_confirmation_toast_children: Children
10
10
  - fixed_confirmation_toast_custom_icon: Custom Icon
11
+ - fixed_confirmation_toast_no_icon: No Icon
11
12
 
12
13
  react:
13
14
  - fixed_confirmation_toast_default: Default
@@ -17,6 +18,7 @@ examples:
17
18
  - fixed_confirmation_toast_auto_close: Click to Show Auto Close
18
19
  - fixed_confirmation_toast_children: Children
19
20
  - fixed_confirmation_toast_custom_icon: Custom Icon
21
+ - fixed_confirmation_toast_no_icon: No Icon
20
22
 
21
23
  swift:
22
24
  - fixed_confirmation_toast_default_swift: Default
@@ -5,3 +5,4 @@ export { default as FixedConfirmationToastPositions } from './_fixed_confirmatio
5
5
  export { default as FixedConfirmationToastAutoClose } from './_fixed_confirmation_toast_auto_close.jsx'
6
6
  export { default as FixedConfirmationToastChildren } from './_fixed_confirmation_toast_children.jsx'
7
7
  export { default as FixedConfirmationToastCustomIcon } from './_fixed_confirmation_toast_custom_icon.jsx'
8
+ export { default as FixedConfirmationToastNoIcon } from './_fixed_confirmation_toast_no_icon.jsx'
@@ -1,6 +1,7 @@
1
1
  <%= pb_content_tag do %>
2
+ <% if object.icon_value && object.icon_value != "none" %>
2
3
  <%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
3
-
4
+ <% end %>
4
5
  <% if content %>
5
6
  <%= content %>
6
7
  <% elsif object.show_text? %>
@@ -56,7 +56,7 @@ module Playbook
56
56
  end
57
57
 
58
58
  def icon_class
59
- icon.present? ? " custom_icon" : ""
59
+ icon.present? && icon != "none" ? " custom_icon" : ""
60
60
  end
61
61
 
62
62
  def classname
@@ -56,6 +56,12 @@ test('renders custom icon when provided', () => {
56
56
  expect(container.querySelector('.custom_icon')).toBeInTheDocument();
57
57
  });
58
58
 
59
+ test("renders no icon when icon prop is 'none'", () => {
60
+ const { container } = render(<FixedConfirmationToast icon="none" />);
61
+ expect(container.querySelector('.pb_icon')).not.toBeInTheDocument();
62
+ expect(container.querySelector('.custom_icon')).not.toBeInTheDocument();
63
+ });
64
+
59
65
  test('renders correctly with multiLine prop', () => {
60
66
  const { container } = render(<FixedConfirmationToast multiLine />);
61
67
  expect(container.querySelector('._multi_line')).toBeInTheDocument();
@@ -197,13 +197,22 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
197
197
  }
198
198
 
199
199
  const validateMissingAreaCode = (itiInit: any) => {
200
- if (!required || !itiInit) return
200
+ if (!itiInit) return
201
201
  if (itiInit.getValidationError() === ValidationError.MissingAreaCode) {
202
202
  showFormattedError('missing area code')
203
203
  return true
204
204
  }
205
205
  }
206
206
 
207
+ const validateRepeatCountryCode = (itiInit: any) => {
208
+ if (!itiInit) return
209
+ const countryDialCode = itiInit.getSelectedCountryData().dialCode;
210
+ if (unformatNumber(inputValue).startsWith(countryDialCode)) {
211
+ return showFormattedError('repeat country code')
212
+ }
213
+ }
214
+
215
+
207
216
  const validateErrors = () => {
208
217
  if (!hasTyped && !error) return
209
218
 
@@ -213,6 +222,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
213
222
  if (validateTooShortNumber(itiRef.current)) return
214
223
  if (validateUnhandledError(itiRef.current)) return
215
224
  if (validateMissingAreaCode(itiRef.current)) return
225
+ if (validateRepeatCountryCode(itiRef.current)) return
216
226
  }
217
227
 
218
228
  const getCurrentSelectedData = (itiInit: any, inputValue: string) => {