playbook_ui 14.6.2 → 14.7.0.pre.alpha.PBNTR667railstypeaheadformintegration4454

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 (119) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +3 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +8 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +21 -28
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +37 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +13 -2
  7. data/app/pb_kits/playbook/pb_card/_card.tsx +11 -4
  8. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -2
  9. data/app/pb_kits/playbook/pb_currency/_currency.tsx +16 -6
  10. data/app/pb_kits/playbook/pb_currency/currency.rb +38 -11
  11. data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
  12. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.html.erb +7 -0
  13. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.jsx +18 -0
  14. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.md +3 -0
  15. data/app/pb_kits/playbook/pb_currency/docs/example.yml +3 -1
  16. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  17. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
  18. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +8 -7
  19. data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
  20. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
  21. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
  22. data/app/pb_kits/playbook/pb_flex/flex_item.rb +7 -2
  23. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +2 -2
  24. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +1 -1
  25. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +63 -12
  26. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +6 -2
  27. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +30 -26
  28. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +24 -1
  29. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +25 -2
  30. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +3 -0
  31. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +1 -0
  32. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +46 -8
  33. data/app/pb_kits/playbook/pb_link/_link.scss +66 -0
  34. data/app/pb_kits/playbook/pb_link/_link.tsx +107 -0
  35. data/app/pb_kits/playbook/pb_link/docs/_link_color.html.erb +30 -0
  36. data/app/pb_kits/playbook/pb_link/docs/_link_color.jsx +40 -0
  37. data/app/pb_kits/playbook/pb_link/docs/_link_disabled.html.erb +5 -0
  38. data/app/pb_kits/playbook/pb_link/docs/_link_disabled.jsx +15 -0
  39. data/app/pb_kits/playbook/pb_link/docs/_link_icon.html.erb +15 -0
  40. data/app/pb_kits/playbook/pb_link/docs/_link_icon.jsx +25 -0
  41. data/app/pb_kits/playbook/pb_link/docs/_link_tag.html.erb +35 -0
  42. data/app/pb_kits/playbook/pb_link/docs/_link_tag.jsx +45 -0
  43. data/app/pb_kits/playbook/pb_link/docs/_link_underline.html.erb +5 -0
  44. data/app/pb_kits/playbook/pb_link/docs/_link_underline.jsx +15 -0
  45. data/app/pb_kits/playbook/pb_link/docs/example.yml +16 -0
  46. data/app/pb_kits/playbook/pb_link/docs/index.js +5 -0
  47. data/app/pb_kits/playbook/pb_link/link.html.erb +21 -0
  48. data/app/pb_kits/playbook/pb_link/link.rb +44 -0
  49. data/app/pb_kits/playbook/pb_link/link.test.jsx +92 -0
  50. data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
  51. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +67 -1
  52. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +1 -0
  53. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
  54. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +5 -1
  55. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +37 -0
  56. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.tsx +67 -0
  57. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading_mixins.scss +40 -0
  58. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.jsx +51 -0
  59. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.md +1 -0
  60. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.jsx +26 -0
  61. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.md +1 -0
  62. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -0
  63. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.jsx +11 -0
  64. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +59 -0
  65. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.md +3 -0
  66. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.jsx +20 -0
  67. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.md +3 -0
  68. data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +13 -0
  69. data/app/pb_kits/playbook/pb_skeleton_loading/docs/index.js +5 -0
  70. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +12 -0
  71. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +8 -0
  72. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.test.jsx +81 -0
  73. data/app/pb_kits/playbook/pb_timeline/_item.tsx +59 -23
  74. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +8 -0
  75. data/app/pb_kits/playbook/pb_timeline/detail.html.erb +3 -0
  76. data/app/pb_kits/playbook/pb_timeline/detail.rb +11 -0
  77. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +43 -0
  78. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +68 -0
  79. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md +2 -0
  80. data/app/pb_kits/playbook/pb_timeline/docs/example.yml +2 -1
  81. data/app/pb_kits/playbook/pb_timeline/docs/index.js +1 -0
  82. data/app/pb_kits/playbook/pb_timeline/item.html.erb +17 -21
  83. data/app/pb_kits/playbook/pb_timeline/item.rb +4 -0
  84. data/app/pb_kits/playbook/pb_timeline/label.html.erb +12 -0
  85. data/app/pb_kits/playbook/pb_timeline/label.rb +13 -0
  86. data/app/pb_kits/playbook/pb_timeline/step.html.erb +14 -0
  87. data/app/pb_kits/playbook/pb_timeline/step.rb +16 -0
  88. data/app/pb_kits/playbook/pb_timeline/subcomponents/Detail.tsx +29 -0
  89. data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +38 -0
  90. data/app/pb_kits/playbook/pb_timeline/subcomponents/Step.tsx +42 -0
  91. data/app/pb_kits/playbook/pb_timeline/subcomponents/index.tsx +3 -0
  92. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +84 -0
  93. data/app/pb_kits/playbook/pb_typeahead/index.ts +36 -2
  94. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +5 -2
  95. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +4 -0
  96. data/app/pb_kits/playbook/tokens/_typography.scss +35 -0
  97. data/app/pb_kits/playbook/utilities/_hover.scss +46 -43
  98. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +4 -0
  99. data/app/pb_kits/playbook/utilities/globalProps.ts +44 -2
  100. data/dist/chunks/_typeahead-B-juiSkw.js +22 -0
  101. data/dist/chunks/_weekday_stacked-DPqQHJ1l.js +45 -0
  102. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  103. data/dist/chunks/{lib-D-mTv-kp.js → lib-DpxYMiKe.js} +1 -1
  104. data/dist/chunks/{pb_form_validation-BkWGwJsl.js → pb_form_validation-LqRlnmi6.js} +1 -1
  105. data/dist/chunks/vendor.js +1 -1
  106. data/dist/menu.yml +7 -1
  107. data/dist/playbook-doc.js +1 -1
  108. data/dist/playbook-rails-react-bindings.js +1 -1
  109. data/dist/playbook-rails.js +1 -1
  110. data/dist/playbook.css +1 -1
  111. data/lib/playbook/forms/builder/typeahead_field.rb +13 -0
  112. data/lib/playbook/hover.rb +4 -1
  113. data/lib/playbook/kit_base.rb +43 -5
  114. data/lib/playbook/version.rb +2 -2
  115. metadata +63 -11
  116. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
  117. data/dist/chunks/_typeahead-BV_n6U5W.js +0 -22
  118. data/dist/chunks/_weekday_stacked-Cy__g00H.js +0 -45
  119. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbTimeline
5
+ class Label < Playbook::KitBase
6
+ prop :date
7
+
8
+ def classname
9
+ generate_classname("pb_timeline_item_left_block")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ <%= pb_content_tag do %>
2
+ <% if object.icon.present? %>
3
+ <%= pb_rails("icon_circle", props: {
4
+ icon: object.icon,
5
+ variant: object.icon_color,
6
+ size: "xs"
7
+ }) %>
8
+ <% else %>
9
+ <%= content.presence %>
10
+ <% end %>
11
+ <div class="pb_timeline_item_connector"></div>
12
+ <% end %>
13
+
14
+
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbTimeline
5
+ class Step < Playbook::KitBase
6
+ prop :icon, type: Playbook::Props::String
7
+ prop :icon_color, type: Playbook::Props::Enum,
8
+ values: %w[default royal blue purple teal red yellow green],
9
+ default: "default"
10
+
11
+ def classname
12
+ generate_classname("pb_timeline_item_step")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+ import { buildHtmlProps } from '../../utilities/props'
4
+ import { globalProps, GlobalProps } from "../../utilities/globalProps"
5
+
6
+ type TimelineDetailProps = {
7
+ children?: React.ReactNode,
8
+ className?: string,
9
+ htmlOptions?: { [key: string]: any },
10
+ } & GlobalProps
11
+
12
+ const TimelineDetail: React.FC<TimelineDetailProps> = ({
13
+ children,
14
+ className,
15
+ htmlOptions = {},
16
+ ...props
17
+ }) => {
18
+ const htmlProps = buildHtmlProps(htmlOptions)
19
+ return (
20
+ <div
21
+ {...htmlProps}
22
+ className={classnames('pb_timeline_item_right_block', globalProps(props), className)}
23
+ >
24
+ {children}
25
+ </div>
26
+ )
27
+ }
28
+
29
+ export default TimelineDetail
@@ -0,0 +1,38 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+ import { buildHtmlProps } from '../../utilities/props'
4
+ import { globalProps, GlobalProps } from "../../utilities/globalProps"
5
+ import DateStacked from '../../pb_date_stacked/_date_stacked'
6
+
7
+ type TimelineLabelProps = {
8
+ date?: Date,
9
+ children?: React.ReactNode,
10
+ className?: string,
11
+ htmlOptions?: { [key: string]: any },
12
+ } & GlobalProps
13
+
14
+ const TimelineLabel: React.FC<TimelineLabelProps> = ({
15
+ date,
16
+ children,
17
+ className,
18
+ htmlOptions = {},
19
+ ...props
20
+ }) => {
21
+ const htmlProps = buildHtmlProps(htmlOptions)
22
+ return (
23
+ <div
24
+ {...htmlProps}
25
+ className={classnames('pb_timeline_item_left_block', globalProps(props), className)}
26
+ >
27
+ {children}
28
+ {date && (
29
+ <DateStacked align="center"
30
+ date={date}
31
+ size="sm"
32
+ />
33
+ )}
34
+ </div>
35
+ )
36
+ }
37
+
38
+ export default TimelineLabel
@@ -0,0 +1,42 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+ import { buildHtmlProps } from '../../utilities/props'
4
+ import { globalProps, GlobalProps } from "../../utilities/globalProps"
5
+ import IconCircle from '../../pb_icon_circle/_icon_circle'
6
+
7
+ type TimelineStepProps = {
8
+ icon?: string,
9
+ iconColor?: 'default' | 'royal' | 'blue' | 'purple' | 'teal' | 'red' | 'yellow' | 'green',
10
+ children?: React.ReactNode,
11
+ className?: string,
12
+ htmlOptions?: { [key: string]: any },
13
+ } & GlobalProps
14
+
15
+ const TimelineStep: React.FC<TimelineStepProps> = ({
16
+ icon = 'user',
17
+ iconColor = 'default',
18
+ children,
19
+ className,
20
+ htmlOptions = {},
21
+ ...props
22
+ }) => {
23
+ const htmlProps = buildHtmlProps(htmlOptions)
24
+ return (
25
+ <div
26
+ {...htmlProps}
27
+ className={classnames('pb_timeline_item_step', globalProps(props), className)}
28
+ >
29
+ {children ? (
30
+ children
31
+ ) : (
32
+ <IconCircle icon={icon}
33
+ size="xs"
34
+ variant={iconColor}
35
+ />
36
+ )}
37
+ <div className="pb_timeline_item_connector" />
38
+ </div>
39
+ )
40
+ }
41
+
42
+ export default TimelineStep
@@ -0,0 +1,3 @@
1
+ export { default as TimelineLabel } from './Label';
2
+ export { default as TimelineDetail } from './Detail';
3
+ export { default as TimelineStep } from './Step';
@@ -2,6 +2,10 @@ import React from 'react'
2
2
  import { render, screen } from '../utilities/test-utils'
3
3
 
4
4
  import Timeline from './_timeline'
5
+ import TimelineItem from './_item'
6
+ import TimelineLabel from './subcomponents/Label'
7
+ import TimelineStep from './subcomponents/Step'
8
+ import TimelineDetail from './subcomponents/Detail'
5
9
  import TitleDetail from '../pb_title_detail/_title_detail'
6
10
 
7
11
  const testId = 'timeline'
@@ -43,18 +47,91 @@ const TimelineDefault = (props) => (
43
47
  </>
44
48
  )
45
49
 
50
+ const TimelineWithChildren = (props) => (
51
+ <>
52
+ <Timeline
53
+ className={className}
54
+ data={{ testid: testId }}
55
+ orientation="horizontal"
56
+ showDate
57
+ {...props}
58
+ >
59
+ <TimelineItem lineStyle="solid"
60
+ {...props}
61
+ >
62
+ <TimelineLabel date={new Date()} />
63
+ <TimelineStep icon="user"
64
+ iconColor="royal"
65
+ />
66
+ <TimelineDetail>
67
+ <TitleDetail
68
+ detail="37-27 74th Street"
69
+ title="Jackson Heights"
70
+ {...props}
71
+ />
72
+ </TimelineDetail>
73
+ </TimelineItem>
74
+
75
+ <TimelineItem lineStyle="dotted"
76
+ {...props}
77
+ >
78
+ <TimelineStep icon="check"
79
+ iconColor="teal"
80
+ />
81
+ <TimelineDetail>
82
+ <TitleDetail
83
+ detail="81 Gate St Brooklyn"
84
+ title="Greenpoint"
85
+ {...props}
86
+ />
87
+ </TimelineDetail>
88
+ </TimelineItem>
89
+
90
+ <TimelineItem lineStyle="solid"
91
+ {...props}
92
+ >
93
+ <TimelineLabel
94
+ date={new Date(new Date().setDate(new Date().getDate() + 1))}
95
+ />
96
+ <TimelineStep icon="map-marker-alt"
97
+ iconColor="purple"
98
+ />
99
+ <TimelineDetail>
100
+ <TitleDetail
101
+ detail="72 E St Astoria"
102
+ title="Society Hill"
103
+ {...props}
104
+ />
105
+ </TimelineDetail>
106
+ </TimelineItem>
107
+ </Timeline>
108
+ </>
109
+ )
110
+
46
111
  test('should pass data prop', () => {
47
112
  render(<TimelineDefault />)
48
113
  const kit = screen.getByTestId(testId)
49
114
  expect(kit).toBeInTheDocument()
50
115
  })
51
116
 
117
+ test('should pass data prop using children', () => {
118
+ render(<TimelineWithChildren />)
119
+ const kit = screen.getByTestId(testId)
120
+ expect(kit).toBeInTheDocument()
121
+ })
122
+
52
123
  test('should pass className prop', () => {
53
124
  render(<TimelineDefault />)
54
125
  const kit = screen.getByTestId(testId)
55
126
  expect(kit).toHaveClass(className)
56
127
  })
57
128
 
129
+ test('should pass className prop with children', () => {
130
+ render(<TimelineWithChildren />)
131
+ const kit = screen.getByTestId(testId)
132
+ expect(kit).toHaveClass(className)
133
+ })
134
+
58
135
  test('should pass aria prop', () => {
59
136
  render(<TimelineDefault />)
60
137
  const kit = screen.getByTestId(testId)
@@ -86,3 +163,10 @@ test('should pass showDate prop', () => {
86
163
  const kit = screen.getByTestId(testId)
87
164
  expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
88
165
  })
166
+
167
+ test('should pass showDate prop with Children', () => {
168
+ const props = { showDate: true }
169
+ render(<TimelineWithChildren {...props} />)
170
+ const kit = screen.getByTestId(testId)
171
+ expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
172
+ })
@@ -4,11 +4,12 @@ import { debounce } from 'lodash'
4
4
  export default class PbTypeahead extends PbEnhancedElement {
5
5
  _searchInput: HTMLInputElement
6
6
  _resultsElement: HTMLElement
7
- _debouncedSearch: Function
7
+ _debouncedSearch: () => void
8
8
  _resultsLoadingIndicator: HTMLElement
9
9
  _resultOptionTemplate: HTMLElement
10
10
  _resultsOptionCache: Map<string, Array<DocumentFragment>>
11
11
  _searchContext: string
12
+ _validSelection: boolean
12
13
 
13
14
  static get selector() {
14
15
  return '[data-pb-typeahead-kit]'
@@ -19,6 +20,7 @@ export default class PbTypeahead extends PbEnhancedElement {
19
20
  this.searchInput.addEventListener('focus', () => this.debouncedSearch())
20
21
  this.searchInput.addEventListener('input', () => this.debouncedSearch())
21
22
  this.resultsElement.addEventListener('click', (event: MouseEvent) => this.optionSelected(event))
23
+ this.element.closest('form')?.addEventListener('submit', (event) => this.handleFormSubmission(event))
22
24
  }
23
25
 
24
26
  handleKeydown(event: KeyboardEvent) {
@@ -86,6 +88,9 @@ export default class PbTypeahead extends PbEnhancedElement {
86
88
  const resultOption = (event.target as Element).closest('[data-result-option-item]')
87
89
  if (!resultOption) return
88
90
 
91
+ this._validSelection = true
92
+ this.removeValidationError()
93
+
89
94
  this.resultsCacheClear()
90
95
  this.searchInputClear()
91
96
  this.clearResults()
@@ -93,6 +98,35 @@ export default class PbTypeahead extends PbEnhancedElement {
93
98
  this.element.dispatchEvent(new CustomEvent('pb-typeahead-kit-result-option-selected', { bubbles: true, detail: { selected: resultOption, typeahead: this } }))
94
99
  }
95
100
 
101
+ removeValidationError() {
102
+ const inputWrapper = this.searchInput.closest('.text_input_wrapper')
103
+ if (inputWrapper) {
104
+ const errorMessage = inputWrapper.querySelector('.pb_body_kit_negative') as HTMLElement
105
+ if (errorMessage) {
106
+ errorMessage.style.display = 'none'
107
+ }
108
+ this.searchInput.classList.remove('error')
109
+ }
110
+ }
111
+
112
+ showValidationError() {
113
+ const inputWrapper = this.searchInput.closest('.text_input_wrapper')
114
+ if (inputWrapper) {
115
+ const errorMessage = inputWrapper.querySelector('.pb_body_kit_negative') as HTMLElement
116
+ if (errorMessage) {
117
+ errorMessage.style.display = 'block'
118
+ }
119
+ this.searchInput.classList.add('error')
120
+ }
121
+ }
122
+
123
+ handleFormSubmission(event: Event) {
124
+ if (!this._validSelection) {
125
+ this.showValidationError()
126
+ event.preventDefault()
127
+ }
128
+ }
129
+
96
130
  clearResults() {
97
131
  this.resultsElement.innerHTML = ''
98
132
  }
@@ -201,7 +235,7 @@ export default class PbTypeahead extends PbEnhancedElement {
201
235
  }
202
236
 
203
237
  toggleResultsLoadingIndicator(visible: boolean) {
204
- var visibilityProperty = '0'
238
+ let visibilityProperty = '0'
205
239
  if (visible) visibilityProperty = '1'
206
240
  this.resultsLoadingIndicator.style.opacity = visibilityProperty
207
241
  }
@@ -17,11 +17,14 @@
17
17
  <%= pb_rails("text_input", props: {
18
18
  type: "search",
19
19
  input_options: object.input_options,
20
- label: object.label,
21
20
  name: object.name,
22
21
  value: object.value,
23
22
  placeholder: object.placeholder,
24
23
  margin_bottom: "none",
24
+ required: object.required,
25
+ validation: object.validation,
26
+ label: object.label,
27
+ id: object.input_options[:id],
25
28
  }) %>
26
29
  <%= pb_rails("list", props: { ordered: false, borderless: false, xpadding: true, role: "status", aria: { live: "polite" }, data: { pb_typeahead_kit_results: true } }) do %>
27
30
  <% end %>
@@ -33,4 +36,4 @@
33
36
  <% end %>
34
37
  </template>
35
38
  <% end %>
36
- <% end %>
39
+ <% end %>
@@ -40,6 +40,10 @@ module Playbook
40
40
  prop :pill_color, type: Playbook::Props::Enum,
41
41
  values: %w[primary neutral success warning error info data_1 data_2 data_3 data_4 data_5 data_6 data_7 data_8 windows siding roofing doors gutters solar insulation accessories],
42
42
  default: "primary"
43
+ prop :required, type: Playbook::Props::Boolean,
44
+ default: false
45
+ prop :validation, type: Playbook::Props::HashProp,
46
+ default: {}
43
47
 
44
48
  def classname
45
49
  default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
@@ -1,3 +1,5 @@
1
+ @import "../tokens/colors";
2
+
1
3
  $font_family_base: "Power Centra", "Helvetica Neue", Helvetica, Arial, sans_serif !default;
2
4
 
3
5
  /* CLEAN UP AND REMOVE */
@@ -51,3 +53,36 @@ $boldest: 700 !default;
51
53
  $bolder: 700 !default;
52
54
  $light: 300 !default;
53
55
  $lighter: 300 !default;
56
+
57
+ /* Link Colors */
58
+ $pb_link_colors: (
59
+ default: $primary_action,
60
+ body: $text_lt_default,
61
+ muted: $text_lt_light,
62
+ destructive: $error,
63
+ );
64
+
65
+ $pb_link_hover_colors: (
66
+ default: $text_lt_default,
67
+ body: $primary_action,
68
+ muted: $text_lt_default,
69
+ destructive: $text_lt_default,
70
+ );
71
+
72
+ $pb_dark_link_colors: (
73
+ default: $active_dark,
74
+ body: $text_dk_default,
75
+ muted: $text_dk_light,
76
+ destructive: $error_dark,
77
+ );
78
+
79
+ $pb_dark_link_hover_colors: (
80
+ default: $text_dk_default,
81
+ body: $active_dark,
82
+ muted: $text_dk_default,
83
+ destructive: $text_dk_default,
84
+ );
85
+
86
+ @mixin pb_link($color: $primary_action) {
87
+ color: $color;
88
+ }
@@ -1,51 +1,54 @@
1
1
  @import "../tokens/exports/scale.module";
2
2
 
3
- @mixin hover-color-classes($colors-list) {
4
- @each $name, $color in $colors-list {
5
- .hover_background_#{"" + $name}:hover {
6
- background-color: $color !important;
7
- transition: background-color $transition-speed ease;
8
- }
9
- .hover_color_#{"" + $name}:hover {
10
- color: $color !important;
11
- transition: color $transition-speed ease;
12
- }
3
+ @mixin hover-scale-classes($scales-list) {
4
+ @each $name, $scale in $scales-list {
5
+ .hover_#{"" + $name}:hover,
6
+ .group_hover:hover .group_hover.hover_#{"" + $name} {
7
+ transform: $scale;
8
+ transition: transform $transition-speed ease;
13
9
  }
14
10
  }
15
-
16
- @mixin hover-shadow-classes($shadows-list) {
17
- @each $name, $shadow in $shadows-list {
18
- .hover_#{"" + $name}:hover {
19
- box-shadow: $shadow;
20
- transition: box-shadow $transition-speed ease;
21
- }
11
+ }
12
+
13
+ @mixin hover-shadow-classes($shadows-list) {
14
+ @each $name, $shadow in $shadows-list {
15
+ .hover_#{"" + $name}:hover,
16
+ .group_hover:hover .group_hover.hover_#{"" + $name} {
17
+ box-shadow: $shadow;
18
+ transition: box-shadow $transition-speed ease;
22
19
  }
23
20
  }
24
-
25
- @mixin hover-scale-classes($scales-list) {
26
- @each $name, $scale in $scales-list {
27
- .hover_#{"" + $name}:hover {
28
- transform: $scale;
29
- transition: transform $transition-speed ease;
30
- }
21
+ }
22
+
23
+ @mixin hover-color-classes($colors-list) {
24
+ @each $name, $color in $colors-list {
25
+ .hover_background_#{"" + $name}:hover,
26
+ .group_hover:hover .group_hover.hover_background_#{"" + $name} {
27
+ background-color: $color !important;
28
+ transition: background-color $transition-speed ease;
29
+ }
30
+ .hover_color_#{"" + $name}:hover,
31
+ .group_hover:hover .group_hover.hover_color_#{"" + $name} {
32
+ color: $color !important;
33
+ transition: color $transition-speed ease;
31
34
  }
32
35
  }
33
-
34
-
35
- @include hover-scale-classes($scales);
36
- @include hover-shadow-classes($box_shadows);
37
- @include hover-color-classes($product_colors);
38
- @include hover-color-classes($status_colors);
39
- @include hover-color-classes($data_colors);
40
- @include hover-color-classes($shadow_colors);
41
- @include hover-color-classes($colors);
42
- @include hover-color-classes($interface_colors);
43
- @include hover-color-classes($main_colors);
44
- @include hover-color-classes($background_colors);
45
- @include hover-color-classes($card_colors);
46
- @include hover-color-classes($active_colors);
47
- @include hover-color-classes($action_colors);
48
- @include hover-color-classes($hover_colors);
49
- @include hover-color-classes($border_colors);
50
- @include hover-color-classes($text_colors);
51
- @include hover-color-classes($category_colors);
36
+ }
37
+
38
+ @include hover-scale-classes($scales);
39
+ @include hover-shadow-classes($box_shadows);
40
+ @include hover-color-classes($product_colors);
41
+ @include hover-color-classes($status_colors);
42
+ @include hover-color-classes($data_colors);
43
+ @include hover-color-classes($shadow_colors);
44
+ @include hover-color-classes($colors);
45
+ @include hover-color-classes($interface_colors);
46
+ @include hover-color-classes($main_colors);
47
+ @include hover-color-classes($background_colors);
48
+ @include hover-color-classes($card_colors);
49
+ @include hover-color-classes($active_colors);
50
+ @include hover-color-classes($action_colors);
51
+ @include hover-color-classes($hover_colors);
52
+ @include hover-color-classes($border_colors);
53
+ @include hover-color-classes($text_colors);
54
+ @include hover-color-classes($category_colors);
@@ -1,9 +1,13 @@
1
1
  export default [
2
+ "minHeight",
3
+ "maxHeight",
4
+ "height",
2
5
  "left",
3
6
  "bottom",
4
7
  "right",
5
8
  "top",
6
9
  "hover",
10
+ "groupHover",
7
11
  "zIndex",
8
12
  "verticalAlign",
9
13
  "truncate",
@@ -66,6 +66,10 @@ type Hover = Shadow & {
66
66
  scale?: "sm" | "md" | "lg"
67
67
  }
68
68
 
69
+ type GroupHover = {
70
+ groupHover?: boolean,
71
+ }
72
+
69
73
  type JustifyContent = {
70
74
  justifyContent?: Alignment & Space
71
75
  }
@@ -170,12 +174,24 @@ type ZIndex = {
170
174
  zIndex?: ZIndexType,
171
175
  } | ZIndexResponsiveType
172
176
 
177
+ type Height = {
178
+ height?: string
179
+ }
180
+
181
+ type MaxHeight = {
182
+ maxHeight?: string
183
+ }
184
+
185
+ type MinHeight = {
186
+ minHeight?: string
187
+ }
188
+
173
189
  // keep this as the last type definition
174
190
  export type GlobalProps = AlignContent & AlignItems & AlignSelf &
175
191
  BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
176
192
  FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
177
193
  LineHeight & Margin & MinWidth & MaxWidth & NumberSpacing & Order & Overflow & Padding &
178
- Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left;
194
+ Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left & Height & MaxHeight & MinHeight;
179
195
 
180
196
  const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
181
197
  const keys: string[] = Object.keys(prop)
@@ -209,6 +225,7 @@ const filterClassName = (value: string): string => {
209
225
  // Prop categories
210
226
  const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} = {
211
227
 
228
+ groupHoverProps: ({ groupHover }: GroupHover ) => groupHover ? 'group_hover ' : '',
212
229
  hoverProps: ({ hover }: { hover?: Hover }) => {
213
230
  let css = '';
214
231
  if (!hover) return css;
@@ -498,7 +515,22 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
498
515
  } else {
499
516
  return verticalAlign ? `vertical_align_${verticalAlign} ` : ''
500
517
  }
501
- }
518
+ },
519
+
520
+ }
521
+
522
+ const PROP_INLINE_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => {[key: string]: any}} = {
523
+ heightProps: ({ height }: Height) => {
524
+ return height ? { height } : {};
525
+ },
526
+
527
+ maxHeightProps: ({ maxHeight }: MaxHeight) => {
528
+ return maxHeight ? { maxHeight } : {};
529
+ },
530
+
531
+ minHeightProps: ({ minHeight }: MinHeight) => {
532
+ return minHeight ? { minHeight } : {};
533
+ },
502
534
  }
503
535
 
504
536
  type DefaultProps = {[key: string]: string} | Record<string, unknown>
@@ -510,6 +542,16 @@ export const globalProps = (props: GlobalProps, defaultProps: DefaultProps = {})
510
542
  }).filter((value) => value?.length > 0).join(" ")
511
543
  }
512
544
 
545
+ // New function for inline styles
546
+ export const globalInlineProps = (props: GlobalProps): React.CSSProperties => {
547
+ const styles = Object.keys(PROP_INLINE_CATEGORIES).reduce((acc, key) => {
548
+ const result = PROP_INLINE_CATEGORIES[key](props);
549
+ return { ...acc, ...(typeof result === 'object' ? result : {}) }; // Ensure result is an object before spreading
550
+ }, {});
551
+
552
+ return styles; // Return the styles object directly
553
+ }
554
+
513
555
 
514
556
  export const deprecatedProps = (): void => {
515
557
  // if (process.env.NODE_ENV === 'development') {