playbook_ui 14.1.0.pre.alpha.pbntr373enablekitsforradio3595 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +3 -3
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
  5. data/app/pb_kits/playbook/pb_badge/_badge.scss +0 -9
  6. data/app/pb_kits/playbook/pb_badge/_badge.tsx +3 -8
  7. data/app/pb_kits/playbook/pb_badge/badge.rb +1 -1
  8. data/app/pb_kits/playbook/pb_badge/badge.test.js +11 -17
  9. data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.html.erb +0 -13
  10. data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.jsx +12 -31
  11. data/app/pb_kits/playbook/pb_button/_button.tsx +1 -4
  12. data/app/pb_kits/playbook/pb_button/button.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_button/button.rb +0 -4
  14. data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +2 -2
  15. data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +1 -5
  16. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -3
  17. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +1 -20
  18. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
  19. data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +0 -4
  20. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +5 -1
  21. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -1
  22. data/app/pb_kits/playbook/pb_dialog/docs/index.js +0 -1
  23. data/app/pb_kits/playbook/pb_filter/filter.rb +1 -1
  24. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +0 -1
  25. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +25 -43
  26. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +2 -6
  27. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -2
  28. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +4 -4
  29. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +0 -4
  30. data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
  31. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -0
  32. data/app/pb_kits/playbook/pb_pagination/_pagination.scss +13 -49
  33. data/app/pb_kits/playbook/pb_pagination/docs/example.yml +1 -3
  34. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +7 -0
  35. data/app/pb_kits/playbook/pb_popover/_popover.tsx +5 -10
  36. data/app/pb_kits/playbook/pb_radio/_radio.scss +2 -2
  37. data/app/pb_kits/playbook/pb_radio/_radio.tsx +50 -100
  38. data/app/pb_kits/playbook/pb_radio/docs/example.yml +0 -1
  39. data/app/pb_kits/playbook/pb_radio/docs/index.js +0 -1
  40. data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +76 -50
  41. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +0 -1
  42. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +1 -2
  43. data/app/pb_kits/playbook/pb_star_rating/index.js +41 -78
  44. data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +2 -4
  45. data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +0 -17
  46. data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_display.tsx +2 -0
  47. data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_interactive.tsx +1 -0
  48. data/app/pb_kits/playbook/pb_time/_time.tsx +8 -12
  49. data/app/pb_kits/playbook/pb_time/time.html.erb +3 -3
  50. data/app/pb_kits/playbook/pb_time/time.rb +0 -4
  51. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -1
  52. data/app/pb_kits/playbook/utilities/globalProps.ts +3 -20
  53. data/dist/chunks/_typeahead-D6PRvP-1.js +22 -0
  54. data/dist/chunks/_weekday_stacked-DbdEuIzh.js +45 -0
  55. data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
  56. data/dist/chunks/{lib-DErGXNy3.js → lib-BE0Z3F7x.js} +2 -2
  57. data/dist/chunks/{pb_form_validation-BC6kh7Hu.js → pb_form_validation-TzZQ0Flx.js} +1 -1
  58. data/dist/chunks/vendor.js +1 -1
  59. data/dist/menu.yml +0 -4
  60. data/dist/playbook-doc.js +1 -1
  61. data/dist/playbook-rails-react-bindings.js +1 -1
  62. data/dist/playbook-rails.js +1 -1
  63. data/dist/playbook.css +1 -1
  64. data/lib/playbook/classnames.rb +0 -1
  65. data/lib/playbook/spacing.rb +2 -31
  66. data/lib/playbook/version.rb +2 -2
  67. metadata +13 -36
  68. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.jsx +0 -46
  69. data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.scss +0 -3
  70. data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +0 -72
  71. data/app/pb_kits/playbook/pb_gantt_chart/docs/_gantt_chart_default.jsx +0 -53
  72. data/app/pb_kits/playbook/pb_gantt_chart/docs/example.yml +0 -7
  73. data/app/pb_kits/playbook/pb_gantt_chart/docs/index.js +0 -1
  74. data/app/pb_kits/playbook/pb_gantt_chart/gantt_chart.test.jsx +0 -19
  75. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +0 -164
  76. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +0 -19
  77. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +0 -1
  78. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +0 -62
  79. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +0 -1
  80. data/app/pb_kits/playbook/pb_pagination/docs/data.js +0 -23
  81. data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -2
  82. data/app/pb_kits/playbook/pb_radio/docs/_radio_children.jsx +0 -51
  83. data/app/pb_kits/playbook/pb_rich_text_editor/_previewer_mixin.scss +0 -132
  84. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_preview.jsx +0 -73
  85. data/app/pb_kits/playbook/tokens/_container.scss +0 -21
  86. data/app/pb_kits/playbook/utilities/_min_width.scss +0 -45
  87. data/app/pb_kits/playbook/utilities/icons/allicons.tsx +0 -59
  88. data/app/pb_kits/playbook/utilities/icons/clock.svg +0 -9
  89. data/app/pb_kits/playbook/utilities/icons/spinner.svg +0 -3
  90. data/app/pb_kits/playbook/utilities/icons/times.svg +0 -3
  91. data/dist/chunks/_typeahead-CTLaD81v.js +0 -22
  92. data/dist/chunks/_weekday_stacked-U-4S3-tB.js +0 -45
  93. data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
  94. /data/app/pb_kits/playbook/pb_pagination/docs/{_pagination_default_rails.md → _pagination_default.md} +0 -0
@@ -46,7 +46,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
46
46
  } = props
47
47
 
48
48
  const iconClass = icon ? "_icon" : ""
49
- const closeIconSize = size === "small" ? "xs" : "sm"
50
49
  const css = classnames(
51
50
  `pb_form_pill_kit_${color}${iconClass}`,
52
51
  globalProps(props),
@@ -70,7 +69,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
70
69
  <Avatar
71
70
  imageUrl={avatarUrl}
72
71
  name={name}
73
- size="xxs"
72
+ size="xs"
74
73
  status={null}
75
74
  />
76
75
  <Title
@@ -85,7 +84,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
85
84
  <Avatar
86
85
  imageUrl={avatarUrl}
87
86
  name={name}
88
- size="xxs"
87
+ size="xs"
89
88
  status={null}
90
89
  />
91
90
  <Title
@@ -95,7 +94,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
95
94
  />
96
95
  <Icon
97
96
  className="pb_form_pill_icon"
98
- color={color}
99
97
  icon={icon}
100
98
  />
101
99
  </>
@@ -104,7 +102,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
104
102
  <>
105
103
  <Icon
106
104
  className="pb_form_pill_icon"
107
- color={color}
108
105
  icon={icon}
109
106
  />
110
107
  <Title
@@ -129,7 +126,6 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
129
126
  <Icon
130
127
  fixedWidth
131
128
  icon="times"
132
- size={closeIconSize}
133
129
  />
134
130
  </div>
135
131
  </div>
@@ -5,11 +5,11 @@ examples:
5
5
  - form_pill_size: Form Pill Size
6
6
  - form_pill_tag: Form Pill Tag
7
7
  - form_pill_example: Example
8
- - form_pill_icon: Form Pill Icon
8
+ # - form_pill_icon: Form Pill Icon
9
9
 
10
10
  react:
11
11
  - form_pill_user: Form Pill User
12
12
  - form_pill_size: Form Pill Size
13
13
  - form_pill_tag: Form Pill Tag
14
14
  - form_pill_example: Example
15
- - form_pill_icon: Form Pill Icon
15
+ # - form_pill_icon: Form Pill Icon
@@ -1,19 +1,19 @@
1
1
  <%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, tabindex: object.tabindex, **combined_html_options) do %>
2
2
  <% if object.name.present? %>
3
- <%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xxs" }) %>
3
+ <%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xs" }) %>
4
4
  <%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
5
5
  <% if object.icon.present? %>
6
- <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
6
+ <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", icon: object.icon }) %>
7
7
  <% end %>
8
8
  <% elsif object.text.present? %>
9
9
  <% if object.icon.present? %>
10
- <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", color: object.color, icon: object.icon }) %>
10
+ <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", icon: object.icon }) %>
11
11
  <% end %>
12
12
  <% if object.text.present? %>
13
13
  <%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_form_pill_tag" }) %>
14
14
  <% end %>
15
15
  <% end %>
16
16
  <%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
17
- <%= pb_rails("icon", props: { icon: 'times', fixed_width: true, size: object.close_icon_size }) %>
17
+ <%= pb_rails("icon", props: { icon: 'times' , fixed_width: true }) %>
18
18
  <% end %>
19
19
  <% end %>
@@ -32,10 +32,6 @@ module Playbook
32
32
  def icon_class
33
33
  icon ? "icon" : nil
34
34
  end
35
-
36
- def close_icon_size
37
- size == "small" ? "xs" : "sm"
38
- end
39
35
  end
40
36
  end
41
37
  end
@@ -28,7 +28,7 @@ type IconProps = {
28
28
  data?: {[key: string]: string},
29
29
  fixedWidth?: boolean,
30
30
  flip?: "horizontal" | "vertical" | "both" | "none",
31
- icon?: string | ReactSVGElement,
31
+ icon: string | ReactSVGElement,
32
32
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
33
33
  id?: string,
34
34
  inverse?: boolean,
@@ -469,6 +469,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
469
469
  <FormPill
470
470
  key={index}
471
471
  onClick={(event: any) => handlePillClose(event, item)}
472
+ size="small"
472
473
  text={item.label}
473
474
  />
474
475
  ))
@@ -481,6 +482,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
481
482
  <FormPill
482
483
  key={index}
483
484
  onClick={(event: any) => handlePillClose(event, item)}
485
+ size="small"
484
486
  text={item.label}
485
487
  />
486
488
  ))
@@ -3,45 +3,36 @@
3
3
  @import "../tokens/border_radius";
4
4
  @import "../tokens/shadows";
5
5
 
6
-
7
6
  $pagination_padding: 7px 13px 6px 13px;
8
7
  $top_bottom_radius: 0px;
9
8
 
10
- @mixin hover-state {
11
- background-color: $active_light !important;
12
- color: $primary;
13
- border-radius: $border_rad_light;
14
- }
15
-
16
9
  .pb_pagination {
17
10
  display: inline-block;
18
11
  border-radius: $border_rad_light;
19
12
  border: $border_rad_lightest solid $border_light;
20
13
  background-color: $white;
21
- padding: $space_xs 0px !important;
22
- li, .pagination-number {
14
+ padding: $space_xxs 0px !important;
15
+ li {
23
16
  display: inline;
24
- > a, li > span, .pagination-number {
17
+ > a, li > span {
25
18
  padding: $pagination_padding;
26
19
  text-decoration: none;
27
20
  }}
28
- li:first-child > a, li:first-child > span, .pagination-number, .pagination-left {
29
- background-color: $white;
21
+ li:first-child > a, li:first-child > span {
30
22
  padding: $pagination_padding;
31
23
  border-right: $border_rad_lightest solid $border_light;
32
24
  z-index: 2;
33
25
  border-top-right-radius: $top_bottom_radius;
34
26
  border-bottom-right-radius: $top_bottom_radius;
35
- cursor: pointer;
36
27
  }
37
- li:last-child > a, li:last-child > span, .pagination-number, .pagination-right {
28
+ li:last-child > a, li:last-child > span {
38
29
  padding: $pagination_padding;
39
30
  border-left: $border_rad_lightest solid $border_light;
40
31
  z-index: 2;
41
32
  border-top-left-radius: $top_bottom_radius;
42
33
  border-bottom-left-radius: $top_bottom_radius;
43
34
  }
44
- a, .pagination-number {
35
+ a {
45
36
  color: $text_lt_default;
46
37
  font-size: $text_small;
47
38
  font-weight: $regular;
@@ -49,7 +40,9 @@ $top_bottom_radius: 0px;
49
40
  transition: all $transition_default ease-out;
50
41
 
51
42
  &:hover {
52
- @include hover-state;
43
+ background-color: $active_light;
44
+ color: $primary;
45
+ border-radius: $border_rad_light;
53
46
  }
54
47
 
55
48
  &:focus-visible {
@@ -59,8 +52,8 @@ $top_bottom_radius: 0px;
59
52
  transition: none;
60
53
  }
61
54
  }
62
- .active > span, .pagination-number.active {
63
- background-color: $primary !important;
55
+ .active > span {
56
+ background-color: $primary;
64
57
  border-radius: $border_rad_light;
65
58
  color: #fff;
66
59
  padding: $pagination_padding;
@@ -69,37 +62,8 @@ $top_bottom_radius: 0px;
69
62
  font-weight: $bold;
70
63
  font-size: $text_small;
71
64
  }
72
- .disabled {
73
- pointer-events: none;
74
- opacity: 0.5;
75
- color: grey;
76
-
77
- & > span {
78
- padding: $pagination_padding;
79
- font-size: $text_small;
80
- }
81
- }
82
-
83
- .pagination-right,
84
- .pagination-left {
85
- background-color: $white;
86
- border-top: none;
87
- border-bottom: none;
88
- cursor: pointer;
89
- padding: 7px 11px 6px;
65
+ .disabled > span {
66
+ padding: $pagination_padding;
90
67
  font-size: $text_small;
91
-
92
- &:hover {
93
- @include hover-state;
94
- }
95
- }
96
- .pagination-left {
97
- border-left: none;
98
- margin-right: $space_xxs;
99
- }
100
-
101
- .pagination-right {
102
- border-right: none;
103
- margin-left: $space_xxs;
104
68
  }
105
69
  }
@@ -3,6 +3,4 @@ examples:
3
3
  rails:
4
4
  - pagination_default: Default
5
5
 
6
- react:
7
- - pagination_default: Default
8
- - pagination_page_change: Page Change
6
+
@@ -60,6 +60,7 @@ $flag-min-resolution: 192dpi;
60
60
  }
61
61
 
62
62
  .iti__flag {
63
+ background-image: url("https://intl-tel-input.com/intl-tel-input/img/flags.png");
63
64
  border-radius: 1px;
64
65
  }
65
66
 
@@ -196,4 +197,10 @@ $flag-min-resolution: 192dpi;
196
197
  }
197
198
  }
198
199
  }
200
+
201
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: $flag-min-resolution) {
202
+ .iti__flag {
203
+ background-image: url("https://intl-tel-input.com/intl-tel-input/img/flags.png");
204
+ }
205
+ }
199
206
  }
@@ -21,8 +21,6 @@ import classnames from "classnames";
21
21
  import { globalProps, GlobalProps } from "../utilities/globalProps";
22
22
  import { uniqueId } from 'lodash';
23
23
 
24
- type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth'>
25
-
26
24
  type PbPopoverProps = {
27
25
  aria?: { [key: string]: string };
28
26
  className?: string;
@@ -34,7 +32,7 @@ type PbPopoverProps = {
34
32
  reference: PopperReference & any;
35
33
  show?: boolean;
36
34
  shouldClosePopover?: (arg0: boolean) => void;
37
- } & ModifiedGlobalProps & Omit<PopperProps<any>, 'children'>
35
+ } & GlobalProps & Omit<PopperProps<any>, 'children'>
38
36
  & { children?: React.ReactChild[] | React.ReactChild }
39
37
 
40
38
  // Prop enabled default modifiers here
@@ -82,13 +80,10 @@ const Popover = (props: PbPopoverProps) => {
82
80
  targetId,
83
81
  } = props;
84
82
 
85
- const items = globalProps(props).split(' ')
86
- const filteredItems = items.filter(item => !item.includes('min_width'))
87
- const filteredGlobalProps = filteredItems.join(' ')
88
83
  const popoverSpacing =
89
- filteredGlobalProps.includes("dark") || !filteredGlobalProps
84
+ globalProps(props).includes("dark") || !globalProps(props)
90
85
  ? "p_sm"
91
- : filteredGlobalProps
86
+ : globalProps(props);
92
87
  const overflowHandling = maxHeight || maxWidth ? "overflow_handling" : "";
93
88
  const zIndexStyle = zIndex ? { zIndex: zIndex } : {};
94
89
  const widthHeightStyles = () => {
@@ -105,7 +100,7 @@ const Popover = (props: PbPopoverProps) => {
105
100
  const htmlProps = buildHtmlProps(htmlOptions);
106
101
  const classes = classnames(
107
102
  buildCss("pb_popover_kit"),
108
- filteredGlobalProps,
103
+ globalProps(props),
109
104
  className
110
105
  );
111
106
 
@@ -255,4 +250,4 @@ const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
255
250
  );
256
251
  };
257
252
 
258
- export default PbReactPopover;
253
+ export default PbReactPopover;
@@ -8,7 +8,7 @@
8
8
  display: inline-flex;
9
9
  cursor: pointer;
10
10
 
11
- .pb_radio_button{
11
+ .pb_radio_button {
12
12
  width: 22px;
13
13
  min-width: 22px;
14
14
  height: 22px;
@@ -18,7 +18,7 @@
18
18
  margin-right: $space_xs;
19
19
  transition: background $transition_default ease, box-shadow $transition_default ease, border-color $transition_default ease;
20
20
  }
21
-
21
+
22
22
  @media (hover:hover) {
23
23
  &:hover .pb_radio_button {
24
24
  background-color: $bg_light;
@@ -1,27 +1,28 @@
1
- import React, { forwardRef, isValidElement, useRef } from 'react'
1
+ /*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
2
+
3
+ import React, { forwardRef } from 'react'
2
4
  import Body from '../pb_body/_body'
3
- import Flex from '../pb_flex/_flex'
4
5
  import classnames from 'classnames'
5
6
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
6
7
  import { globalProps, GlobalProps } from '../utilities/globalProps'
7
8
 
8
9
  type RadioProps = {
9
- aria?: { [key: string]: string },
10
+ aria?: {[key: string]: string},
10
11
  alignment?: string,
11
12
  checked?: boolean,
12
13
  children?: React.ReactChild[] | React.ReactChild,
13
14
  className?: string,
14
15
  dark?: boolean,
15
- data?: { [key: string]: string },
16
+ data?: {[key: string]: string},
16
17
  disabled?: boolean,
17
18
  error?: boolean,
18
- htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
19
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
19
20
  id?: string,
20
21
  label: string,
21
22
  name?: string,
22
23
  value?: string,
23
24
  text?: string,
24
- onChange: (event: React.FormEvent<HTMLInputElement> | null) => void,
25
+ onChange: (event: React.FormEvent<HTMLInputElement> | null)=>void,
25
26
  } & GlobalProps
26
27
 
27
28
  const Radio = ({
@@ -30,9 +31,9 @@ const Radio = ({
30
31
  children,
31
32
  className,
32
33
  dark = false,
34
+ data = {},
33
35
  disabled = false,
34
36
  error = false,
35
- data = {},
36
37
  htmlOptions = {},
37
38
  id,
38
39
  label,
@@ -41,103 +42,52 @@ const Radio = ({
41
42
  value = 'radio_text',
42
43
  onChange = () => { void 0 },
43
44
  ...props
44
- }: RadioProps ) => {
45
- const radioRef = useRef(null);
46
-
47
- const ariaProps = buildAriaProps(aria);
48
- const dataProps = buildDataProps(data);
49
- const htmlProps = buildHtmlProps(htmlOptions);
45
+ }: RadioProps, ref: any) => {
46
+ const ariaProps = buildAriaProps(aria)
47
+ const dataProps = buildDataProps(data)
48
+ const htmlProps = buildHtmlProps(htmlOptions)
50
49
  const classes = classnames(
51
- buildCss('pb_radio_kit', alignment),
52
- dark ? 'dark' : null,
53
- error ? 'error' : null,
50
+ buildCss('pb_radio_kit', alignment ),
51
+ dark ? 'dark': null, error ? 'error': null,
54
52
  globalProps(props),
55
- className
56
- );
57
-
58
- const classesCustom = classnames(
59
- dark ? 'dark' : null,
60
- error ? 'error' : null,
61
- globalProps(props),
62
- className
63
- );
64
-
65
- const isCustomChild = children && isValidElement(children) && children.type !== 'input';
53
+ className)
66
54
 
67
55
  const displayRadio = (props: RadioProps & any) => {
68
- if (isValidElement(children) && children.type === 'input') {
69
- return React.cloneElement(children, { ...props, ref: radioRef });
70
- } else if (isCustomChild || !children) {
71
- return (
72
- <input
73
- disabled={disabled}
74
- id={id}
75
- name={name}
76
- onChange={onChange}
77
- ref={radioRef}
78
- text={text}
79
- type="radio"
80
- value={value}
81
- {...props}
82
- />
83
- );
84
- }
85
- };
86
-
87
- const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
88
- if (event) {
89
- const target = event.target as HTMLElement;
90
- if (
91
- target.id === 'children-wrapper' ||
92
- target.closest('#children-wrapper')
93
- ) {
94
- radioRef.current?.click();
95
- }
96
- }
97
- };
56
+ if (children)
57
+ return (children)
58
+ else
59
+ return (
60
+ <input
61
+ disabled={disabled}
62
+ id={id}
63
+ name={name}
64
+ onChange={onChange}
65
+ ref={ref}
66
+ text={text}
67
+ type="radio"
68
+ value={value}
69
+ {...props}
70
+ />
71
+ )}
98
72
 
99
73
  return (
100
- isCustomChild ? (
101
- <Flex
102
- {...ariaProps}
103
- {...dataProps}
104
- {...htmlProps}
105
- align='center'
106
- className={classesCustom}
107
- cursor='pointer'
108
- htmlFor={id}
109
- htmlOptions={{
110
- onClick: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
111
- handleContainerClick(event);
112
- }) as unknown as () => void
113
- }}
114
- id="radio-container"
115
- >
116
- <label className={buildCss('pb_radio_kit', alignment)}>
117
- <>{displayRadio(props)}</>
118
- <span className="pb_radio_button" />
119
- </label>
120
- <div id="children-wrapper"> {children} </div>
121
- </Flex>
122
- ) : (
123
- <label
124
- {...ariaProps}
125
- {...dataProps}
126
- {...htmlProps}
127
- className={classes}
128
- htmlFor={id}
129
- >
130
- <>{displayRadio(props)}</>
131
- <span className="pb_radio_button" />
132
- <Body
133
- dark={dark}
134
- status={error ? 'negative' : null}
135
- text={label}
136
- variant={null}
137
- />
138
- </label>
139
- )
140
- );
141
- };
74
+ <label
75
+ {...ariaProps}
76
+ {...dataProps}
77
+ {...htmlProps}
78
+ className={classes}
79
+ htmlFor={id}
80
+ >
81
+ <>{displayRadio(props)}</>
82
+ <span className="pb_radio_button" />
83
+ <Body
84
+ dark={dark}
85
+ status={error ? 'negative' : null}
86
+ text={label}
87
+ variant={null}
88
+ />
89
+ </label>
90
+ )
91
+ }
142
92
 
143
- export default forwardRef(Radio);
93
+ export default forwardRef(Radio)
@@ -14,7 +14,6 @@ examples:
14
14
  - radio_error: With Error
15
15
  - radio_alignment: Alignment
16
16
  - radio_disabled: Disabled
17
- - radio_children: Children
18
17
 
19
18
  swift:
20
19
  - radio_default_swift: Default
@@ -3,4 +3,3 @@ export { default as RadioCustom } from './_radio_custom.jsx'
3
3
  export { default as RadioError } from './_radio_error.jsx'
4
4
  export { default as RadioAlignment } from './_radio_alignment.jsx'
5
5
  export { default as RadioDisabled } from './_radio_disabled.jsx'
6
- export { default as RadioChildren } from './_radio_children.jsx'