playbook_ui 13.12.0 → 13.13.0.pre.alpha.PLAY1097linterenhancedelement1728

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +5 -1
  3. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +6 -2
  4. data/app/pb_kits/playbook/pb_background/_background.tsx +9 -5
  5. data/app/pb_kits/playbook/pb_badge/_badge.tsx +5 -1
  6. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +6 -2
  7. data/app/pb_kits/playbook/pb_body/_body.tsx +5 -1
  8. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.tsx +5 -1
  9. data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.tsx +5 -2
  10. data/app/pb_kits/playbook/pb_button/_button.tsx +8 -1
  11. data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.tsx +5 -1
  12. data/app/pb_kits/playbook/pb_caption/_caption.tsx +6 -1
  13. data/app/pb_kits/playbook/pb_card/_card.tsx +5 -1
  14. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +7 -2
  15. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +7 -2
  16. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +5 -3
  17. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +5 -1
  18. data/app/pb_kits/playbook/pb_contact/_contact.tsx +5 -1
  19. data/app/pb_kits/playbook/pb_contact/docs/_contact_default_swift.md +14 -0
  20. data/app/pb_kits/playbook/pb_contact/docs/_contact_props_swift.md +6 -0
  21. data/app/pb_kits/playbook/pb_contact/docs/_contact_with_detail_swift.md +14 -0
  22. data/app/pb_kits/playbook/pb_contact/docs/example.yml +6 -0
  23. data/app/pb_kits/playbook/pb_currency/_currency.tsx +5 -1
  24. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.tsx +5 -1
  25. data/app/pb_kits/playbook/pb_date/_date.tsx +12 -7
  26. data/app/pb_kits/playbook/pb_date/docs/_date_alignment_swift.md +11 -0
  27. data/app/pb_kits/playbook/pb_date/docs/_date_default_swift.md +16 -0
  28. data/app/pb_kits/playbook/pb_date/docs/_date_props_swift.md +8 -0
  29. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled_swift.md +11 -0
  30. data/app/pb_kits/playbook/pb_date/docs/_date_variants_swift.md +14 -0
  31. data/app/pb_kits/playbook/pb_date/docs/example.yml +7 -0
  32. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +5 -1
  33. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +5 -1
  34. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +15 -4
  35. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +12 -5
  36. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +5 -1
  37. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +5 -1
  38. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +15 -4
  39. data/app/pb_kits/playbook/pb_detail/_detail.tsx +5 -1
  40. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +11 -3
  41. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.tsx +8 -3
  42. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx +5 -1
  43. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.tsx +8 -1
  44. data/app/pb_kits/playbook/pb_enhanced_element/element_observer.ts +1 -1
  45. data/app/pb_kits/playbook/pb_enhanced_element/index.ts +1 -1
  46. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +6 -2
  47. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.md +1 -0
  48. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +6 -1
  49. data/app/pb_kits/playbook/pb_flex/_flex.tsx +6 -1
  50. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +6 -1
  51. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +5 -1
  52. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -1
  53. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +6 -2
  54. data/app/pb_kits/playbook/pb_hashtag/_hashtag.tsx +5 -1
  55. data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +5 -0
  56. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +10 -3
  57. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default_swift.md +18 -0
  58. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis_swift.md +34 -0
  59. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_link_swift.md +18 -0
  60. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_modified_swift.md +13 -0
  61. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_props_swift.md +14 -0
  62. data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +6 -0
  63. data/app/pb_kits/playbook/pb_icon/_icon.tsx +7 -1
  64. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +5 -1
  65. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +5 -1
  66. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +5 -1
  67. data/app/pb_kits/playbook/pb_image/_image.tsx +6 -1
  68. data/app/pb_kits/playbook/pb_label_pill/_label_pill.tsx +5 -1
  69. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +6 -2
  70. data/app/pb_kits/playbook/pb_layout/_layout.tsx +6 -1
  71. data/app/pb_kits/playbook/pb_legend/_legend.tsx +5 -1
  72. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +6 -1
  73. data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +5 -1
  74. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +9 -3
  75. data/app/pb_kits/playbook/pb_list/_list.tsx +7 -2
  76. data/app/pb_kits/playbook/pb_list/_list_item.tsx +5 -1
  77. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +5 -1
  78. data/app/pb_kits/playbook/pb_map/_map.tsx +6 -1
  79. data/app/pb_kits/playbook/pb_message/_message.tsx +5 -1
  80. data/app/pb_kits/playbook/pb_message/_message_mention.tsx +5 -1
  81. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +5 -1
  82. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +5 -1
  83. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_default_swift.md +11 -0
  84. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_props_swift.md +7 -0
  85. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_reverse_swift.md +13 -0
  86. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_size_swift.md +11 -0
  87. data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +6 -0
  88. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +5 -1
  89. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md +15 -0
  90. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md +5 -0
  91. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md +15 -0
  92. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md +15 -0
  93. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +6 -0
  94. data/app/pb_kits/playbook/pb_nav/_item.tsx +7 -2
  95. data/app/pb_kits/playbook/pb_nav/_nav.tsx +5 -1
  96. data/app/pb_kits/playbook/pb_online_status/_online_status.tsx +5 -1
  97. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +6 -2
  98. data/app/pb_kits/playbook/pb_person/_person.tsx +5 -0
  99. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +5 -1
  100. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +8 -2
  101. data/app/pb_kits/playbook/pb_pill/_pill.tsx +5 -1
  102. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -1
  103. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +5 -1
  104. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +9 -3
  105. data/app/pb_kits/playbook/pb_progress_step/_progress_step.tsx +5 -1
  106. data/app/pb_kits/playbook/pb_progress_step/_progress_step_item.tsx +6 -2
  107. data/app/pb_kits/playbook/pb_radio/_radio.tsx +5 -1
  108. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +7 -1
  109. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +5 -1
  110. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_children_swift.md +14 -0
  111. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_dashed_swift.md +7 -0
  112. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_line_swift.md +8 -0
  113. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_props_swift.md +8 -0
  114. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text_swift.md +7 -0
  115. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical_swift.md +18 -0
  116. data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +8 -0
  117. data/app/pb_kits/playbook/pb_select/_select.tsx +6 -1
  118. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +6 -2
  119. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +5 -0
  120. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +5 -0
  121. data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +11 -3
  122. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +5 -1
  123. data/app/pb_kits/playbook/pb_source/_source.tsx +5 -1
  124. data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +5 -1
  125. data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +14 -2
  126. data/app/pb_kits/playbook/pb_stat_value/_stat_value.tsx +6 -0
  127. data/app/pb_kits/playbook/pb_table/_table.tsx +5 -1
  128. data/app/pb_kits/playbook/pb_table/_table_row.tsx +5 -1
  129. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +5 -1
  130. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on_swift.md +35 -0
  131. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md +29 -0
  132. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled_swift.md +13 -0
  133. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error_swift.md +24 -0
  134. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md +13 -0
  135. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +7 -0
  136. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +5 -2
  137. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default_swift.md +27 -0
  138. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error_swift.md +11 -0
  139. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_props_swift.md +9 -0
  140. data/app/pb_kits/playbook/pb_textarea/docs/example.yml +5 -0
  141. data/app/pb_kits/playbook/pb_time/_time.tsx +9 -2
  142. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +5 -1
  143. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +6 -2
  144. data/app/pb_kits/playbook/pb_timeline/_item.tsx +9 -2
  145. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -1
  146. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +5 -1
  147. data/app/pb_kits/playbook/pb_title/_title.tsx +5 -1
  148. data/app/pb_kits/playbook/pb_title_count/_title_count.tsx +5 -1
  149. data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +16 -3
  150. data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +5 -0
  151. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default_swift.md +11 -0
  152. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name_swift.md +10 -0
  153. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_props_swift.md +6 -0
  154. data/app/pb_kits/playbook/pb_toggle/docs/example.yml +4 -0
  155. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +5 -1
  156. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +9 -3
  157. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +7 -2
  158. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +2 -2
  159. data/app/pb_kits/playbook/pb_user/_user.tsx +5 -1
  160. data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +5 -1
  161. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +5 -1
  162. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +5 -1
  163. data/app/pb_kits/playbook/utilities/props.ts +16 -0
  164. data/dist/menu.yml +240 -168
  165. data/dist/playbook-rails.js +5 -5
  166. data/lib/playbook/version.rb +2 -2
  167. metadata +46 -7
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from "react";
2
2
  import classnames from "classnames";
3
3
 
4
- import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
4
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
5
5
  import { globalProps } from "../utilities/globalProps";
6
6
 
7
7
  import Checkbox from "../pb_checkbox/_checkbox";
@@ -15,6 +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
19
  id?: string;
19
20
  label?: string;
20
21
  text?: string;
@@ -31,6 +32,7 @@ const SelectableListItem = ({
31
32
  className,
32
33
  data = {},
33
34
  defaultChecked,
35
+ htmlOptions = {},
34
36
  id,
35
37
  label,
36
38
  text = "",
@@ -41,7 +43,8 @@ const SelectableListItem = ({
41
43
  ...props
42
44
  }: SelectableListItemProps) => {
43
45
  const ariaProps = buildAriaProps(aria);
44
- const dataProps = buildDataProps(data);
46
+ const dataProps = buildDataProps(data)
47
+ const htmlProps = buildHtmlProps(htmlOptions);
45
48
  const classes = classnames(
46
49
  buildCss("pb_selectable_list_item_kit"),
47
50
  globalProps(props),
@@ -61,7 +64,12 @@ const SelectableListItem = ({
61
64
  {...props}
62
65
  className={classnames(checkedState ? "checked_item" : "", className)}
63
66
  >
64
- <div {...ariaProps} {...dataProps} className={classes}>
67
+ <div
68
+ {...ariaProps}
69
+ {...dataProps}
70
+ {...htmlProps}
71
+ className={classes}
72
+ >
65
73
  {variant == "checkbox" && (
66
74
  <>
67
75
  <Checkbox
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
4
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
5
  import { globalProps } from '../utilities/globalProps'
6
6
  import { SelectableListItemProps } from './_item.js'
7
7
 
@@ -13,6 +13,7 @@ type SelectableListProps = {
13
13
  children?: React.ReactElement[],
14
14
  className?: string,
15
15
  data?: object,
16
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
16
17
  id?: string,
17
18
  variant?: 'checkbox' | 'radio',
18
19
  }
@@ -23,12 +24,14 @@ const SelectableList = (props: SelectableListProps) => {
23
24
  children,
24
25
  className,
25
26
  data = {},
27
+ htmlOptions = {},
26
28
  id,
27
29
  } = props
28
30
 
29
31
  const ariaProps = buildAriaProps(aria)
30
32
  const classes = classnames(buildCss('pb_selectable_list_kit'), globalProps(props), className)
31
33
  const dataProps = buildDataProps(data)
34
+ const htmlProps = buildHtmlProps(htmlOptions)
32
35
  const isRadio = props.variant === "radio"
33
36
  const defaultCheckedRadioValue = children.filter((item: {props:SelectableListItemProps} ) => item.props.defaultChecked)[0]?.props?.value
34
37
 
@@ -58,6 +61,7 @@ const SelectableList = (props: SelectableListProps) => {
58
61
  <div
59
62
  {...ariaProps}
60
63
  {...dataProps}
64
+ {...htmlProps}
61
65
  className={classes}
62
66
  id={id}
63
67
  >
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
- import { buildDataProps, buildAriaProps } from '../utilities/props'
4
+ import { buildDataProps, buildAriaProps, buildHtmlProps } from '../utilities/props'
5
5
  import { titleize } from '../utilities/text'
6
6
 
7
7
  import Avatar, { AvatarProps } from '../pb_avatar/_avatar'
@@ -15,6 +15,7 @@ type SourceProps = {
15
15
  className?: string,
16
16
  data?: { [key: string]: string },
17
17
  hideIcon: boolean,
18
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
18
19
  id?: string,
19
20
  source?: string,
20
21
  type: "events" | "inbound" | "outbound" | "prospecting" | "referral" | "retail" | "user",
@@ -26,12 +27,14 @@ const Source = ({
26
27
  className,
27
28
  data = {},
28
29
  hideIcon = false,
30
+ htmlOptions = {},
29
31
  id,
30
32
  source,
31
33
  type = 'inbound',
32
34
  user = {},
33
35
  }: SourceProps) => {
34
36
  const dataProps = buildDataProps(data)
37
+ const htmlProps = buildHtmlProps(htmlOptions)
35
38
  const ariaProps = buildAriaProps(aria)
36
39
 
37
40
  const css = classnames([
@@ -71,6 +74,7 @@ const Source = ({
71
74
  <div
72
75
  {...ariaProps}
73
76
  {...dataProps}
77
+ {...htmlProps}
74
78
  className={css}
75
79
  id={id}
76
80
  >
@@ -1,7 +1,7 @@
1
1
  import React from "react"
2
2
  import classnames from "classnames"
3
3
 
4
- import { buildAriaProps, buildDataProps } from "../utilities/props"
4
+ import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props"
5
5
 
6
6
  import Icon from "../pb_icon/_icon"
7
7
 
@@ -11,6 +11,7 @@ type StarRatingProps = {
11
11
  data?: object,
12
12
  fixedWidth?: boolean,
13
13
  hideRating: boolean,
14
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
14
15
  icon?: string,
15
16
  id?: string,
16
17
  rating: number,
@@ -20,12 +21,14 @@ const StarRating = ({
20
21
  aria = {},
21
22
  className,
22
23
  data = {},
24
+ htmlOptions = {},
23
25
  hideRating = false,
24
26
  id,
25
27
  rating = 0,
26
28
  }: StarRatingProps) => {
27
29
  const ariaProps = buildAriaProps(aria)
28
30
  const dataProps = buildDataProps(data)
31
+ const htmlProps = buildHtmlProps(htmlOptions)
29
32
  const css = classnames([
30
33
  "pb_star_rating_kit", className,
31
34
  ])
@@ -42,6 +45,7 @@ const StarRating = ({
42
45
  <div
43
46
  {...ariaProps}
44
47
  {...dataProps}
48
+ {...htmlProps}
45
49
  className={css}
46
50
  id={id}
47
51
  >
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
- import { buildCss } from '../utilities/props'
4
+ import { buildCss, buildHtmlProps } from '../utilities/props'
5
5
  import { globalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Body from '../pb_body/_body'
@@ -22,18 +22,29 @@ type StatChangeProps = {
22
22
  change?: 'increase' | 'decrease' | 'neutral',
23
23
  className?: string,
24
24
  icon?: string,
25
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
25
26
  id?: string,
26
27
  value?: string | number,
27
28
  }
28
29
 
29
30
  const StatChange = (props: StatChangeProps): React.ReactElement => {
30
- const { change = 'neutral', className, icon, id, value } = props
31
+ const {
32
+ change = 'neutral',
33
+ className,
34
+ htmlOptions = {},
35
+ icon,
36
+ id,
37
+ value
38
+ } = props
39
+
31
40
  const status = statusMap[change as keyof typeof statusMap]
32
41
  let returnedIcon = iconMap[change as keyof typeof iconMap]
33
42
  if (icon) {
34
43
  returnedIcon = icon
35
44
  }
36
45
 
46
+ const htmlProps = buildHtmlProps(htmlOptions)
47
+
37
48
  return (
38
49
  <>
39
50
  {value &&
@@ -44,6 +55,7 @@ const StatChange = (props: StatChangeProps): React.ReactElement => {
44
55
  className
45
56
  )}
46
57
  id={id}
58
+ {...htmlProps}
47
59
  >
48
60
  <Body status={status}>
49
61
  {returnedIcon &&
@@ -2,10 +2,12 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { globalProps } from '../utilities/globalProps'
5
+ import { buildHtmlProps } from '../utilities/props'
5
6
  import Title from '../pb_title/_title'
6
7
 
7
8
  type StatValueProps = {
8
9
  className?: string,
10
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
9
11
  id?: string,
10
12
  unit?: string,
11
13
  value: string | number,
@@ -14,11 +16,14 @@ type StatValueProps = {
14
16
  const StatValue = (props: StatValueProps): React.ReactElement => {
15
17
  const {
16
18
  className,
19
+ htmlOptions = {},
17
20
  id,
18
21
  unit,
19
22
  value = 0,
20
23
  } = props
21
24
 
25
+ const htmlProps = buildHtmlProps(htmlOptions)
26
+
22
27
  const displayValue = function(value: string | number) {
23
28
  if (value || value === 0) {
24
29
  return (
@@ -47,6 +52,7 @@ const StatValue = (props: StatValueProps): React.ReactElement => {
47
52
  <div
48
53
  className={classnames('pb_stat_value_kit', globalProps(props), className)}
49
54
  id={id}
55
+ {...htmlProps}
50
56
  >
51
57
  <div className="pb_stat_value_wrapper">
52
58
  {displayValue(value)}
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import classnames from 'classnames'
3
- import { buildAriaProps, buildDataProps } from '../utilities/props'
3
+ import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { globalProps } from '../utilities/globalProps'
5
5
  import PbTable from '.'
6
6
 
@@ -14,6 +14,7 @@ type TableProps = {
14
14
  data?: { [key: string]: string },
15
15
  dataTable: boolean,
16
16
  disableHover: boolean,
17
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
17
18
  id?: string,
18
19
  responsive: "collapse" | "scroll" | "none",
19
20
  singleLine: boolean,
@@ -33,6 +34,7 @@ const Table = (props: TableProps) => {
33
34
  data = {},
34
35
  dataTable = false,
35
36
  disableHover = false,
37
+ htmlOptions = {},
36
38
  id,
37
39
  responsive = 'collapse',
38
40
  singleLine = false,
@@ -43,6 +45,7 @@ const Table = (props: TableProps) => {
43
45
 
44
46
  const ariaProps = buildAriaProps(aria)
45
47
  const dataProps = buildDataProps(data)
48
+ const htmlProps = buildHtmlProps(htmlOptions)
46
49
  const tableCollapseCss = responsive !== 'none' ? `table-collapse-${collapse}` : ''
47
50
  const verticalBorderCss = verticalBorder ? 'vertical-border' : ''
48
51
 
@@ -55,6 +58,7 @@ const Table = (props: TableProps) => {
55
58
  <table
56
59
  {...ariaProps}
57
60
  {...dataProps}
61
+ {...htmlProps}
58
62
  className={classnames(
59
63
  'pb_table',
60
64
  `table-${size}`,
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
3
+ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { globalProps } from '../utilities/globalProps'
5
5
 
6
6
  type TableRowPropTypes = {
@@ -8,6 +8,7 @@ type TableRowPropTypes = {
8
8
  children: React.ReactNode[] | React.ReactNode,
9
9
  className: string,
10
10
  data?: { [key: string]: string },
11
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
11
12
  id?: string,
12
13
  sideHighlightColor: string,
13
14
  }
@@ -18,12 +19,14 @@ const TableRow = (props: TableRowPropTypes) => {
18
19
  children,
19
20
  className,
20
21
  data = {},
22
+ htmlOptions = {},
21
23
  id,
22
24
  sideHighlightColor = 'windows',
23
25
  } = props
24
26
 
25
27
  const ariaProps = buildAriaProps(aria)
26
28
  const dataProps = buildDataProps(data)
29
+ const htmlProps = buildHtmlProps(htmlOptions)
27
30
  const sideHighlightClass =
28
31
  sideHighlightColor != '' ? `side_highlight_${sideHighlightColor}` : null
29
32
  const classes = classnames(buildCss('pb_table_row_kit', sideHighlightClass), globalProps(props), className)
@@ -32,6 +35,7 @@ const TableRow = (props: TableRowPropTypes) => {
32
35
  <tr
33
36
  {...ariaProps}
34
37
  {...dataProps}
38
+ {...htmlProps}
35
39
  className={classes}
36
40
  id={id}
37
41
  >
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { globalProps, GlobalProps, domSafeProps } from '../utilities/globalProps'
5
- import { buildAriaProps, buildDataProps } from '../utilities/props'
5
+ import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
6
6
 
7
7
  import Flex from '../pb_flex/_flex'
8
8
  import Card from '../pb_card/_card'
@@ -17,6 +17,7 @@ type TextInputProps = {
17
17
  dark?: boolean,
18
18
  disabled?: boolean,
19
19
  error?: string,
20
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
20
21
  id?: string,
21
22
  inline?: boolean,
22
23
  name: string,
@@ -43,6 +44,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
43
44
  data = {},
44
45
  disabled,
45
46
  error,
47
+ htmlOptions = {},
46
48
  id,
47
49
  inline = false,
48
50
  name,
@@ -57,6 +59,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
57
59
 
58
60
  const ariaProps = buildAriaProps(aria)
59
61
  const dataProps = buildDataProps(data)
62
+ const htmlProps = buildHtmlProps(htmlOptions)
60
63
 
61
64
  const { alignment, border, icon } = addOn
62
65
  const addOnAlignment = alignment === 'left' ? 'left' : 'right'
@@ -138,6 +141,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
138
141
  <div
139
142
  {...ariaProps}
140
143
  {...dataProps}
144
+ {...htmlProps}
141
145
  className={css}
142
146
  >
143
147
  {label &&
@@ -0,0 +1,35 @@
1
+ ![text-input-add-on](https://github.com/powerhome/playbook/assets/92755007/65a28e6a-9e65-4ca1-af8d-91dae6eac4f5)
2
+
3
+ ```swift
4
+
5
+ PBTextInput(
6
+ "ADD ON WITH DEFAULTS",
7
+ text: $textAddOn,
8
+ style: .rightIcon(.user, divider: true)
9
+ )
10
+
11
+ PBTextInput(
12
+ "RIGHT-ALIGNED ADD ON WITH BORDER",
13
+ text: $textAddOnRight,
14
+ style: .rightIcon(.user, divider: true)
15
+ )
16
+
17
+ PBTextInput(
18
+ "RIGHT-ALIGNED ADD ON WITH NO BORDER",
19
+ text: $textAddOnRightNoBorder,
20
+ style: .rightIcon(.user, divider: false)
21
+ )
22
+
23
+ PBTextInput(
24
+ "LEFT-ALIGNED ADD ON WITH NO BORDER",
25
+ text: $textAddOnLeft,
26
+ style: .leftIcon(.user, divider: false)
27
+ )
28
+
29
+ PBTextInput(
30
+ "LEFT-ALIGNED ADD ON WITH BORDER",
31
+ text: $textAddOnLeftNoBorder,
32
+ style: .leftIcon(.user, divider: true)
33
+ )
34
+
35
+ ```
@@ -0,0 +1,29 @@
1
+ ![text-input-default](https://github.com/powerhome/playbook/assets/92755007/625a246e-9d5c-42ea-8c6e-7afcf0984c9a)
2
+
3
+
4
+ ```swift
5
+
6
+ @State private var textFirstName: String = ""
7
+ @State private var textLastName: String = ""
8
+ @State private var textPhone: String = ""
9
+
10
+ PBTextInput(
11
+ "First name",
12
+ text: $textFirstName,
13
+ placeholder: "Enter first name"
14
+ )
15
+
16
+ PBTextInput(
17
+ "Last name",
18
+ text: $textLastName,
19
+ placeholder: "Enter last name"
20
+ )
21
+
22
+ PBTextInput(
23
+ "Phone number",
24
+ text: $textPhone,
25
+ placeholder: "Enter phone number",
26
+ keyboardType: .phonePad
27
+ )
28
+
29
+ ```
@@ -0,0 +1,13 @@
1
+ ![text-input-disabled](https://github.com/powerhome/playbook/assets/92755007/0e08256e-dd76-4528-b748-826f38bbe6a0)
2
+
3
+
4
+ ```swift
5
+
6
+ PBTextInput(
7
+ "Last name",
8
+ text: $textDisabled,
9
+ placeholder: "Enter last name",
10
+ style: .disabled
11
+ )
12
+
13
+ ```
@@ -0,0 +1,24 @@
1
+ ![text-input-error](https://github.com/powerhome/playbook/assets/92755007/7c664f75-1d7a-4a94-bc59-6f845a68ce19)
2
+
3
+
4
+ ```swift
5
+
6
+ @State private var textError: String = ""
7
+ @State private var textConfirmError: String = ""
8
+
9
+ PBTextInput(
10
+ "Email address",
11
+ text: $textError,
12
+ placeholder: "Enter email address",
13
+ error: (true, "Insert a valid email"),
14
+ style: .leftIcon(.user, divider: true)
15
+ )
16
+
17
+ PBTextInput(
18
+ "Confirm email address",
19
+ text: $textConfirmError,
20
+ placeholder: "Confirm email address",
21
+ style: .leftIcon(.user, divider: true)
22
+ )
23
+
24
+ ```
@@ -0,0 +1,13 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **title** | `String` | Adds a title | `nil` | |
5
+ | **placeholder** | `String` | Adds placeholder text | `""` | |
6
+ | **error** | `(Bool, String)` | Changes the style of the Text Input | `nil` | |
7
+ | **style** | `Style` | Changes the style of the Text Input | `.default` | `.default` `.rightIcon` `.leftIcon` `.inline` `.disabled` |
8
+ | **onChange** | `Bool` | Adds an event handler | `nil` | |
9
+ | **keyboardType** | `UIKeyboardType` | Speficies the keyboard type (ios only) | `.default` | |
10
+ | **text** | `String` | Sets the Text Input's text value | | |
11
+ | **selected** | `Bool` | Changes the style of the Text Input | | `true` `false` |
12
+ | **isHovering** | `Bool` | Changes the style of the Text Input | `false` | `true` `false` |
13
+ | **isIconHovering** | `Bool` | Changes the style of the Text Input | `false` | `true` `false` |
@@ -16,3 +16,10 @@ examples:
16
16
  - text_input_add_on: Add On
17
17
  - text_input_inline: Inline
18
18
  - text_input_no_label: No Label
19
+
20
+ swift:
21
+ - text_input_default_swift: Default
22
+ - text_input_error_swift: With Error
23
+ - text_input_disabled_swift: Disabled
24
+ - text_input_add_on_swift: Add On
25
+ - text_input_props_swift: ""
@@ -6,7 +6,7 @@ import classnames from 'classnames'
6
6
  import PbTextarea from '.'
7
7
  import type { InputCallback } from '../types'
8
8
 
9
- import { buildAriaProps, buildDataProps } from '../utilities/props'
9
+ import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
10
10
  import { globalProps, GlobalProps } from '../utilities/globalProps'
11
11
 
12
12
  import Body from '../pb_body/_body'
@@ -22,6 +22,7 @@ type TextareaProps = {
22
22
  data?: {[key: string]: string},
23
23
  disabled?: boolean,
24
24
  error?: string,
25
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
25
26
  id?: string,
26
27
  inline?: boolean,
27
28
  object?: string,
@@ -44,6 +45,7 @@ const Textarea = ({
44
45
  children,
45
46
  data = {},
46
47
  disabled,
48
+ htmlOptions = {},
47
49
  inline = false,
48
50
  resize = 'none',
49
51
  error,
@@ -71,7 +73,7 @@ const Textarea = ({
71
73
  const noCount = typeof characterCount !== 'undefined'
72
74
  const ariaProps: {[key: string]: any} = buildAriaProps(aria)
73
75
  const dataProps: {[key: string]: any} = buildDataProps(data)
74
-
76
+ const htmlProps = buildHtmlProps(htmlOptions)
75
77
  const characterCounter = () => {
76
78
  return maxCharacters && characterCount ? `${checkIfZero(characterCount)} / ${maxCharacters}` : `${checkIfZero(characterCount)}`
77
79
  }
@@ -84,6 +86,7 @@ const Textarea = ({
84
86
  <div
85
87
  {...ariaProps}
86
88
  {...dataProps}
89
+ {...htmlProps}
87
90
  className={classes}
88
91
  >
89
92
  <Caption text={label} />
@@ -0,0 +1,27 @@
1
+ ![textarea-default](https://github.com/powerhome/playbook/assets/92755007/40eec958-63d7-4840-bf5c-f8d1e34c911a)
2
+
3
+ ```swift
4
+
5
+ @State var defaultText = ""
6
+ @State var placeholderText = ""
7
+ @State var customText = "Default value text"
8
+
9
+ VStack(alignment: .leading, spacing: Spacing.small) {
10
+ PBTextArea(
11
+ "Label",
12
+ text: $defaultText
13
+ )
14
+
15
+ PBTextArea(
16
+ "Label",
17
+ text: $placeholderText,
18
+ placeholder: "Placeholder with text"
19
+ )
20
+
21
+ PBTextArea(
22
+ "Label",
23
+ text: $customText
24
+ )
25
+ }
26
+
27
+ ```
@@ -0,0 +1,11 @@
1
+ ![textarea-error](https://github.com/powerhome/playbook/assets/92755007/6d47a914-ea0b-4fbc-9f2a-6237935a3b4c)
2
+
3
+ ```swift
4
+
5
+ PBTextArea(
6
+ "Label",
7
+ text: $errorText,
8
+ error: "This field has an error!"
9
+ )
10
+
11
+ ```
@@ -0,0 +1,9 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **characterCount** | `CharacterCount` | Adds a character counter to the Textarea | `.noCount` | `.noCount` `.count` `.maxCharacterCount` `.maxCharacterCountBlock` `.maxCharacterCountError` |
5
+ | **inline** | `Bool` | Changes the style of the Textarea | `false` | `true` `false` |
6
+ | **label** | `String` | Adds a label | `nil` | |
7
+ | **placeholder** | `String` | Adds placeholder text | `nil` | |
8
+ | **text** | `String` | Sets the Textarea's text value | `Binding<String>` | |
9
+ | **error** | `String` | Changes the style of the Textarea | `nil` | |
@@ -15,3 +15,8 @@ examples:
15
15
  - textarea_error: Textarea w/ Error
16
16
  - textarea_character_counter: Character Counter
17
17
  - textarea_inline: Inline
18
+
19
+ swift:
20
+ - textarea_default_swift: Default
21
+ - textarea_error_swift: Textarea w/ Error
22
+ - textarea_props_swift: ""
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import classnames from "classnames";
3
3
 
4
- import { buildCss } from "../utilities/props";
4
+ import { buildCss, buildHtmlProps } from "../utilities/props";
5
5
  import { globalProps, GlobalProps } from "../utilities/globalProps";
6
6
  import DateTime from '../pb_kit/dateTime';
7
7
 
@@ -16,6 +16,7 @@ type TimeProps = {
16
16
  date: Date;
17
17
  dark?: boolean;
18
18
  id?: string;
19
+ htmlOptions?: {[key: string]: string | number | boolean | Function};
19
20
  showIcon?: boolean;
20
21
  size?: "md" | "sm";
21
22
  showTimezone?: boolean;
@@ -28,6 +29,7 @@ const Time = (props: TimeProps) => {
28
29
  align,
29
30
  className,
30
31
  date,
32
+ htmlOptions = {},
31
33
  showIcon,
32
34
  size,
33
35
  timeZone,
@@ -41,8 +43,13 @@ const Time = (props: TimeProps) => {
41
43
  className
42
44
  );
43
45
 
46
+ const htmlProps = buildHtmlProps(htmlOptions);
47
+
44
48
  return (
45
- <div className={classes}>
49
+ <div
50
+ {...htmlProps}
51
+ className={classes}
52
+ >
46
53
  {showIcon && (
47
54
  unstyled
48
55
  ? (
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { globalProps, GlobalProps } from '../utilities/globalProps'
5
- import { buildAriaProps, buildDataProps } from '../utilities/props'
5
+ import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
6
6
  import DateTime from '../pb_kit/dateTime';
7
7
 
8
8
  import Body from '../pb_body/_body'
@@ -12,6 +12,7 @@ import Icon from '../pb_icon/_icon'
12
12
  type TimeRangeInlineProps = {
13
13
  aria?: { [key: string]: string },
14
14
  className?: string,
15
+ htmlOptions?: {[key: string]: string | number | boolean | Function},
15
16
  id?: string,
16
17
  data?: { [key: string]: string },
17
18
  alignment?: "left" | "center" | "vertical",
@@ -41,6 +42,7 @@ const TimeRangeInline = (props: TimeRangeInlineProps) => {
41
42
  className,
42
43
  data = {},
43
44
  alignment = 'left',
45
+ htmlOptions = {},
44
46
  size = 'sm',
45
47
  dark = false,
46
48
  icon = false,
@@ -52,6 +54,7 @@ const TimeRangeInline = (props: TimeRangeInlineProps) => {
52
54
 
53
55
  const dataProps: { [key: string]: string } = buildDataProps(data)
54
56
  const ariaProps: { [key: string]: string } = buildAriaProps(aria)
57
+ const htmlProps = buildHtmlProps(htmlOptions)
55
58
 
56
59
  const separator = (
57
60
  <Body color="light">
@@ -87,6 +90,7 @@ const TimeRangeInline = (props: TimeRangeInlineProps) => {
87
90
  <div
88
91
  {...ariaProps}
89
92
  {...dataProps}
93
+ {...htmlProps}
90
94
  className={classnames('pb_time_range_inline_kit_' + alignment, globalProps(props), className)}
91
95
  id={id}
92
96
  >