playbook_ui 15.6.0 → 15.7.0.pre.rc.1

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
  3. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
  4. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +2 -2
  5. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +10 -8
  6. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +0 -1
  7. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -3
  8. data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +24 -0
  9. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +181 -3
  10. data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
  11. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +316 -15
  12. data/app/pb_kits/playbook/pb_draggable/context/types.ts +1 -1
  13. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.tsx +3 -3
  14. data/app/pb_kits/playbook/pb_radio/docs/_radio_error.md +1 -1
  15. data/app/pb_kits/playbook/pb_select/_select.tsx +8 -3
  16. data/app/pb_kits/playbook/pb_select/docs/_select_error.md +1 -1
  17. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.html.erb +16 -0
  18. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.jsx +30 -0
  19. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.md +1 -0
  20. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  21. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  22. data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
  23. data/app/pb_kits/playbook/pb_select/select.rb +3 -1
  24. data/app/pb_kits/playbook/pb_select/select.test.js +23 -0
  25. data/app/pb_kits/playbook/pb_table/_table.tsx +187 -33
  26. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx +134 -0
  27. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md +34 -0
  28. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb +101 -0
  29. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +33 -0
  30. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx +180 -0
  31. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.md +3 -0
  32. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.html.erb +122 -0
  33. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.md +3 -0
  34. data/app/pb_kits/playbook/pb_table/docs/example.yml +4 -0
  35. data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
  36. data/app/pb_kits/playbook/pb_table/table.html.erb +68 -12
  37. data/app/pb_kits/playbook/pb_table/table.rb +22 -3
  38. data/app/pb_kits/playbook/pb_table/table.test.js +143 -0
  39. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.md +1 -1
  40. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.md +1 -1
  41. data/app/pb_kits/playbook/pb_timeline/_item.tsx +3 -0
  42. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.html.erb +60 -0
  43. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.jsx +118 -0
  44. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.md +1 -0
  45. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -1
  46. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +2 -0
  47. data/app/pb_kits/playbook/pb_timeline/docs/index.js +1 -0
  48. data/app/pb_kits/playbook/pb_timeline/item.html.erb +1 -1
  49. data/app/pb_kits/playbook/pb_timeline/item.rb +2 -0
  50. data/app/pb_kits/playbook/pb_timeline/label.html.erb +2 -1
  51. data/app/pb_kits/playbook/pb_timeline/label.rb +2 -0
  52. data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +3 -0
  53. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +51 -0
  54. data/app/pb_kits/playbook/tokens/_colors.scss +2 -1
  55. data/app/pb_kits/playbook/utilities/deprecated.ts +73 -0
  56. data/dist/chunks/_typeahead-CHwm9MTE.js +6 -0
  57. data/dist/chunks/lib-Cugvy62C.js +29 -0
  58. data/dist/chunks/vendor.js +2 -2
  59. data/dist/playbook-rails-react-bindings.js +1 -1
  60. data/dist/playbook-rails.js +1 -1
  61. data/dist/playbook.css +1 -1
  62. data/lib/playbook/forms/builder/collection_select_field.rb +9 -1
  63. data/lib/playbook/forms/builder/select_field.rb +9 -1
  64. data/lib/playbook/forms/builder/time_zone_select_field.rb +9 -1
  65. data/lib/playbook/pb_kit_helper.rb +35 -0
  66. data/lib/playbook/version.rb +2 -2
  67. metadata +19 -4
  68. data/dist/chunks/_typeahead-DecTL7bt.js +0 -6
  69. data/dist/chunks/lib-Dk4GKPut.js +0 -29
@@ -0,0 +1,60 @@
1
+ <%= pb_rails("timeline", props: {orientation: "horizontal", show_date: true}) do %>
2
+ <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal", line_style: "solid", date: Date.today, show_current_year: true }) do %>
3
+ <%= pb_rails("title_detail", props: {
4
+ title: "Jackson Heights",
5
+ detail: "37-27 74th Street"
6
+ }) %>
7
+ <% end %>
8
+ <%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted" }) do %>
9
+ <%= pb_rails("title_detail", props: {
10
+ title: "Greenpoint",
11
+ detail: "81 Gate St Brooklyn"
12
+ }) %>
13
+ <% end %>
14
+ <%= pb_rails("timeline/item", props: { line_style: "solid"}) do |item| %>
15
+ <% item.label do %>
16
+ <%= pb_rails("timeline/label", props: { date: Date.today, show_current_year: true }) %>
17
+ <% end %>
18
+ <% item.step do %>
19
+ <%= pb_rails("timeline/step", props: { icon: 'map-marker-alt', icon_color: 'purple' }) %>
20
+ <% end %>
21
+ <% item.detail do %>
22
+ <%= pb_rails("title_detail", props: {
23
+ title: "Society Hill",
24
+ detail: "72 E St Astoria"
25
+ }) %>
26
+ <% end %>
27
+ <% end %>
28
+ <% end %>
29
+
30
+ <br /><br /><br />
31
+
32
+ <%= pb_rails("timeline", props: {orientation: "vertical", show_date: true}) do %>
33
+ <%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal", line_style: "solid", date: Date.today, show_current_year: true }) do %>
34
+ <%= pb_rails("title_detail", props: {
35
+ title: "Jackson Heights",
36
+ detail: "37-27 74th Street"
37
+ }) %>
38
+ <% end %>
39
+ <%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted" }) do %>
40
+ <%= pb_rails("title_detail", props: {
41
+ title: "Greenpoint",
42
+ detail: "81 Gate St Brooklyn"
43
+ }) %>
44
+ <% end %>
45
+ <%= pb_rails("timeline/item", props: { line_style: "solid"}) do |item| %>
46
+ <% item.label do %>
47
+ <%= pb_rails("timeline/label", props: { date: Date.today, show_current_year: true }) %>
48
+ <% end %>
49
+ <% item.step do %>
50
+ <%= pb_rails("timeline/step", props: { icon: 'map-marker-alt', icon_color: 'purple' }) %>
51
+ <% end %>
52
+ <% item.detail do %>
53
+ <%= pb_rails("title_detail", props: {
54
+ title: "Society Hill",
55
+ detail: "72 E St Astoria"
56
+ }) %>
57
+ <% end %>
58
+ <% end %>
59
+ <% end %>
60
+
@@ -0,0 +1,118 @@
1
+ import React from 'react'
2
+
3
+ import Timeline from '../_timeline'
4
+ import TitleDetail from '../../pb_title_detail/_title_detail'
5
+
6
+ const TimelineShowCurrentYear = (props) => (
7
+ <div>
8
+ <Timeline
9
+ orientation="horizontal"
10
+ showDate
11
+ {...props}
12
+ >
13
+ <Timeline.Item
14
+ date={new Date()}
15
+ icon="user"
16
+ iconColor="royal"
17
+ showCurrentYear
18
+ {...props}
19
+ >
20
+ <TitleDetail
21
+ detail="37-27 74th Street"
22
+ title="Jackson Heights"
23
+ {...props}
24
+ />
25
+ </Timeline.Item>
26
+ <Timeline.Item
27
+ icon="check"
28
+ iconColor="teal"
29
+ lineStyle="dotted"
30
+ {...props}
31
+ >
32
+ <TitleDetail
33
+ detail="81 Gate St Brooklyn"
34
+ title="Greenpoint"
35
+ {...props}
36
+ />
37
+ </Timeline.Item>
38
+ <Timeline.Item
39
+ lineStyle="solid"
40
+ {...props}
41
+ >
42
+ <Timeline.Label
43
+ date={new Date()}
44
+ showCurrentYear
45
+ />
46
+ <Timeline.Step
47
+ icon="map-marker-alt"
48
+ iconColor="purple"
49
+ />
50
+ <Timeline.Detail>
51
+ <TitleDetail
52
+ detail="72 E St Astoria"
53
+ title="Society Hill"
54
+ {...props}
55
+ />
56
+ </Timeline.Detail>
57
+ </Timeline.Item>
58
+ </Timeline>
59
+
60
+ <br />
61
+ <br />
62
+ <br />
63
+
64
+ <Timeline
65
+ orientation="vertical"
66
+ showDate
67
+ {...props}
68
+ >
69
+ <Timeline.Item
70
+ date={new Date()}
71
+ icon="user"
72
+ iconColor="royal"
73
+ showCurrentYear
74
+ {...props}
75
+ >
76
+ <TitleDetail
77
+ detail="37-27 74th Street"
78
+ title="Jackson Heights"
79
+ {...props}
80
+ />
81
+ </Timeline.Item>
82
+ <Timeline.Item
83
+ icon="check"
84
+ iconColor="teal"
85
+ lineStyle="dotted"
86
+ {...props}
87
+ >
88
+ <TitleDetail
89
+ detail="81 Gate St Brooklyn"
90
+ title="Greenpoint"
91
+ {...props}
92
+ />
93
+ </Timeline.Item>
94
+ <Timeline.Item
95
+ lineStyle="solid"
96
+ {...props}
97
+ >
98
+ <Timeline.Label
99
+ date={new Date()}
100
+ showCurrentYear
101
+ />
102
+ <Timeline.Step
103
+ icon="map-marker-alt"
104
+ iconColor="purple"
105
+ />
106
+ <Timeline.Detail>
107
+ <TitleDetail
108
+ detail="72 E St Astoria"
109
+ title="Society Hill"
110
+ {...props}
111
+ />
112
+ </Timeline.Detail>
113
+ </Timeline.Item>
114
+ </Timeline>
115
+ </div>
116
+ )
117
+
118
+ export default TimelineShowCurrentYear
@@ -0,0 +1 @@
1
+ By default, the Timeline 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. Pass it to `Timeline.Item`/`timeline/item` when using its `date` prop, or to `Timeline.Label`/`timeline/label` if following the "With Children" pattern.
@@ -1 +1 @@
1
- Use the optional `showDate` prop to render the timeline kit with a visible date. If the date is from the current year, the year will not be displayed, however if date is NOT from the current year, the kit will display the year as well.
1
+ Use the optional `showDate` prop to render the timeline kit with a visible date. By default, if the date is from the current year, the year will not be displayed; however, if the date is NOT from the current year, the kit will display the year as well.
@@ -5,6 +5,7 @@ examples:
5
5
  - timeline_vertical: Vertical
6
6
  - timeline_with_date: With Date
7
7
  - timeline_with_children: With Children
8
+ - timeline_show_current_year: Show Current Year
8
9
  - timeline_with_gap: With Gap
9
10
 
10
11
 
@@ -13,4 +14,5 @@ examples:
13
14
  - timeline_vertical: Vertical
14
15
  - timeline_with_date: With Date
15
16
  - timeline_with_children: With Children
17
+ - timeline_show_current_year: Show Current Year
16
18
  - timeline_with_gap: With Gap
@@ -3,4 +3,5 @@ export { default as TimelineVertical } from './_timeline_vertical.jsx'
3
3
  export { default as TimelineWithDate } from './_timeline_with_date.jsx'
4
4
  export { default as TimelineWithChildren } from './_timeline_with_children.jsx'
5
5
  export { default as TimelineWithGap } from './_timeline_with_gap.jsx'
6
+ export { default as TimelineShowCurrentYear } from './_timeline_show_current_year.jsx'
6
7
 
@@ -2,7 +2,7 @@
2
2
  <% if label %>
3
3
  <%= label %>
4
4
  <% else %>
5
- <%= pb_rails("timeline/label", props: { date: date }) %>
5
+ <%= pb_rails("timeline/label", props: { date: date, show_current_year: show_current_year }) %>
6
6
  <% end %>
7
7
 
8
8
  <% if step %>
@@ -12,6 +12,8 @@ module Playbook
12
12
  prop :line_style, type: Playbook::Props::Enum,
13
13
  values: %w[solid dotted],
14
14
  default: "solid"
15
+ prop :show_current_year, type: Playbook::Props::Boolean,
16
+ default: false
15
17
 
16
18
  renders_one :label
17
19
  renders_one :step
@@ -3,7 +3,8 @@
3
3
  <%= pb_rails("date_stacked", props: {
4
4
  date: object.date,
5
5
  size: "sm",
6
- align: "center"
6
+ align: "center",
7
+ show_current_year: object.show_current_year
7
8
  }) %>
8
9
  <% else %>
9
10
  <%= content.presence %>
@@ -4,6 +4,8 @@ module Playbook
4
4
  module PbTimeline
5
5
  class Label < Playbook::KitBase
6
6
  prop :date
7
+ prop :show_current_year, type: Playbook::Props::Boolean,
8
+ default: false
7
9
 
8
10
  def classname
9
11
  generate_classname("pb_timeline_item_left_block")
@@ -9,6 +9,7 @@ type TimelineLabelProps = {
9
9
  children?: React.ReactNode,
10
10
  className?: string,
11
11
  htmlOptions?: { [key: string]: any },
12
+ showCurrentYear?: boolean,
12
13
  } & GlobalProps
13
14
 
14
15
  const TimelineLabel: React.FC<TimelineLabelProps> = ({
@@ -16,6 +17,7 @@ const TimelineLabel: React.FC<TimelineLabelProps> = ({
16
17
  children,
17
18
  className,
18
19
  htmlOptions = {},
20
+ showCurrentYear = false,
19
21
  ...props
20
22
  }) => {
21
23
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -28,6 +30,7 @@ const TimelineLabel: React.FC<TimelineLabelProps> = ({
28
30
  {date && (
29
31
  <DateStacked align="center"
30
32
  date={date}
33
+ showCurrentYear={showCurrentYear}
31
34
  size="sm"
32
35
  />
33
36
  )}
@@ -170,3 +170,54 @@ test('should pass showDate prop with Children', () => {
170
170
  const kit = screen.getByTestId(testId)
171
171
  expect(kit).toHaveClass('pb_timeline_kit_horizontal_with_date')
172
172
  })
173
+
174
+ test('should pass showCurrentYear prop to items with date', () => {
175
+ const currentYear = new Date().getFullYear().toString()
176
+ render(
177
+ <Timeline
178
+ data={{ testid: testId }}
179
+ showDate
180
+ >
181
+ <Timeline.Item
182
+ date={new Date()}
183
+ icon="user"
184
+ iconColor="royal"
185
+ showCurrentYear
186
+ >
187
+ <TitleDetail
188
+ detail="37-27 74th Street"
189
+ title="Jackson Heights"
190
+ />
191
+ </Timeline.Item>
192
+ </Timeline>
193
+ )
194
+ const kit = screen.getByTestId(testId)
195
+ expect(kit).toBeInTheDocument()
196
+ const yearCaption = kit.querySelector('.pb_caption_kit_xs')
197
+ expect(yearCaption).toBeInTheDocument()
198
+ expect(yearCaption.textContent).toEqual(currentYear)
199
+ })
200
+
201
+ test('should not show current year by default', () => {
202
+ const currentYear = new Date().getFullYear().toString()
203
+ render(
204
+ <Timeline
205
+ data={{ testid: testId }}
206
+ showDate
207
+ >
208
+ <Timeline.Item
209
+ date={new Date()}
210
+ icon="user"
211
+ iconColor="royal"
212
+ >
213
+ <TitleDetail
214
+ detail="37-27 74th Street"
215
+ title="Jackson Heights"
216
+ />
217
+ </Timeline.Item>
218
+ </Timeline>
219
+ )
220
+ const kit = screen.getByTestId(testId)
221
+ expect(kit).toBeInTheDocument()
222
+ expect(kit).not.toHaveTextContent(currentYear)
223
+ })
@@ -139,7 +139,8 @@ $text_colors: (
139
139
  text_lt_lighter: $text_lt_lighter,
140
140
  text_dk_default: $text_dk_default,
141
141
  text_dk_light: $text_dk_light,
142
- text_dk_lighter: $text_dk_lighter
142
+ text_dk_lighter: $text_dk_lighter,
143
+ text_dk_success_sm: $text_dk_success_sm
143
144
  );
144
145
 
145
146
  /* Data colors ------------------------*/
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Tracks which deprecated kits have already logged warnings in this session
3
+ * to ensure we only log once per page load per kit
4
+ */
5
+ const warnedKits = new Set<string>();
6
+
7
+ /**
8
+ * Logs a deprecation warning for a Playbook kit
9
+ * - Only logs once per kit per page load (prevents spam on re-renders)
10
+ * - Only logs in development mode (not in production or test environments)
11
+ *
12
+ * @param kitName - The name of the deprecated kit (e.g., 'BarGraph', 'RichTextEditor')
13
+ * @param message - Optional custom deprecation message. If not provided, uses a default message.
14
+ *
15
+ * @example
16
+ * // In your kit component:
17
+ * useEffect(() => {
18
+ * deprecatedKitWarning('BarGraph');
19
+ * }, []);
20
+ */
21
+ export const deprecatedKitWarning = (
22
+ kitName: string,
23
+ message?: string
24
+ ): void => {
25
+ // Skip in test environments (Jest sets NODE_ENV to 'test')
26
+ if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'test') {
27
+ return;
28
+ }
29
+
30
+ // In browser environments, check if we're on localhost/dev
31
+ if (typeof window !== 'undefined') {
32
+ const hostname = window.location?.hostname;
33
+ const isLocalDev = hostname === 'localhost' ||
34
+ hostname === '127.0.0.1' ||
35
+ hostname?.endsWith('.local') ||
36
+ hostname?.includes('local.') ||
37
+ !hostname; // file:// protocol
38
+
39
+ // Only show warnings in local development
40
+ if (!isLocalDev) {
41
+ return;
42
+ }
43
+ }
44
+
45
+ // Only warn once per kit per page load
46
+ if (warnedKits.has(kitName)) {
47
+ return;
48
+ }
49
+
50
+ // Mark this kit as warned
51
+ warnedKits.add(kitName);
52
+
53
+ // Build the warning message
54
+ const baseMessage = `PLAYBOOK DEPRECATION WARNING
55
+ ----------------------------
56
+ The "${kitName}" kit is deprecated and will be removed in a future version.`;
57
+
58
+ const fullMessage = message
59
+ ? `${baseMessage} ${message}`
60
+ : `${baseMessage} Please migrate to the recommended alternative
61
+
62
+ `;
63
+
64
+ console.warn(fullMessage);
65
+ };
66
+
67
+ /**
68
+ * Resets the warned kits tracker (useful for testing)
69
+ * @internal
70
+ */
71
+ export const resetDeprecationWarnings = (): void => {
72
+ warnedKits.clear();
73
+ };