playbook_ui 11.4.0 → 11.5.0.pre.alpha.pre.rubocop

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_button/button.test.js +6 -8
  3. data/app/pb_kits/playbook/pb_date/_date.tsx +1 -1
  4. data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +13 -1
  5. data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +24 -19
  6. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -1
  7. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +8 -0
  8. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +25 -3
  9. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions.html.erb +44 -0
  10. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions.jsx +60 -0
  11. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions.md +9 -0
  12. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions_element.html.erb +33 -0
  13. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions_element.jsx +67 -0
  14. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +4 -0
  15. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -0
  16. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss +4 -4
  17. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +142 -0
  18. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +116 -0
  19. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default.jsx +1 -1
  20. data/app/pb_kits/playbook/pb_date_time/{_date_time.jsx → _date_time.tsx} +2 -5
  21. data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +110 -0
  22. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_align.jsx +1 -1
  23. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_default.jsx +1 -1
  24. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_size.jsx +1 -1
  25. data/app/pb_kits/playbook/pb_date_year_stacked/{_date_year_stacked.jsx → _date_year_stacked.tsx} +6 -6
  26. data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.test.js +67 -0
  27. data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +32 -14
  28. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +5 -0
  29. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +2 -2
  30. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +22 -4
  31. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +3 -3
  32. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +79 -17
  33. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.jsx +55 -93
  34. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.jsx +79 -42
  35. data/app/pb_kits/playbook/pb_file_upload/{_file_upload.jsx → _file_upload.tsx} +6 -10
  36. data/app/pb_kits/playbook/pb_form_group/{_form_group.jsx → _form_group.tsx} +1 -4
  37. data/app/pb_kits/playbook/pb_form_group/form_group.test.js +17 -0
  38. data/app/pb_kits/playbook/pb_hashtag/_hashtag.tsx +10 -1
  39. data/app/pb_kits/playbook/pb_hashtag/docs/_hashtag_link.html.erb +5 -0
  40. data/app/pb_kits/playbook/pb_hashtag/docs/_hashtag_link.jsx +26 -0
  41. data/app/pb_kits/playbook/pb_hashtag/docs/_hashtag_link.md +1 -0
  42. data/app/pb_kits/playbook/pb_hashtag/docs/example.yml +2 -0
  43. data/app/pb_kits/playbook/pb_hashtag/docs/index.js +1 -0
  44. data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +1 -1
  45. data/app/pb_kits/playbook/pb_hashtag/hashtag.rb +6 -0
  46. data/app/pb_kits/playbook/pb_hashtag/hashtag.test.js +54 -0
  47. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +3 -0
  48. data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.html.erb +2 -1
  49. data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.rb +2 -0
  50. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_link.html.erb +12 -0
  51. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_link.jsx +23 -0
  52. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_link.md +1 -0
  53. data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +3 -0
  54. data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +1 -0
  55. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +4 -0
  56. data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.html.erb +2 -1
  57. data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.rb +4 -1
  58. data/app/pb_kits/playbook/pb_layout/{_layout.jsx → _layout.tsx} +13 -19
  59. data/app/pb_kits/playbook/pb_layout/layout.test.js +98 -0
  60. data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +23 -15
  61. data/app/pb_kits/playbook/pb_time/_time.tsx +2 -2
  62. data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +5 -2
  63. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.html.erb +9 -0
  64. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.jsx +10 -0
  65. data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +4 -1
  66. data/app/pb_kits/playbook/pb_timestamp/timestamp.test.js +164 -0
  67. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +0 -4
  68. data/app/pb_kits/playbook/pb_tooltip/tooltip.test.jsx +11 -8
  69. data/app/pb_kits/playbook/tokens/_colors.scss +74 -74
  70. data/app/pb_kits/playbook/tokens/_typography.scss +8 -8
  71. data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -11
  72. data/app/pb_kits/playbook/utilities/{_align_content.scss → flexbox_global_props/_align_content.scss} +0 -0
  73. data/app/pb_kits/playbook/utilities/{_align_items.scss → flexbox_global_props/_align_items.scss} +0 -0
  74. data/app/pb_kits/playbook/utilities/{_align_self.scss → flexbox_global_props/_align_self.scss} +0 -0
  75. data/app/pb_kits/playbook/utilities/{_flex.scss → flexbox_global_props/_flex.scss} +0 -0
  76. data/app/pb_kits/playbook/utilities/{_flex_direction.scss → flexbox_global_props/_flex_direction.scss} +0 -0
  77. data/app/pb_kits/playbook/utilities/{_flex_grow.scss → flexbox_global_props/_flex_grow.scss} +0 -0
  78. data/app/pb_kits/playbook/utilities/{_flex_shrink.scss → flexbox_global_props/_flex_shrink.scss} +0 -0
  79. data/app/pb_kits/playbook/utilities/{_flex_wrap.scss → flexbox_global_props/_flex_wrap.scss} +0 -0
  80. data/app/pb_kits/playbook/utilities/{_justify_content.scss → flexbox_global_props/_justify_content.scss} +0 -0
  81. data/app/pb_kits/playbook/utilities/{_justify_self.scss → flexbox_global_props/_justify_self.scss} +0 -0
  82. data/app/pb_kits/playbook/utilities/{_order.scss → flexbox_global_props/_order.scss} +0 -0
  83. data/app/pb_kits/playbook/utilities/props.ts +1 -1
  84. data/app/pb_kits/playbook/utilities/test-utils.js +2 -3
  85. data/lib/playbook/version.rb +2 -2
  86. metadata +39 -21
  87. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx +0 -155
@@ -0,0 +1,116 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+
4
+ import DateRangeInline from './_date_range_inline'
5
+
6
+ jest.useFakeTimers()
7
+ const testId = "daterangeinline-kit";
8
+
9
+ describe("DateRangeInline Kit", () => {
10
+ test("renders DateRangeInline className", () => {
11
+ render(
12
+ <DateRangeInline
13
+ data={{ testid: testId }}
14
+ endDate={new Date('20 Mar 2015')}
15
+ size="xs"
16
+ startDate={new Date('18 Jun 2013')}
17
+ />
18
+ )
19
+
20
+ const kit = screen.getByTestId(testId)
21
+ expect(kit).toHaveClass("pb_date_range_inline_kit_left")
22
+ })
23
+
24
+ test("renders DateRangeInline text left", () => {
25
+ render(
26
+ <DateRangeInline
27
+ data={{ testid: testId }}
28
+ endDate={new Date('20 Mar 2015')}
29
+ size="xs"
30
+ startDate={new Date('18 Jun 2013')}
31
+ />
32
+ )
33
+
34
+ const kit = screen.getByTestId(testId)
35
+ const text = kit.querySelector('.pb_caption_kit_md:first-child')
36
+ expect(text.textContent).toEqual(" Jun 18, 2013 ")
37
+ })
38
+
39
+ test("renders DateRangeInline text right", () => {
40
+ render(
41
+ <DateRangeInline
42
+ data={{ testid: testId }}
43
+ endDate={new Date('20 Mar 2015')}
44
+ size="xs"
45
+ startDate={new Date('18 Jun 2013')}
46
+ />
47
+ )
48
+
49
+ const kit = screen.getByTestId(testId)
50
+ const text = kit.querySelector('.pb_caption_kit_md:last-child')
51
+ expect(text.textContent).toEqual(" Mar 20, 2015 ")
52
+ })
53
+
54
+ test("renders DateRangeInline arrow icon center", () => {
55
+ render(
56
+ <DateRangeInline
57
+ data={{ testid: testId }}
58
+ endDate={new Date('20 Mar 2015')}
59
+ size="xs"
60
+ startDate={new Date('18 Jun 2013')}
61
+ />
62
+ )
63
+
64
+ const kit = screen.getByTestId(testId)
65
+ const arrow = kit.querySelector('.pb_icon_kit.fa-fw.fa-long-arrow-right')
66
+ expect(arrow).toBeInTheDocument()
67
+ })
68
+
69
+ test("renders DateRangeInline className if size sm", () => {
70
+ render(
71
+ <DateRangeInline
72
+ data={{ testid: testId }}
73
+ endDate={new Date('20 Mar 2015')}
74
+ size="sm"
75
+ startDate={new Date('18 Jun 2013')}
76
+ />
77
+ )
78
+
79
+ const kit = screen.getByTestId(testId)
80
+ const innerKit = kit.querySelector('.pb_body_kit')
81
+ expect(innerKit).toBeInTheDocument()
82
+ })
83
+
84
+ test("renders DateRangeInline calender icon left", () => {
85
+ render(
86
+ <DateRangeInline
87
+ data={{ testid: testId }}
88
+ endDate={new Date('20 Mar 2015')}
89
+ icon
90
+ size="xs"
91
+ startDate={new Date('18 Jun 2013')}
92
+ />
93
+ )
94
+
95
+ const kit = screen.getByTestId(testId)
96
+ const calendar = kit.querySelector('.pb_icon_kit.fa-fw.fa-calendar-alt')
97
+ expect(calendar).toBeInTheDocument()
98
+ })
99
+
100
+ test("renders DateRangeInline without year", () => {
101
+ render(
102
+ <DateRangeInline
103
+ data={{ testid: testId }}
104
+ endDate={new Date((`15 Aug ${new Date().getFullYear()}`))}
105
+ size="xs"
106
+ startDate={new Date(`15 Jan ${new Date().getFullYear()}`)}
107
+ />
108
+ )
109
+
110
+ const kit = screen.getByTestId(testId)
111
+ const text = kit.querySelector('.pb_caption_kit_md:first-child')
112
+ expect(text.textContent).toEqual(" Jan 15 ")
113
+ })
114
+
115
+
116
+ })
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import DateRangeInline from '../_date_range_inline.jsx'
2
+ import DateRangeInline from '../_date_range_inline'
3
3
 
4
4
  const DateRangeInlineDefault = (props) => {
5
5
  return (
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
 
@@ -12,9 +10,9 @@ import FormattedDate from '../pb_date/_date'
12
10
 
13
11
  type DateTimeProps = {
14
12
  align?: "left" | "center" | "right",
15
- aria?: object,
13
+ aria?: { [key: string]: string; },
16
14
  className?: string,
17
- data?: object,
15
+ data?: { [key: string]: string; },
18
16
  datetime: string,
19
17
  id?: string,
20
18
  size?: "sm" | "md",
@@ -59,7 +57,6 @@ const DateTime = (props: DateTimeProps) => {
59
57
  <FormattedDate
60
58
  showDayOfWeek={showDayOfWeek}
61
59
  size={size}
62
- timeZone={timeZone}
63
60
  value={datetime}
64
61
  />
65
62
  <Time
@@ -0,0 +1,110 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+
4
+ import DateTime from './_date_time'
5
+
6
+ const TEST_DATE = '01/01/2020 00:00:000 GMT-0500'
7
+ jest.setSystemTime(new Date(TEST_DATE));
8
+ const testId = 'datetime-kit'
9
+
10
+ const realDate = Date
11
+
12
+ beforeEach(() => {
13
+ global.Date.now = jest.fn(() => new Date(TEST_DATE).getTime());
14
+ })
15
+
16
+ afterEach(() => {
17
+ global.Date = realDate;
18
+ })
19
+
20
+ describe('DateTime Kit', () => {
21
+ test('renders DatePicker className', () => {
22
+ render(
23
+ <DateTime
24
+ data={{ testid: testId }}
25
+ datetime={new Date(Date.now())}
26
+ showDayOfWeek
27
+ showIcon
28
+ />
29
+ )
30
+
31
+ const kit = screen.getByTestId(testId)
32
+ expect(kit).toHaveClass('pb_date_time_md')
33
+ })
34
+ test('renders DatePicker text left', () => {
35
+ render(
36
+ <DateTime
37
+ data={{ testid: testId }}
38
+ datetime={new Date(Date.now())}
39
+ showDayOfWeek
40
+ showIcon
41
+ />
42
+ )
43
+
44
+ const kit = screen.getByTestId(testId)
45
+ const text = kit.querySelector('.pb_date_kit_left')
46
+ expect(text.textContent).toEqual('Wed • Jan 1')
47
+ })
48
+ test('renders DatePicker text right', () => {
49
+ render(
50
+ <DateTime
51
+ data={{ testid: testId }}
52
+ datetime={new Date(Date.now())}
53
+ showDayOfWeek
54
+ showIcon
55
+ />
56
+ )
57
+
58
+ const kit = screen.getByTestId(testId)
59
+ const text = kit.querySelector('.pb_time_kit_md.ml_sm')
60
+ const clock = kit.querySelector('.pb_icon_kit.far.fa-fw.fa-clock')
61
+
62
+ expect(clock).toBeInTheDocument()
63
+ expect(text.textContent).toEqual(' 12:00a EST')
64
+ })
65
+ test('renders DatePicker text right no icon', () => {
66
+ render(
67
+ <DateTime
68
+ data={{ testid: testId }}
69
+ datetime={new Date(Date.now())}
70
+ showDayOfWeek
71
+ />
72
+ )
73
+
74
+ const kit = screen.getByTestId(testId)
75
+ const clock = kit.querySelector('.pb_icon_kit.far.fa-fw.fa-clock')
76
+
77
+ expect(clock).toBeNull()
78
+ })
79
+ test('renders DatePicker text right timezone', () => {
80
+ render(
81
+ <DateTime
82
+ data={{ testid: testId }}
83
+ datetime={new Date(Date.now())}
84
+ showDayOfWeek
85
+ timeZone="Asia/Tokyo"
86
+ />
87
+ )
88
+
89
+ const kit = screen.getByTestId(testId)
90
+ const text = kit.querySelector('.pb_time_kit_md.ml_sm')
91
+
92
+ expect(text.textContent).toEqual('2:00p JST')
93
+ })
94
+ test('renders DatePicker size', () => {
95
+ render(
96
+ <DateTime
97
+ data={{ testid: testId }}
98
+ datetime={new Date(Date.now())}
99
+ showDayOfWeek
100
+ size="sm"
101
+ />
102
+ )
103
+
104
+ const kit = screen.getByTestId(testId)
105
+ const rightSide = kit.querySelector('.pb_time_kit_sm.ml_sm')
106
+
107
+ expect(kit).toHaveClass('pb_date_time_sm')
108
+ expect(rightSide).toBeInTheDocument()
109
+ })
110
+ })
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import DateTime from '../_date_time.jsx'
2
+ import DateTime from '../_date_time'
3
3
 
4
4
  const DateTimeAlign = (props) => (
5
5
  <div>
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import DateTime from '../_date_time.jsx'
2
+ import DateTime from '../_date_time'
3
3
 
4
4
  const DateTimeDefault = (props) => (
5
5
  <div>
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import DateTime from '../_date_time.jsx'
2
+ import DateTime from '../_date_time'
3
3
 
4
4
  const DateTimeDefault = (props) => (
5
5
  <div>
@@ -1,10 +1,8 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
 
6
4
  import DateTime from '../pb_kit/dateTime'
7
- import { buildCss } from '../utilities/props'
5
+ import { buildCss, buildDataProps } from '../utilities/props'
8
6
  import { globalProps } from '../utilities/globalProps'
9
7
 
10
8
  import Body from '../pb_body/_body'
@@ -12,7 +10,7 @@ import Title from '../pb_title/_title'
12
10
 
13
11
  type DateYearStackedProps = {
14
12
  align?: "left" | "center" | "right",
15
- className?: string | array<string>,
13
+ className?: string | string[],
16
14
  dark?: boolean,
17
15
  data?: string,
18
16
  date: string,
@@ -20,16 +18,18 @@ type DateYearStackedProps = {
20
18
  }
21
19
 
22
20
  const DateYearStacked = (props: DateYearStackedProps) => {
23
- const { align = 'left', className, dark = false, date } = props
21
+ const { align = 'left', className, dark = false, date, data={} } = props
24
22
  const dateTimestamp = new DateTime({ value: date })
25
23
  const css = classnames(
26
24
  buildCss('pb_date_year_stacked', align),
27
25
  globalProps(props),
28
26
  className
29
27
  )
28
+ const dataProps = buildDataProps(data)
30
29
 
31
30
  return (
32
- <div className={css}>
31
+ <div {...dataProps}
32
+ className={css}>
33
33
  <Title
34
34
  dark={dark}
35
35
  size={4}
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ import { render, screen } from "../utilities/test-utils";
3
+
4
+ import DateYearStacked from "./_date_year_stacked";
5
+
6
+ const TEST_DATE = "01/01/2020 00:00:000 GMT-0500";
7
+ jest.setSystemTime(new Date(TEST_DATE));
8
+ const testId = "dateyearstacked-kit";
9
+ const realDate = Date;
10
+
11
+ beforeEach(() => {
12
+ global.Date.now = jest.fn(() => new Date(TEST_DATE));
13
+ });
14
+
15
+ afterEach(() => {
16
+ global.Date = realDate;
17
+ });
18
+
19
+ describe("DateYearStacked Kit", () => {
20
+ test("renders DateYearStacked className", () => {
21
+ render(
22
+ <DateYearStacked
23
+ data={{ testid: testId }}
24
+ date={new Date(Date.now())} />
25
+ );
26
+
27
+ const kit = screen.getByTestId(testId);
28
+ expect(kit).toHaveClass("pb_date_year_stacked_left");
29
+ });
30
+
31
+ test("renders DateYearStacked text top", () => {
32
+ render(
33
+ <DateYearStacked
34
+ data={{ testid: testId }}
35
+ date={new Date(Date.now())} />
36
+ );
37
+
38
+ const kit = screen.getByTestId(testId);
39
+ const text = kit.querySelector(".pb_title_kit_size_4");
40
+ expect(text.textContent).toEqual("1 JAN");
41
+ });
42
+
43
+ test("renders DateYearStacked text bottom", () => {
44
+ render(
45
+ <DateYearStacked
46
+ data={{ testid: testId }}
47
+ date={new Date(Date.now())} />
48
+ );
49
+
50
+ const kit = screen.getByTestId(testId);
51
+ const text = kit.querySelector(".pb_body_kit_light");
52
+ expect(text.textContent).toEqual("2020");
53
+ });
54
+
55
+ test("renders align prop", () => {
56
+ render(
57
+ <DateYearStacked
58
+ align="center"
59
+ data={{ testid: testId }}
60
+ date={new Date(Date.now())}
61
+ />
62
+ );
63
+
64
+ const kit = screen.getByTestId(testId);
65
+ expect(kit).toHaveClass("pb_date_year_stacked_center");
66
+ });
67
+ });
@@ -37,7 +37,7 @@ type DialogProps = {
37
37
  opened: boolean,
38
38
  portalClassName?: string,
39
39
  shouldCloseOnOverlayClick: boolean,
40
- size?: "sm" | "md" | "lg" | "content",
40
+ size?: "sm" | "md" | "lg" | "status_size" | "content",
41
41
  status?: "info" | "caution" | "delete" | "error" | "success",
42
42
  text?: string,
43
43
  title?: string,
@@ -53,7 +53,7 @@ const Dialog = (props: DialogProps) => {
53
53
  className,
54
54
  data = {},
55
55
  id,
56
- size = 'md',
56
+ size = "md",
57
57
  children,
58
58
  loading = false,
59
59
  opened,
@@ -107,25 +107,35 @@ const Dialog = (props: DialogProps) => {
107
107
  }
108
108
 
109
109
  const sweetAlertStatus = {
110
- info: {
110
+ default: {
111
111
  icon: "exclamation-circle",
112
112
  variant: "default",
113
+ size: "lg"
114
+ },
115
+ info: {
116
+ icon: "info-circle",
117
+ variant: "default",
118
+ size: "lg"
113
119
  },
114
120
  caution: {
115
- icon: "triangle-warning",
121
+ icon: "exclamation-triangle",
116
122
  variant: "yellow",
123
+ size: "lg"
117
124
  },
118
125
  delete: {
119
- icon: "trash",
126
+ icon: "trash-alt",
120
127
  variant: "red",
128
+ size: "lg"
121
129
  },
122
130
  error: {
123
131
  icon: "times-circle",
124
132
  variant: "red",
133
+ size: "lg"
125
134
  },
126
135
  success: {
127
136
  icon: "check-circle",
128
137
  variant: "green",
138
+ size: "lg"
129
139
  },
130
140
  }
131
141
 
@@ -150,27 +160,35 @@ const Dialog = (props: DialogProps) => {
150
160
  shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
151
161
  status={status}
152
162
  >
153
- <If condition={title}>
163
+ <If condition={title && !status}>
154
164
  <Dialog.Header>{title}</Dialog.Header>
155
165
  </If>
156
166
  <If condition={!status && text}>
157
- <Dialog.Body>{text}</Dialog.Body>
167
+ <Dialog.Body>
168
+ {text}
169
+ </Dialog.Body>
158
170
  </If>
159
171
  <If condition={status}>
160
- <Dialog.Body>
161
- <Flex align='center'
162
- orientation='column'
172
+ <Dialog.Body
173
+ padding="md"
174
+ >
175
+ <Flex
176
+ align="center"
177
+ orientation="column"
163
178
  >
164
179
  <IconCircle
165
180
  icon={sweetAlertStatus[status].icon}
181
+ size={sweetAlertStatus[status].size}
166
182
  variant={sweetAlertStatus[status].variant}
167
183
  />
168
- <Title marginY='sm'
184
+ <Title
185
+ marginTop="sm"
169
186
  size={3}
170
187
  >
171
188
  {title}
172
189
  </Title>
173
- <Body marginY='xs'
190
+ <Body
191
+ marginTop="xs"
174
192
  text={text}
175
193
  />
176
194
  </Flex>
@@ -184,9 +202,9 @@ const Dialog = (props: DialogProps) => {
184
202
  >
185
203
  {confirmButton}
186
204
  </Button>
187
- <Button id='cancel-button'
205
+ <Button id="cancel-button"
188
206
  onClick={onCancel}
189
- variant='link'
207
+ variant="link"
190
208
  >
191
209
  {cancelButton}
192
210
  </Button>
@@ -59,6 +59,7 @@
59
59
  // Local Variables
60
60
  $gutter: $space_lg;
61
61
  $small: 300px;
62
+ $status_size: 375px;
62
63
  $medium: 500px;
63
64
  $large: 800px;
64
65
  $animation-duration: 0.2s;
@@ -78,6 +79,10 @@
78
79
  outline: none;
79
80
  animation-timing-function: $easeInOutQuint;
80
81
 
82
+ &[class*="_status_size"] {
83
+ width: $status_size;
84
+ }
85
+
81
86
  &[class*="_sm"] {
82
87
  width: $small;
83
88
  }
@@ -7,8 +7,8 @@ import { globalProps } from '../../utilities/globalProps'
7
7
 
8
8
  // Body component
9
9
  const DialogBody = (props: DialogBodyProps) => {
10
- const { children, padding = 'sm', className } = props
11
- const bodyCSS = buildCss('dialog_body')
10
+ const { children, padding = "sm", className } = props
11
+ const bodyCSS = buildCss("dialog_body")
12
12
  const bodySpacing = globalProps(props, { padding })
13
13
 
14
14
  return (
@@ -9,17 +9,35 @@ import { globalProps } from '../../utilities/globalProps'
9
9
  import Flex from '../../pb_flex/_flex'
10
10
  import SectionSeparator from '../../pb_section_separator/_section_separator'
11
11
 
12
+
13
+ type DialogFooterProps = {
14
+ aria?: object,
15
+ children: array<React.ReactNode> | React.ReactNode | string,
16
+ className?: string,
17
+ closeable: boolean,
18
+ data?: object,
19
+ id?: string,
20
+ padding?: string,
21
+ paddingBottom?: string,
22
+ paddingX?: string,
23
+ separator: boolean,
24
+ spacing?: string,
25
+ }
26
+
12
27
  // Footer component
13
28
  const DialogFooter = (props: DialogFooterProps) => {
14
29
  const {
15
30
  children,
16
- padding = 'sm',
31
+ padding = "sm",
32
+ paddingBottom = "sm",
33
+ paddingX = "sm",
17
34
  className,
18
- spacing = 'between',
35
+ spacing = "between",
19
36
  separator = false,
20
37
  } = props
21
- const footerCSS = buildCss('dialog_footer')
22
- const footerSpacing = globalProps(props, { padding })
38
+
39
+ const footerCSS = buildCss("dialog_footer")
40
+ const footerSpacing = globalProps(props, { padding, paddingBottom, paddingX })
23
41
 
24
42
  return (
25
43
  <>
@@ -30,8 +30,8 @@ const DialogHeader = (props: DialogHeaderProps) => {
30
30
  children,
31
31
  className,
32
32
  data = {},
33
- padding = 'sm',
34
- spacing = 'between',
33
+ padding = "sm",
34
+ spacing = "between",
35
35
  closeable = true,
36
36
  separator = true,
37
37
  } = props
@@ -39,7 +39,7 @@ const DialogHeader = (props: DialogHeaderProps) => {
39
39
  const ariaProps = buildAriaProps(aria)
40
40
  const dataProps = buildDataProps(data)
41
41
  const api = useContext(DialogContext)
42
- const headerCSS = buildCss('dialog_header')
42
+ const headerCSS = buildCss("dialog_header")
43
43
  const headerSpacing = globalProps(props, { padding })
44
44
 
45
45
  /* eslint-disable react/jsx-handler-names */