playbook_ui 15.4.0.pre.alpha.PLAY2429datepickeropenonscreenstatic12263 → 15.4.0.pre.alpha.PLAY2556advancedtablefirstcolumnborder12527

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 (138) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +96 -6
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +163 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +190 -0
  5. data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +21 -8
  6. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_icon_variant.jsx +24 -0
  7. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_icon_variant_react.md +1 -0
  8. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +1 -0
  9. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +1 -0
  10. data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.md +1 -0
  11. data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_rails.md +1 -0
  12. data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_react.md +1 -0
  13. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +10 -0
  14. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +10 -0
  15. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.md +1 -0
  16. data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_rails.md +1 -0
  17. data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_react.md +1 -0
  18. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +7 -0
  19. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +7 -0
  20. data/app/pb_kits/playbook/pb_currency/docs/_description.md +2 -2
  21. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +25 -11
  22. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +20 -13
  23. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.rb +6 -4
  24. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +17 -0
  25. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.html.erb +4 -0
  26. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.jsx +43 -0
  27. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.md +1 -0
  28. data/app/pb_kits/playbook/pb_date_range_inline/docs/_description.md +1 -1
  29. data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +3 -2
  30. data/app/pb_kits/playbook/pb_date_range_inline/docs/index.js +1 -0
  31. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +6 -4
  32. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +2 -3
  33. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.rb +11 -5
  34. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.test.js +26 -9
  35. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_current_year.html.erb +12 -0
  36. data/app/pb_kits/playbook/pb_date_stacked/docs/{_date_stacked_not_current_year.jsx → _date_stacked_current_year.jsx} +6 -5
  37. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_current_year.md +1 -0
  38. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.html.erb +1 -1
  39. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.jsx +1 -1
  40. data/app/pb_kits/playbook/pb_date_stacked/docs/_description.md +1 -1
  41. data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +2 -2
  42. data/app/pb_kits/playbook/pb_date_stacked/docs/index.js +1 -1
  43. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +3 -0
  44. data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -0
  45. data/app/pb_kits/playbook/pb_date_time/date_time.rb +1 -0
  46. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +4 -0
  47. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +14 -0
  48. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +1 -0
  49. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +1 -0
  50. data/app/pb_kits/playbook/pb_date_time/docs/example.yml +3 -1
  51. data/app/pb_kits/playbook/pb_date_time/docs/index.js +1 -0
  52. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +3 -0
  53. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +2 -2
  54. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -0
  55. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +33 -0
  56. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +4 -0
  57. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +22 -0
  58. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +1 -0
  59. data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +3 -1
  60. data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +1 -0
  61. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +2 -2
  62. data/app/pb_kits/playbook/pb_dropdown/index.js +1 -1
  63. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +31 -9
  64. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +12 -5
  65. data/app/pb_kits/playbook/pb_flex/docs/_flex_item_example.jsx +1 -0
  66. data/app/pb_kits/playbook/pb_nav/_item.tsx +18 -4
  67. data/app/pb_kits/playbook/pb_nav/_nav.scss +30 -5
  68. data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +192 -0
  69. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  70. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.html.erb +21 -0
  71. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.jsx +113 -0
  72. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.md +1 -0
  73. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.html.erb +30 -0
  74. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.jsx +117 -0
  75. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.md +1 -0
  76. data/app/pb_kits/playbook/pb_nav/docs/example.yml +4 -0
  77. data/app/pb_kits/playbook/pb_nav/docs/index.js +3 -1
  78. data/app/pb_kits/playbook/pb_nav/item.html.erb +6 -4
  79. data/app/pb_kits/playbook/pb_nav/item.rb +11 -2
  80. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_description.md +3 -1
  81. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.md +1 -0
  82. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.html.erb +1 -1
  83. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.md +11 -0
  84. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_description.md +3 -1
  85. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.md +2 -1
  86. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.md +1 -0
  87. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_description.md +3 -1
  88. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.md +2 -2
  89. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_default.md +1 -0
  90. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_description.md +3 -1
  91. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_default.md +1 -0
  92. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_legend_position.html.erb +1 -1
  93. data/app/pb_kits/playbook/pb_progress_step/_progress_step.scss +384 -262
  94. data/app/pb_kits/playbook/pb_progress_step/docs/_description.md +1 -5
  95. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.html.erb +14 -0
  96. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.jsx +29 -0
  97. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.md +3 -0
  98. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.jsx +31 -0
  99. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.md +1 -0
  100. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.html.erb +4 -1
  101. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.jsx +14 -3
  102. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.md +3 -0
  103. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tracker.md +3 -0
  104. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.html.erb +1 -7
  105. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.md +1 -0
  106. data/app/pb_kits/playbook/pb_progress_step/docs/example.yml +3 -0
  107. data/app/pb_kits/playbook/pb_progress_step/docs/index.js +2 -0
  108. data/app/pb_kits/playbook/pb_progress_step/progress_step.test.js +41 -0
  109. data/app/pb_kits/playbook/pb_table/_table.tsx +28 -26
  110. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +49 -0
  111. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
  112. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -0
  113. data/app/pb_kits/playbook/utilities/_truncate.scss +2 -0
  114. data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
  115. data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
  116. data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
  117. data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
  118. data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
  119. data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
  120. data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
  121. data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
  122. data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
  123. data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
  124. data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
  125. data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
  126. data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
  127. data/dist/chunks/{_line_graph-W9CX7Xbp.js → _line_graph-Co6PvNPL.js} +1 -1
  128. data/dist/chunks/_typeahead-D0OX5RuZ.js +6 -0
  129. data/dist/chunks/{_weekday_stacked-DOs7l1vE.js → _weekday_stacked-HzVLtvcd.js} +3 -3
  130. data/dist/chunks/vendor.js +1 -1
  131. data/dist/playbook-doc.js +1 -1
  132. data/dist/playbook-rails-react-bindings.js +1 -1
  133. data/dist/playbook-rails.js +1 -1
  134. data/dist/playbook.css +1 -1
  135. data/lib/playbook/version.rb +1 -1
  136. metadata +45 -7
  137. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year.html.erb +0 -5
  138. data/dist/chunks/_typeahead-L4SF9E6a.js +0 -6
@@ -17,6 +17,7 @@ type DateTimeProps = {
17
17
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
18
18
  id?: string,
19
19
  size?: "sm" | "md",
20
+ showCurrentYear?: boolean,
20
21
  showDayOfWeek: boolean,
21
22
  showIcon?: boolean,
22
23
  timeZone?: string
@@ -32,6 +33,7 @@ const DateTime = (props: DateTimeProps): React.ReactElement => {
32
33
  showDayOfWeek = false,
33
34
  datetime,
34
35
  id,
36
+ showCurrentYear = false,
35
37
  showIcon = false,
36
38
  size = 'md',
37
39
  timeZone = 'America/New_York',
@@ -59,6 +61,7 @@ const DateTime = (props: DateTimeProps): React.ReactElement => {
59
61
  vertical="baseline"
60
62
  >
61
63
  <FormattedDate
64
+ showCurrentYear={showCurrentYear}
62
65
  showDayOfWeek={showDayOfWeek}
63
66
  size={size}
64
67
  value={datetime}
@@ -9,6 +9,7 @@
9
9
  dark: object.dark,
10
10
  date: object.date,
11
11
  show_day_of_week: object.show_day_of_week,
12
+ show_current_year: object.show_current_year,
12
13
  size: object.size,
13
14
  timezone: object.timezone,
14
15
  }) %>
@@ -16,6 +16,7 @@ module Playbook
16
16
  prop :dark, type: Playbook::Props::Boolean, default: false
17
17
  prop :show_icon, type: Playbook::Props::Boolean, default: false
18
18
  prop :show_day_of_week, type: Playbook::Props::Boolean, default: false
19
+ prop :show_current_year, type: Playbook::Props::Boolean, default: false
19
20
 
20
21
  def classname
21
22
  generate_classname("pb_date_time_kit", align)
@@ -0,0 +1,4 @@
1
+ <%= pb_rails("date_time", props: {
2
+ date: DateTime.now,
3
+ show_current_year: true
4
+ }) %>
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import DateTime from '../_date_time'
3
+
4
+ const DateTimeShowCurrentYear = (props) => (
5
+ <div>
6
+ <DateTime
7
+ datetime={new Date()}
8
+ showCurrentYear
9
+ {...props}
10
+ />
11
+ </div>
12
+ )
13
+
14
+ export default DateTimeShowCurrentYear
@@ -0,0 +1 @@
1
+ Pass in `show_current_year` to show this date's current year.
@@ -0,0 +1 @@
1
+ Pass in `showCurrentYear` to show this date's current year.
@@ -1,14 +1,16 @@
1
1
  examples:
2
-
2
+
3
3
  rails:
4
4
  - date_time_default: Default
5
5
  - date_time_align: Alignment
6
6
  - date_time_size: Size
7
+ - date_time_show_current_year: Show Current Year
7
8
 
8
9
  react:
9
10
  - date_time_default: Default
10
11
  - date_time_align: Alignment
11
12
  - date_time_size: Size
13
+ - date_time_show_current_year: Show Current Year
12
14
 
13
15
  swift:
14
16
  - date_time_default_swift: Default
@@ -1,3 +1,4 @@
1
1
  export { default as DateTimeDefault } from './_date_time_default.jsx'
2
2
  export { default as DateTimeAlign } from './_date_time_align.jsx'
3
3
  export { default as DateTimeSize } from './_date_time_size.jsx'
4
+ export { default as DateTimeShowCurrentYear } from './_date_time_show_current_year.jsx'
@@ -17,6 +17,7 @@ type DateTimeStackedProps = {
17
17
  datetime: Date,
18
18
  dark: boolean,
19
19
  timeZone?: string,
20
+ showCurrentYear?: boolean,
20
21
  }
21
22
 
22
23
  const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
@@ -28,6 +29,7 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
28
29
  dark,
29
30
  htmlOptions = {},
30
31
  timeZone = 'America/New_York',
32
+ showCurrentYear = false,
31
33
  } = props
32
34
 
33
35
  const classes = buildCss('pb_date_time_stacked_kit', globalProps(props))
@@ -46,6 +48,7 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
46
48
  bold
47
49
  dark={dark}
48
50
  date={date || datetime}
51
+ showCurrentYear={showCurrentYear}
49
52
  />
50
53
  </FlexItem>
51
54
 
@@ -1,8 +1,8 @@
1
- <%= pb_content_tag do %>
1
+ <%= pb_content_tag do %>
2
2
 
3
3
  <%= pb_rails("flex", props: {classname: "flex-container", vertical: "stretch"}) do %>
4
4
  <%= pb_rails("body", props: {classname: "flex-item"}) do %>
5
- <%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark }) %>
5
+ <%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark, show_current_year: object.show_current_year }) %>
6
6
  <% end %>
7
7
  <%= pb_rails("section_separator", props: { orientation: "vertical", classname: "date-time-padding" }) %>
8
8
  <%= pb_rails("body", props: {classname: "flex-item"}) do %>
@@ -10,6 +10,8 @@ module Playbook
10
10
  default: false
11
11
  prop :timezone, type: Playbook::Props::String,
12
12
  default: "America/New_York"
13
+ prop :show_current_year, type: Playbook::Props::Boolean,
14
+ default: false
13
15
 
14
16
  def date_time_value
15
17
  date || date_time
@@ -41,3 +41,36 @@ test('renders time in timezone', () => {
41
41
  const kit = renderKit(DateTimeStacked, props)
42
42
  expect(kit).toHaveTextContent(`${monthDayYear}11:00aMDT`)
43
43
  })
44
+
45
+ test('renders current year when showCurrentYear is true', () => {
46
+ const currentYearDate = new Date()
47
+ const currentYear = currentYearDate.getFullYear()
48
+
49
+ const kit = renderKit(DateTimeStacked, {
50
+ data: { testid: 'datetimestacked-current-year' },
51
+ datetime: currentYearDate,
52
+ dark: false,
53
+ showCurrentYear: true,
54
+ })
55
+ expect(kit).toHaveTextContent(currentYear.toString())
56
+ })
57
+
58
+ test('hides current year by default', () => {
59
+ const currentYearDate = new Date()
60
+ const currentYear = currentYearDate.getFullYear()
61
+
62
+ const kit = renderKit(DateTimeStacked, {
63
+ data: { testid: 'datetimestacked-hide-year' },
64
+ datetime: currentYearDate,
65
+ dark: false,
66
+ })
67
+
68
+ const yearElement = kit.querySelector('.pb_caption_kit_xs')
69
+
70
+ if (yearElement) {
71
+ expect(yearElement.textContent).not.toBe(currentYear.toString())
72
+ } else {
73
+
74
+ expect(yearElement).toBeNull()
75
+ }
76
+ })
@@ -0,0 +1,4 @@
1
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now, show_current_year: true }) %>
2
+ <br>
3
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now, show_current_year: true, timezone: "America/Denver" }) %>
4
+
@@ -0,0 +1,22 @@
1
+ import React from 'react'
2
+
3
+ import DateTimeStacked from '../_date_time_stacked'
4
+
5
+ const DateTimeStackedShowCurrentYear = (props) => (
6
+ <div>
7
+ <DateTimeStacked
8
+ datetime={new Date()}
9
+ showCurrentYear
10
+ {...props}
11
+ />
12
+ <br />
13
+ <DateTimeStacked
14
+ datetime={new Date()}
15
+ showCurrentYear
16
+ timeZone="America/Denver"
17
+ {...props}
18
+ />
19
+ </div>
20
+ );
21
+
22
+ export default DateTimeStackedShowCurrentYear;
@@ -0,0 +1 @@
1
+ By default, the Date Time Stacked kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true as shown here.
@@ -2,9 +2,11 @@ examples:
2
2
 
3
3
  rails:
4
4
  - date_time_stacked_default: Default
5
-
5
+ - date_time_stacked_show_current_year: Show Current Year
6
+
6
7
  react:
7
8
  - date_time_stacked_default: Default
9
+ - date_time_stacked_show_current_year: Show Current Year
8
10
 
9
11
  swift:
10
12
  - date_time_stacked_default_swift: Default
@@ -1 +1,2 @@
1
1
  export { default as DateTimeStackedDefault } from './_date_time_stacked_default.jsx'
2
+ export { default as DateTimeStackedShowCurrentYear } from './_date_time_stacked_show_current_year.jsx'
@@ -1,7 +1,7 @@
1
1
  <%= pb_rails("button", props: { text: "Open Complex Dialog", data:{"open-dialog": "dialog-complex"} }) %>
2
2
 
3
3
  <%= pb_rails("dialog", props: { id:"dialog-complex", size: "lg", full_height: true }) do %>
4
- <form>
4
+ <%= pb_form_with(scope: :example, method: :get, url: "", options: { remote: true }) do |form| %>
5
5
  <%= pb_rails("dialog/dialog_header", props: { id: "dialog-complex" } ) do %>
6
6
  <%= pb_rails("body", props: { text: "What do you need us to take care of?" }) %>
7
7
  <% end %>
@@ -13,5 +13,5 @@
13
13
 
14
14
  <% end %>
15
15
  <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-complex"}) %>
16
- </form>
16
+ <% end %>
17
17
  <% end %>
@@ -126,7 +126,7 @@ export default class PbDropdown extends PbEnhancedElement {
126
126
  .label.toString()
127
127
  .toLowerCase();
128
128
 
129
- // hide or show option
129
+ // hide or show option
130
130
  const match = label.includes(lcTerm);
131
131
  opt.style.display = match ? "" : "none";
132
132
  if (match) hasMatch = true
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from "react";
1
+ import React, { useEffect, useState, useRef } from "react";
2
2
  import classnames from "classnames";
3
3
 
4
4
  import { globalProps, GlobalProps } from "../utilities/globalProps";
@@ -36,6 +36,7 @@ type FixedConfirmationToastProps = {
36
36
 
37
37
  const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.ReactElement => {
38
38
  const [showToast, toggleToast] = useState(true);
39
+ const timeoutRef = useRef<NodeJS.Timeout | null>(null);
39
40
 
40
41
  const {
41
42
  autoClose = 0,
@@ -67,21 +68,42 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
67
68
 
68
69
  const htmlProps = buildHtmlProps(htmlOptions);
69
70
 
70
- const autoCloseToast = () => {
71
- if (autoClose && open) {
72
- setTimeout(() => {
71
+ useEffect(() => {
72
+ toggleToast(open);
73
+ }, [open]);
74
+
75
+ // Manage auto-close timeout separately
76
+ useEffect(() => {
77
+ // Clear any existing timeout
78
+ if (timeoutRef.current) {
79
+ clearTimeout(timeoutRef.current);
80
+ timeoutRef.current = null;
81
+ }
82
+
83
+ // Set new timeout if autoClose is enabled and toast is open
84
+ if (autoClose && open && showToast) {
85
+ timeoutRef.current = setTimeout(() => {
73
86
  toggleToast(false);
74
87
  onClose();
88
+ timeoutRef.current = null;
75
89
  }, autoClose);
76
90
  }
77
- };
78
91
 
79
- useEffect(() => {
80
- toggleToast(open);
81
- autoCloseToast();
82
- }, [open]);
92
+ // Cleanup function to clear timeout on unmount or when dependencies change
93
+ return () => {
94
+ if (timeoutRef.current) {
95
+ clearTimeout(timeoutRef.current);
96
+ timeoutRef.current = null;
97
+ }
98
+ };
99
+ }, [autoClose, open, showToast, onClose]);
83
100
 
84
101
  const handleClick = () => {
102
+ // Clear autoClose timeout when manually closing
103
+ if (timeoutRef.current) {
104
+ clearTimeout(timeoutRef.current);
105
+ timeoutRef.current = null;
106
+ }
85
107
  toggleToast(!closeable);
86
108
  onClose();
87
109
  };
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildCss, buildHtmlProps } from '../utilities/props'
4
4
  import { globalProps, GlobalProps, globalInlineProps} from '../utilities/globalProps'
5
+
5
6
  type FlexItemPropTypes = {
6
7
  children: React.ReactNode[] | React.ReactNode,
7
8
  fixedSize?: string,
@@ -28,22 +29,28 @@ const FlexItem = (props: FlexItemPropTypes): React.ReactElement => {
28
29
  alignSelf,
29
30
  displayFlex
30
31
  } = props
32
+
31
33
  const growClass = grow === true ? 'pb_flex_item_kit_grow' : ''
32
34
  const displayFlexClass = displayFlex === true ? 'pb_flex_item_kit_display_flex' : ''
33
35
  const flexClass = flex !== 'none' ? `pb_flex_item_kit_flex_${flex}` : ''
34
36
  const shrinkClass = shrink === true ? 'pb_flex_item_kit_shrink' : ''
35
37
  const alignSelfClass = alignSelf ? `pb_flex_item_kit_align_self_${alignSelf}` : ''
36
- const fixedStyle =
37
- fixedSize !== undefined ? { flexBasis: `${fixedSize}` } : null
38
+ const fixedStyle = fixedSize !== undefined ? { flexBasis: `${fixedSize}` } : null
38
39
  const orderClass = order !== 'none' ? `pb_flex_item_kit_order_${order}` : ''
39
40
  const dynamicInlineProps = globalInlineProps(props)
41
+
42
+ // Extract style from htmlOptions and remove it
43
+ const { style: htmlStyle, ...htmlOptionsWithoutStyle } = htmlOptions
44
+ const htmlStyleObj = htmlStyle && typeof htmlStyle === 'object' ? htmlStyle : {}
45
+
46
+ // Merge all styles
40
47
  const combinedStyles = {
48
+ ...htmlStyleObj,
41
49
  ...fixedStyle,
42
50
  ...dynamicInlineProps
43
51
  }
44
52
 
45
- const htmlProps = buildHtmlProps(htmlOptions)
46
-
53
+ const htmlProps = buildHtmlProps(htmlOptionsWithoutStyle)
47
54
 
48
55
  return (
49
56
  <div
@@ -66,4 +73,4 @@ const FlexItem = (props: FlexItemPropTypes): React.ReactElement => {
66
73
  )
67
74
  }
68
75
 
69
- export default FlexItem
76
+ export default FlexItem
@@ -15,6 +15,7 @@ const FlexItemExample = (props) => {
15
15
  <FlexItem
16
16
  displayFlex
17
17
  gap="xs"
18
+ htmlOptions={{style: {padding:"2px"}}}
18
19
  {...props}
19
20
  >
20
21
  <FlexItem>
@@ -43,6 +43,7 @@ type NavItemProps = {
43
43
  marginLeft?: Spacing;
44
44
  marginX?: Spacing;
45
45
  marginY?: Spacing;
46
+ disabled?: boolean;
46
47
  } & GlobalProps;
47
48
 
48
49
  const NavItem = (props: NavItemProps) => {
@@ -89,6 +90,7 @@ const NavItem = (props: NavItemProps) => {
89
90
  marginLeft,
90
91
  marginX,
91
92
  marginY,
93
+ disabled = false,
92
94
  } = props;
93
95
 
94
96
  const spacingMarginProps = {
@@ -140,11 +142,12 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
140
142
  delete filteredProps?.marginLeft;
141
143
 
142
144
 
143
- const isLink = !!link
145
+ const isLink = !!link && !disabled
144
146
  const Tag = isLink ? "a" : "div"
145
147
  const activeClass = active === true ? "active" : "";
146
148
  const highlightedBorderClass = active === true && highlighted_border === false ? "highlighted_border_none" : "";
147
149
  const collapsibleTrailClass = collapsible && collapsibleTrail ? "collapsible_trail" : "";
150
+ const disabledClass = disabled ? "pb_nav_item_disabled" : "";
148
151
 
149
152
  const fontSizeMapping = {
150
153
  "small": "font_size_small",
@@ -177,6 +180,7 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
177
180
  fontWeightClass,
178
181
  tagClasses,
179
182
  collapsible ? globalProps(filteredProps, {...filteredPadding}) : globalProps(props, {...itemSpacing}),
183
+ disabledClass,
180
184
  className
181
185
  );
182
186
 
@@ -202,12 +206,21 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
202
206
  const collapsibleClasses = buildCss("collapsible_nav_wrapper", activeClass, highlightedBorderClass, collapsibleTrailClass)
203
207
 
204
208
  const handleKeyDown = (e: React.KeyboardEvent) => {
205
- if (!isLink && (e.key === "Enter" || e.key === " ")) {
209
+ if (!disabled && !isLink && (e.key === "Enter" || e.key === " ")) {
206
210
  e.preventDefault()
207
211
  onClick?.()
208
212
  }
209
213
  }
210
214
 
215
+ const handleClick = (e: React.MouseEvent) => {
216
+ if (disabled) {
217
+ e.preventDefault()
218
+ e.stopPropagation()
219
+ return
220
+ }
221
+ onClick?.()
222
+ }
223
+
211
224
  return (
212
225
  <>
213
226
  {collapsible ? (
@@ -275,13 +288,14 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
275
288
  {...ariaProps}
276
289
  {...dataProps}
277
290
  {...htmlProps}
291
+ aria-disabled={disabled}
278
292
  className={classes}
279
293
  href={isLink ? link : undefined}
280
294
  id={id}
281
- onClick={onClick}
295
+ onClick={handleClick}
282
296
  onKeyDown={!isLink ? handleKeyDown : undefined}
283
297
  role={!isLink ? "button" : undefined}
284
- tabIndex={!isLink ? 0 : undefined}
298
+ tabIndex={disabled ? -1 : (!isLink ? 0 : undefined)}
285
299
  target={isLink ? target : undefined}
286
300
  >
287
301
  {imageUrl && (
@@ -45,16 +45,18 @@
45
45
 
46
46
  [class*="pb_nav_list_kit_item"],
47
47
  [class*="pb_nav_list_item"] {
48
- &:hover { cursor: pointer; }
48
+ &:hover {
49
+ cursor: pointer;
50
+ }
49
51
  }
50
52
  }
51
53
 
52
54
  .pb_nav_extended_underline {
53
55
  position: relative;
54
-
56
+
55
57
  // Add full-width border using pseudo-element so as not to break the active item border
56
58
  &::after {
57
- content: '';
59
+ content: "";
58
60
  position: absolute;
59
61
  bottom: 0;
60
62
  left: 0;
@@ -65,8 +67,8 @@
65
67
  }
66
68
 
67
69
  .pb_nav_list_kit_item_active.pb_nav_list_item_link {
68
- position: relative;
69
- z-index: 2;
70
+ position: relative;
71
+ z-index: 2;
70
72
  }
71
73
 
72
74
  &.dark {
@@ -75,3 +77,26 @@
75
77
  }
76
78
  }
77
79
  }
80
+
81
+ // Disabled scss
82
+ .pb_nav_item_disabled {
83
+ cursor: not-allowed !important;
84
+ .pb_nav_list_item_text,
85
+ .pb_nav_list_item_icon_left,
86
+ .pb_nav_list_item_icon_right,
87
+ .pb_nav_list_item_icon_section {
88
+ color: $text_lt_lighter !important;
89
+ cursor: not-allowed !important;
90
+ }
91
+ @media (hover: hover) {
92
+ &:hover {
93
+ background-color: unset !important;
94
+ color: $text_lt_lighter !important;
95
+ .pb_nav_list_item_text,
96
+ .pb_nav_list_item_icon_left,
97
+ .pb_nav_list_item_icon_right {
98
+ color: $text_lt_lighter !important;
99
+ }
100
+ }
101
+ }
102
+ }