playbook_ui 13.14.0 → 13.15.0.pre.alpha.PLAY10851907

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +5 -5
  4. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +3 -3
  5. data/app/pb_kits/playbook/pb_background/_background.tsx +9 -9
  6. data/app/pb_kits/playbook/pb_badge/_badge.tsx +2 -2
  7. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +3 -3
  8. data/app/pb_kits/playbook/pb_body/_body.scss +0 -5
  9. data/app/pb_kits/playbook/pb_body/_body.tsx +5 -9
  10. data/app/pb_kits/playbook/pb_body/_body_mixins.scss +0 -20
  11. data/app/pb_kits/playbook/pb_body/body.rb +1 -8
  12. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.tsx +3 -4
  13. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.tsx +3 -3
  14. data/app/pb_kits/playbook/pb_button/_button.tsx +40 -37
  15. data/app/pb_kits/playbook/pb_button/docs/_button_props_swift.md +11 -0
  16. data/app/pb_kits/playbook/pb_button/docs/_button_reaction_swift.md +26 -0
  17. data/app/pb_kits/playbook/pb_button/docs/example.yml +1 -0
  18. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.tsx +3 -3
  19. data/app/pb_kits/playbook/pb_caption/_caption.tsx +1 -1
  20. data/app/pb_kits/playbook/pb_card/_card.tsx +2 -2
  21. data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +5 -4
  22. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +3 -3
  23. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +9 -9
  24. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +1 -1
  25. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +5 -7
  26. data/app/pb_kits/playbook/pb_collapsible/_helper_functions.ts +2 -2
  27. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +5 -4
  28. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +16 -12
  29. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_colors_swift.md +27 -0
  30. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default_swift.md +22 -0
  31. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_props_table.md +8 -0
  32. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_sizes_swift.md +26 -0
  33. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +6 -0
  34. data/app/pb_kits/playbook/pb_contact/_contact.tsx +3 -3
  35. data/app/pb_kits/playbook/pb_currency/_currency.tsx +2 -2
  36. data/app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts +1 -1
  37. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +4 -55
  38. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +5 -56
  39. data/app/pb_kits/playbook/pb_dashboard/themeTypes.ts +20 -16
  40. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.tsx +1 -1
  41. data/app/pb_kits/playbook/pb_date/_date.tsx +7 -7
  42. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +1 -1
  43. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +2 -2
  44. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +2 -2
  45. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +8 -8
  46. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +2 -2
  47. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +1 -1
  48. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +2 -2
  49. data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.test.js +6 -3
  50. data/app/pb_kits/playbook/pb_detail/_detail.scss +2 -2
  51. data/app/pb_kits/playbook/pb_detail/_detail.tsx +5 -5
  52. data/app/pb_kits/playbook/pb_detail/detail.rb +1 -1
  53. data/app/pb_kits/playbook/pb_detail/detail.test.jsx +2 -2
  54. data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +2 -2
  55. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +42 -34
  56. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.tsx +1 -1
  57. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.tsx +4 -5
  58. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx +4 -4
  59. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default_swift.md +11 -0
  60. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.jsx +8 -4
  61. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.jsx +8 -4
  62. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_props_table.md +13 -0
  63. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_scrollable.jsx +4 -2
  64. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_sizes_swift.md +18 -0
  65. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.jsx +1 -1
  66. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status_swift.md +14 -0
  67. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +7 -0
  68. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.tsx +5 -5
  69. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +1 -1
  70. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +1 -1
  71. data/app/pb_kits/playbook/pb_flex/_flex.tsx +1 -1
  72. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +1 -1
  73. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +1 -1
  74. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
  75. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +1 -1
  76. data/app/pb_kits/playbook/pb_hashtag/_hashtag.tsx +1 -1
  77. data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +1 -1
  78. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +1 -1
  79. data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
  80. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +1 -1
  81. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +1 -1
  82. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +1 -1
  83. data/app/pb_kits/playbook/pb_image/_image.tsx +1 -1
  84. data/app/pb_kits/playbook/pb_label_pill/_label_pill.tsx +1 -1
  85. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +1 -1
  86. data/app/pb_kits/playbook/pb_layout/_layout.tsx +1 -1
  87. data/app/pb_kits/playbook/pb_legend/_legend.tsx +1 -1
  88. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +1 -1
  89. data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +1 -1
  90. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +1 -1
  91. data/app/pb_kits/playbook/pb_list/_list.tsx +1 -1
  92. data/app/pb_kits/playbook/pb_list/_list_item.tsx +1 -1
  93. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -1
  94. data/app/pb_kits/playbook/pb_map/_map.tsx +1 -1
  95. data/app/pb_kits/playbook/pb_message/_message.tsx +1 -1
  96. data/app/pb_kits/playbook/pb_message/_message_mention.tsx +1 -1
  97. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -1
  98. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +1 -1
  99. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +1 -1
  100. data/app/pb_kits/playbook/pb_nav/_item.tsx +1 -1
  101. data/app/pb_kits/playbook/pb_nav/_nav.tsx +1 -1
  102. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_bold_swift.md +17 -0
  103. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_default_swift.md +17 -0
  104. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_subtle_no_highlight_swift.md +18 -0
  105. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_subtle_swift.md +18 -0
  106. data/app/pb_kits/playbook/pb_nav/docs/_nav_props_swift.md +11 -0
  107. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_bold_swift.md +18 -0
  108. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_default_swift.md +18 -0
  109. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_subtle_no_highlight_swift.md +19 -0
  110. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_subtle_swift.md +17 -0
  111. data/app/pb_kits/playbook/pb_nav/docs/example.yml +17 -0
  112. data/app/pb_kits/playbook/pb_online_status/_online_status.tsx +1 -1
  113. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +52 -51
  114. data/app/pb_kits/playbook/pb_person/_person.tsx +1 -1
  115. data/app/pb_kits/playbook/pb_person/docs/_person_default_swift.md +8 -0
  116. data/app/pb_kits/playbook/pb_person/docs/_person_props_swift.md +5 -0
  117. data/app/pb_kits/playbook/pb_person/docs/example.yml +4 -0
  118. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +21 -20
  119. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +5 -4
  120. data/app/pb_kits/playbook/pb_pill/_pill.tsx +1 -1
  121. data/app/pb_kits/playbook/pb_popover/_popover.tsx +7 -5
  122. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +21 -21
  123. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +5 -5
  124. data/app/pb_kits/playbook/pb_progress_step/_progress_step.tsx +1 -1
  125. data/app/pb_kits/playbook/pb_progress_step/_progress_step_item.tsx +1 -1
  126. data/app/pb_kits/playbook/pb_radio/_radio.tsx +1 -1
  127. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorButton.tsx +19 -17
  128. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorTypes.ts +1 -1
  129. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +23 -21
  130. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +18 -10
  131. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +46 -23
  132. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarHistory.tsx +8 -8
  133. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarNodes.tsx +7 -7
  134. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +18 -16
  135. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +10 -8
  136. data/app/pb_kits/playbook/pb_select/_select.tsx +2 -2
  137. data/app/pb_kits/playbook/pb_select/docs/_select_default_swift.md +15 -0
  138. data/app/pb_kits/playbook/pb_select/docs/_select_error_swift.md +18 -0
  139. data/app/pb_kits/playbook/pb_select/docs/_select_props_table.md +8 -0
  140. data/app/pb_kits/playbook/pb_select/docs/example.yml +5 -0
  141. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +1 -1
  142. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +26 -25
  143. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +28 -27
  144. data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +1 -1
  145. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +3 -2
  146. data/app/pb_kits/playbook/pb_source/_source.tsx +16 -16
  147. data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +1 -1
  148. data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +1 -1
  149. data/app/pb_kits/playbook/pb_stat_value/_stat_value.tsx +1 -1
  150. data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
  151. data/app/pb_kits/playbook/pb_table/_table_row.tsx +1 -1
  152. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
  153. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +1 -1
  154. data/app/pb_kits/playbook/pb_time/_time.tsx +1 -1
  155. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
  156. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +1 -1
  157. data/app/pb_kits/playbook/pb_timeline/_item.tsx +1 -1
  158. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
  159. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +1 -1
  160. data/app/pb_kits/playbook/pb_title/_title.scss +0 -5
  161. data/app/pb_kits/playbook/pb_title/_title.tsx +2 -5
  162. data/app/pb_kits/playbook/pb_title/_title_mixin.scss +0 -19
  163. data/app/pb_kits/playbook/pb_title/title.rb +2 -9
  164. data/app/pb_kits/playbook/pb_title_count/_title_count.tsx +1 -1
  165. data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +1 -1
  166. data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
  167. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -1
  168. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -1
  169. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -1
  170. data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
  171. data/app/pb_kits/playbook/pb_user/docs/_user_horizontal_swift.md +37 -0
  172. data/app/pb_kits/playbook/pb_user/docs/_user_props_table.md +10 -0
  173. data/app/pb_kits/playbook/pb_user/docs/_user_size_swift.md +35 -0
  174. data/app/pb_kits/playbook/pb_user/docs/_user_text_only_swift.md +27 -0
  175. data/app/pb_kits/playbook/pb_user/docs/_user_vertical_size_swift.md +35 -0
  176. data/app/pb_kits/playbook/pb_user/docs/example.yml +7 -0
  177. data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +1 -1
  178. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +1 -1
  179. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +1 -1
  180. data/app/pb_kits/playbook/tokens/exports/exports.d.ts +1 -0
  181. data/app/pb_kits/playbook/utilities/_truncate.scss +20 -0
  182. data/app/pb_kits/playbook/utilities/globalProps.ts +13 -2
  183. data/app/pb_kits/playbook/utilities/props.ts +2 -2
  184. data/app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js +21 -0
  185. data/dist/playbook-rails.js +4 -4
  186. data/lib/playbook/classnames.rb +1 -0
  187. data/lib/playbook/kit_base.rb +2 -0
  188. data/lib/playbook/truncate.rb +29 -0
  189. data/lib/playbook/version.rb +2 -2
  190. metadata +39 -7
@@ -11,7 +11,7 @@ import { ToolbarTypes } from "./EditorTypes";
11
11
  import ToolbarHistoryItems from "./ToolbarHistory";
12
12
  import MoreExtensionsDropdown from "./MoreExtensionsDropdown";
13
13
 
14
- const EditorToolbar = ({ editor, extensions }:any) => {
14
+ const EditorToolbar = ({ editor, extensions }: any): React.ReactElement => {
15
15
  const toolbaritems = [
16
16
  {
17
17
  icon: "bold",
@@ -34,19 +34,27 @@ const EditorToolbar = ({ editor, extensions }:any) => {
34
34
  ]
35
35
 
36
36
  return (
37
- <Background backgroundColor="white" className="toolbar">
38
- <Flex flex="0" justify="between" paddingX="sm" paddingY="xxs">
39
- <FlexItem className="toolbar_block" displayFlex>
37
+ <Background backgroundColor="white"
38
+ className="toolbar"
39
+ >
40
+ <Flex flex="0"
41
+ justify="between"
42
+ paddingX="sm"
43
+ paddingY="xxs"
44
+ >
45
+ <FlexItem className="toolbar_block"
46
+ displayFlex
47
+ >
40
48
  <ToolbarDropdown editor={editor}/>
41
49
  <SectionSeparator orientation="vertical" />
42
50
  {toolbaritems && toolbaritems.map(
43
- ({ icon, text, classname, onclick}:ToolbarTypes, index:number) => (
51
+ ({ icon, text, classname, onclick}: ToolbarTypes, index: number) => (
44
52
  <EditorButton
45
- classname={classname}
46
- icon={icon}
47
- key={index}
48
- text={text}
49
- onclick={onclick}
53
+ classname={classname}
54
+ icon={icon}
55
+ key={index}
56
+ onclick={onclick}
57
+ text={text}
50
58
  />
51
59
  )
52
60
  )}
@@ -9,7 +9,7 @@ import NavItem from '../../pb_nav/_item'
9
9
 
10
10
  import { ToolbarTypes } from './EditorTypes'
11
11
 
12
- const ToolbarDropdown = ({editor}: any) => {
12
+ const ToolbarDropdown = ({editor}: any): React.ReactElement => {
13
13
  const [showPopover, setShowPopover] = useState(false)
14
14
 
15
15
  const toolbarDropdownItems = [
@@ -81,11 +81,21 @@ for (const { text, isActive, icon } of toolbarDropdownItems) {
81
81
  if (isActive) {
82
82
  activeCount ++
83
83
  activeItems.push(
84
- <Flex align="center" key={icon} gap="xs">
85
- <Icon icon={icon} size="lg" />
84
+ <Flex align="center"
85
+ gap="xs"
86
+ key={icon}
87
+ >
88
+ <Icon icon={icon}
89
+ size="lg"
90
+ />
86
91
  <div>{text}</div>
87
- <Flex className={showPopover ? "fa-flip-vertical" : ""} display="inline_flex">
88
- <Icon fixedWidth icon="angle-down" margin-left="xs" />
92
+ <Flex className={showPopover ? "fa-flip-vertical" : ""}
93
+ display="inline_flex"
94
+ >
95
+ <Icon fixedWidth
96
+ icon="angle-down"
97
+ margin-left="xs"
98
+ />
89
99
  </Flex>
90
100
  </Flex>
91
101
  );
@@ -93,7 +103,10 @@ for (const { text, isActive, icon } of toolbarDropdownItems) {
93
103
  }
94
104
 
95
105
  const popoverReference = (
96
- <Button className="editor-dropdown-button" onClick={handleTogglePopover} variant="secondary">
106
+ <Button className="editor-dropdown-button"
107
+ onClick={handleTogglePopover}
108
+ variant="secondary"
109
+ >
97
110
  {
98
111
  activeCount === 2 ? (
99
112
  activeItems[1]
@@ -101,11 +114,21 @@ const popoverReference = (
101
114
  activeCount === 1 ? (
102
115
  activeItems[0] || null
103
116
  ) : (
104
- <Flex align="center" key="paragraph" gap="xs">
105
- <Icon icon="paragraph" size="lg" />
117
+ <Flex align="center"
118
+ gap="xs"
119
+ key="paragraph"
120
+ >
121
+ <Icon icon="paragraph"
122
+ size="lg"
123
+ />
106
124
  <div>Paragraph</div>
107
- <Flex className={showPopover ? "fa-flip-vertical" : ""} display="inline_flex">
108
- <Icon fixedWidth icon="angle-down" margin-left="xs" />
125
+ <Flex className={showPopover ? "fa-flip-vertical" : ""}
126
+ display="inline_flex"
127
+ >
128
+ <Icon fixedWidth
129
+ icon="angle-down"
130
+ margin-left="xs"
131
+ />
109
132
  </Flex>
110
133
  </Flex>
111
134
  )
@@ -124,21 +147,21 @@ const popoverReference = (
124
147
  show={showPopover}
125
148
  >
126
149
  <Nav
127
- paddingTop="xs"
128
- paddingBottom="xs"
129
- variant="subtle"
150
+ paddingBottom="xs"
151
+ paddingTop="xs"
152
+ variant="subtle"
130
153
  >
131
- {toolbarDropdownItems.map(({ icon, text, onclick, isActive}:ToolbarTypes, index:number) => (
154
+ {toolbarDropdownItems.map(({ icon, text, onclick, isActive}: ToolbarTypes, index: number) => (
132
155
  <NavItem
133
- cursor="pointer"
134
- className={`pb_tiptap_toolbar_dropdown_list_item ${isActive ? "is-active" : ""}`}
135
- iconLeft={icon}
136
- key={`${text}_${index}`}
137
- margin='none'
138
- onClick={()=> {onclick(); setShowPopover(false)}}
139
- text={text}
140
- paddingTop='xxs'
141
- paddingBottom='xxs'
156
+ className={`pb_tiptap_toolbar_dropdown_list_item ${isActive ? "is-active" : ""}`}
157
+ cursor="pointer"
158
+ iconLeft={icon}
159
+ key={`${text}_${index}`}
160
+ margin='none'
161
+ onClick={()=> {onclick(); setShowPopover(false)}}
162
+ paddingBottom='xxs'
163
+ paddingTop='xxs'
164
+ text={text}
142
165
  />
143
166
  ))}
144
167
  </Nav>
@@ -3,7 +3,7 @@ import FlexItem from "../../pb_flex/_flex_item";
3
3
  import EditorButton from "./EditorButton";
4
4
  import { ToolbarTypes } from "./EditorTypes";
5
5
 
6
- const ToolbarHistoryItems = ({editor}:any) => {
6
+ const ToolbarHistoryItems = ({editor}: any): React.ReactElement => {
7
7
 
8
8
  const toolbarHistoryItems = [
9
9
  {
@@ -26,14 +26,14 @@ const toolbarHistoryItems = [
26
26
  <>
27
27
  <FlexItem displayFlex>
28
28
  {toolbarHistoryItems.map(
29
- ({ onclick, classname, disable, icon, text }:ToolbarTypes, index:number) => (
29
+ ({ onclick, classname, disable, icon, text }: ToolbarTypes, index: number) => (
30
30
  <EditorButton
31
- classname={classname}
32
- onclick={onclick}
33
- disable={disable}
34
- icon={icon}
35
- key={index}
36
- text={text}
31
+ classname={classname}
32
+ disable={disable}
33
+ icon={icon}
34
+ key={index}
35
+ onclick={onclick}
36
+ text={text}
37
37
  />
38
38
  )
39
39
  )}
@@ -2,7 +2,7 @@ import React, {useCallback} from "react";
2
2
  import EditorButton from "./EditorButton";
3
3
  import { ToolbarTypes } from "./EditorTypes";
4
4
 
5
- const ToolbarNodes = ({editor}:any) => {
5
+ const ToolbarNodes = ({editor}: any): React.ReactElement => {
6
6
 
7
7
  // eslint-disable-next-line react-hooks/rules-of-hooks
8
8
  const setLink = useCallback(() => {
@@ -42,13 +42,13 @@ const toolbarNodesItems = [
42
42
 
43
43
  return (
44
44
  <>
45
- {toolbarNodesItems.map(({ onclick, icon, text, isActive }:ToolbarTypes, index:number) => (
45
+ {toolbarNodesItems.map(({ onclick, icon, text, isActive }: ToolbarTypes, index: number) => (
46
46
  <EditorButton
47
- classname={`toolbar_button ${isActive ? 'is-active' : ''}`}
48
- onclick={onclick}
49
- icon={icon}
50
- key={index}
51
- text={text}
47
+ classname={`toolbar_button ${isActive ? 'is-active' : ''}`}
48
+ icon={icon}
49
+ key={index}
50
+ onclick={onclick}
51
+ text={text}
52
52
  />
53
53
  ))}
54
54
  </>
@@ -17,27 +17,27 @@ import { TrixEditor } from "react-trix"
17
17
  import EditorToolbar from './TipTap/Toolbar'
18
18
 
19
19
  type Editor = {
20
- attributeIsActive?: Function,
20
+ attributeIsActive?: ([any]: string) => boolean,
21
21
  element?: HTMLElement,
22
- getSelectedDocument?: Function,
22
+ getSelectedDocument?: () => any,
23
23
  getSelectedRange?: () => Array<number>,
24
- insertHTML?: Function,
25
- loadHTML?: Function,
26
- setSelectedRange?: (range: Array<number>) => void,
24
+ insertHTML?: ([any]: string) => void,
25
+ loadHTML?: ([any]: string) => void,
26
+ setSelectedRange?: (range: Array<number>) => void,
27
27
  }
28
28
 
29
29
  type RichTextEditorProps = {
30
30
  aria?: { [key: string]: string },
31
31
  advancedEditor?: any,
32
32
  advancedEditorToolbar?: boolean,
33
- toolbarBottom?: Boolean,
33
+ toolbarBottom?: boolean,
34
34
  children?: React.ReactNode | React.ReactNode[]
35
35
  className?: string,
36
36
  data?: { [key: string]: string },
37
37
  focus?: boolean,
38
- htmlOptions?: {[key: string]: string | number | boolean | Function},
38
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
39
39
  id?: string,
40
- inline?: boolean,
40
+ inline?: boolean,
41
41
  extensions?: { [key: string]: string }[],
42
42
  name?: string,
43
43
  onChange: (html: string, text: string) => void,
@@ -49,7 +49,7 @@ type RichTextEditorProps = {
49
49
  maxWidth?: string
50
50
  } & GlobalProps
51
51
 
52
- const RichTextEditor = (props: RichTextEditorProps) => {
52
+ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
53
53
  const {
54
54
  aria = {},
55
55
  advancedEditor,
@@ -81,7 +81,6 @@ const RichTextEditor = (props: RichTextEditorProps) => {
81
81
  const handleOnEditorReady = (editorInstance: Editor) => setEditor(editorInstance),
82
82
  element = editor?.element
83
83
 
84
-
85
84
  // DOM manipulation must wait for editor to be ready
86
85
  if (editor) {
87
86
  const toolbarElement = element.parentElement.querySelector('trix-toolbar') as HTMLElement,
@@ -117,6 +116,7 @@ const RichTextEditor = (props: RichTextEditorProps) => {
117
116
  focus
118
117
  ? (document.addEventListener('trix-focus', useFocus),
119
118
  document.addEventListener('trix-blur', useFocus),
119
+ // eslint-disable-next-line react-hooks/rules-of-hooks
120
120
  useFocus())
121
121
  : null
122
122
 
@@ -164,10 +164,10 @@ const RichTextEditor = (props: RichTextEditorProps) => {
164
164
 
165
165
  return (
166
166
  <div
167
- {...ariaProps}
168
- {...dataProps}
169
- {...htmlProps}
170
- className={css}
167
+ {...ariaProps}
168
+ {...dataProps}
169
+ {...htmlProps}
170
+ className={css}
171
171
  >
172
172
  {
173
173
  advancedEditor ? (
@@ -175,9 +175,11 @@ const RichTextEditor = (props: RichTextEditorProps) => {
175
175
  className={classnames("pb_rich_text_editor_advanced_container", {
176
176
  ["toolbar-active"]: advancedEditorToolbar,
177
177
  })}
178
- >
178
+ >
179
179
  {advancedEditorToolbar && (
180
- <EditorToolbar extensions={extensions} editor={advancedEditor}/>
180
+ <EditorToolbar editor={advancedEditor}
181
+ extensions={extensions}
182
+ />
181
183
  )}
182
184
  { children }
183
185
  </div>
@@ -12,7 +12,7 @@ type SectionSeparatorProps = {
12
12
  className?: string,
13
13
  dark?: boolean,
14
14
  data?: { [key: string]: string; },
15
- htmlOptions?: {[key: string]: string | number | boolean | Function},
15
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
16
16
  id?: string,
17
17
  lineStyle?: "solid" | "dashed",
18
18
  orientation?: "horizontal" | "vertical",
@@ -20,7 +20,7 @@ type SectionSeparatorProps = {
20
20
  variant?: "card" | "background",
21
21
  }
22
22
 
23
- const SectionSeparator = (props: SectionSeparatorProps) => {
23
+ const SectionSeparator = (props: SectionSeparatorProps): React.ReactElement => {
24
24
  const {
25
25
  aria = {},
26
26
  children,
@@ -42,17 +42,19 @@ const SectionSeparator = (props: SectionSeparatorProps) => {
42
42
  return (
43
43
 
44
44
  <div
45
- {...ariaProps}
46
- {...dataProps}
47
- {...htmlProps}
48
- className={classes}
49
- id={id}
45
+ {...ariaProps}
46
+ {...dataProps}
47
+ {...htmlProps}
48
+ className={classes}
49
+ id={id}
50
50
  >
51
51
  {
52
52
  children && children ||
53
53
  text && (
54
54
  <span>
55
- <Caption text={text} dark={dark} />
55
+ <Caption dark={dark}
56
+ text={text}
57
+ />
56
58
  </span>
57
59
  )
58
60
  }
@@ -24,7 +24,7 @@ type SelectProps = {
24
24
  data?: { [key: string]: string },
25
25
  disabled?: boolean,
26
26
  error?: string,
27
- htmlOptions?: {[key: string]: string | number | boolean | Function},
27
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
28
28
  id?: string,
29
29
  includeBlank?: string,
30
30
  inline?: boolean,
@@ -63,7 +63,7 @@ const Select = ({
63
63
  inline = false,
64
64
  multiple = false,
65
65
  name,
66
- onChange = () => {},
66
+ onChange = () => undefined,
67
67
  options = [],
68
68
  required = false,
69
69
  value,
@@ -0,0 +1,15 @@
1
+ ![select-default](https://github.com/powerhome/playbook/assets/54749071/ead0e074-46ae-425a-ab32-d9c4418a0783)
2
+
3
+
4
+ ```swift
5
+ let defaultOptions = [
6
+ (value: "1", text: "Burgers"),
7
+ (value: "2", text: "Pizza"),
8
+ (value: "3", text: "Tacos")
9
+ ]
10
+ @State private var defaultState = ""
11
+
12
+ PBSelect(title: "Favorite Food", options: defaultOptions, style: .default) { selected in
13
+ defaultState = selected
14
+ }
15
+ ```
@@ -0,0 +1,18 @@
1
+ ![select-error](https://github.com/powerhome/playbook/assets/54749071/c02e365b-c3a1-446b-b9f2-47db11315786)
2
+
3
+ ```swift
4
+ let defaultOptions = [
5
+ (value: "1", text: "Burgers"),
6
+ (value: "2", text: "Pizza"),
7
+ (value: "3", text: "Tacos")
8
+ ]
9
+ @State private var errorState = ""
10
+
11
+ PBSelect(
12
+ title: "Favorite Food",
13
+ options: defaultOptions,
14
+ style: .error("Please make a valid selection")
15
+ ) { selected in
16
+ errorState = selected
17
+ }
18
+ ```
@@ -0,0 +1,8 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **title** | `String` | Sets label title for dropdown | | |
5
+ | **options** | `(String, String)` | Displays the list of dropdown options | | |
6
+ | **style** | `Variant` | Options for the state of dropdown | `.default` | `default` `disabled` `error` |
7
+ | **selectedOption** | `String` | Changes selected value when new value is selected | | |
8
+ | **selected** | `String` | Changes the value of the option selected in dropdown | | |
@@ -28,3 +28,8 @@ examples:
28
28
  - select_inline: Select Inline
29
29
  - select_inline_compact: Select Inline Compact
30
30
  - select_multiple: Select Multiple
31
+
32
+ swift:
33
+ - select_default_swift: Default
34
+ - select_error_swift: Error
35
+ - select_props_table: ""
@@ -28,7 +28,7 @@ type SelectableCardProps = {
28
28
  disabled?: boolean,
29
29
  error?: boolean,
30
30
  icon?: boolean,
31
- htmlOptions?: {[key: string]: string | number | boolean | Function},
31
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
32
32
  inputId?: string,
33
33
  id?: string,
34
34
  multi?: boolean,
@@ -22,7 +22,7 @@ type SelectableCardIconProps = {
22
22
  dark?: boolean,
23
23
  data?: { [key: string]: string },
24
24
  disabled?: boolean,
25
- htmlOptions?: {[key: string]: string | number | boolean | Function},
25
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
26
26
  icon?: string,
27
27
  inputId?: string,
28
28
  multi?: boolean,
@@ -33,7 +33,7 @@ type SelectableCardIconProps = {
33
33
  onChange?: (event: React.FormEvent<HTMLInputElement>) => void,
34
34
  }
35
35
 
36
- const SelectableCardIcon = (props: SelectableCardIconProps) => {
36
+ const SelectableCardIcon = (props: SelectableCardIconProps): React.ReactElement => {
37
37
  const {
38
38
  aria = {},
39
39
  checkmark = false,
@@ -70,36 +70,37 @@ const SelectableCardIcon = (props: SelectableCardIconProps) => {
70
70
 
71
71
  return (
72
72
  <div
73
- {...ariaProps}
74
- {...dataProps}
75
- {...htmlProps}
76
- className={classes}
73
+ {...ariaProps}
74
+ {...dataProps}
75
+ {...htmlProps}
76
+ className={classes}
77
77
  >
78
78
  <SelectableCard
79
- checked={checked}
80
- customIcon={customIcon}
81
- dark={dark}
82
- disabled={disabled}
83
- icon={checkmark}
84
- inputId={inputId}
85
- multi={multi}
86
- name={name}
87
- onChange={onChange}
88
- value={value}
79
+ checked={checked}
80
+ customIcon={customIcon}
81
+ dark={dark}
82
+ disabled={disabled}
83
+ icon={checkmark}
84
+ inputId={inputId}
85
+ multi={multi}
86
+ name={name}
87
+ onChange={onChange}
88
+ value={value}
89
89
  >
90
90
  {
91
91
  <>
92
92
  <SelectableIcon
93
- customIcon={customIcon}
94
- icon={icon}
95
- inputId={''}
96
- inputs="disabled"
97
- name={''}
98
- text={titleText} />
93
+ customIcon={customIcon}
94
+ icon={icon}
95
+ inputId={''}
96
+ inputs="disabled"
97
+ name={''}
98
+ text={titleText}
99
+ />
99
100
  <Body
100
- color="light"
101
- dark={dark}
102
- text={bodyText}
101
+ color="light"
102
+ dark={dark}
103
+ text={bodyText}
103
104
  />
104
105
  </>
105
106
  }
@@ -6,10 +6,11 @@ import {
6
6
  buildAriaProps,
7
7
  buildCss,
8
8
  buildDataProps,
9
- buildHtmlProps
9
+ buildHtmlProps
10
10
  } from '../utilities/props'
11
11
  import Icon from '../pb_icon/_icon'
12
12
  import Title from '../pb_title/_title'
13
+ import { GenericObject } from '../types'
13
14
 
14
15
  type SelectableIconProps = {
15
16
  aria?: {[key: string]: string},
@@ -17,8 +18,8 @@ type SelectableIconProps = {
17
18
  className?: string,
18
19
  customIcon?: {[key: string] :SVGElement},
19
20
  disabled?: boolean,
20
- data?: Object,
21
- htmlOptions?: {[key: string]: string | number | boolean | Function},
21
+ data?: GenericObject,
22
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
22
23
  icon: string,
23
24
  inputId: string,
24
25
  inputs: string,
@@ -44,7 +45,7 @@ const SelectableIcon = ({
44
45
  text,
45
46
  value,
46
47
  ...props
47
- }: SelectableIconProps) => {
48
+ }: SelectableIconProps): React.ReactElement => {
48
49
  const ariaProps = buildAriaProps(aria)
49
50
  const dataProps = buildDataProps(data)
50
51
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -64,22 +65,22 @@ const SelectableIcon = ({
64
65
 
65
66
  return (
66
67
  <div
67
- {...ariaProps}
68
- {...dataProps}
69
- {...htmlProps}
70
- className={classes}
68
+ {...ariaProps}
69
+ {...dataProps}
70
+ {...htmlProps}
71
+ className={classes}
71
72
  >
72
73
  {inputs === 'disabled' && (
73
74
  <>
74
75
  <Icon
75
- customIcon={customIcon}
76
- icon={icon}
77
- size="2x"
76
+ customIcon={customIcon}
77
+ icon={icon}
78
+ size="2x"
78
79
  />
79
80
  <Title
80
- size={4}
81
- tag="h4"
82
- text={text}
81
+ size={4}
82
+ tag="h4"
83
+ text={text}
83
84
  />
84
85
  </>
85
86
  )}
@@ -87,24 +88,24 @@ const SelectableIcon = ({
87
88
  {inputs === 'enabled' && (
88
89
  <>
89
90
  <input
90
- {...props}
91
- checked={checked}
92
- disabled={disabled}
93
- id={inputIdPresent}
94
- name={name}
95
- type={inputType}
96
- value={value}
91
+ {...props}
92
+ checked={checked}
93
+ disabled={disabled}
94
+ id={inputIdPresent}
95
+ name={name}
96
+ type={inputType}
97
+ value={value}
97
98
  />
98
99
  <label htmlFor={inputIdPresent}>
99
100
  <Icon
100
- customIcon={customIcon}
101
- icon={icon}
102
- size="2x"
101
+ customIcon={customIcon}
102
+ icon={icon}
103
+ size="2x"
103
104
  />
104
105
  <Title
105
- size={4}
106
- tag="h4"
107
- text={text}
106
+ size={4}
107
+ tag="h4"
108
+ text={text}
108
109
  />
109
110
  </label>
110
111
  </>
@@ -15,7 +15,7 @@ export type SelectableListItemProps = {
15
15
  className?: string;
16
16
  data?: object;
17
17
  defaultChecked?: boolean;
18
- htmlOptions?: { [key: string]: string | number | boolean | Function };
18
+ htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
19
19
  id?: string;
20
20
  label?: string;
21
21
  text?: string;
@@ -7,13 +7,14 @@ import { SelectableListItemProps } from './_item.js'
7
7
 
8
8
  import List from '../pb_list/_list'
9
9
  import SelectableListItem from './_item'
10
+ import { GenericObject } from '../types'
10
11
 
11
12
  type SelectableListProps = {
12
13
  aria?: {[key: string]: string },
13
14
  children?: React.ReactElement[],
14
15
  className?: string,
15
- data?: object,
16
- htmlOptions?: {[key: string]: string | number | boolean | Function},
16
+ data?: GenericObject,
17
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
17
18
  id?: string,
18
19
  variant?: 'checkbox' | 'radio',
19
20
  }