playbook_ui 14.15.0.pre.alpha.play1917lodashremoval2of36615 → 14.15.0.pre.rc.0
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +3 -143
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +99 -45
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +7 -123
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +299 -153
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +1 -2
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -4
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -2
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +6 -5
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +0 -2
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +3 -43
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +3 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +37 -20
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +1 -20
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +6 -6
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +12 -20
- data/app/pb_kits/playbook/pb_drawer/drawer.rb +1 -49
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +4 -5
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -2
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +1 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +2 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +2 -9
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +0 -4
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -7
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.tsx +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +0 -7
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +3 -13
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -6
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +0 -13
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +1 -7
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +3 -5
- data/app/pb_kits/playbook/pb_overlay/overlay.rb +1 -16
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +0 -12
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +2 -2
- data/app/pb_kits/playbook/pb_popover/popover.test.js +1 -1
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +74 -85
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_radio/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_radio/radio.test.js +0 -16
- data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_select/select.html.erb +5 -3
- data/app/pb_kits/playbook/pb_select/select.rb +0 -8
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +5 -1
- data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +4 -1
- data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +5 -1
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +3 -2
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +2 -2
- data/app/pb_kits/playbook/pb_title/_title.scss +0 -32
- data/app/pb_kits/playbook/pb_title/_title.tsx +1 -10
- data/app/pb_kits/playbook/pb_title/docs/_title_default.html.erb +2 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_title/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_title/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_title/title.rb +1 -10
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +3 -0
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +0 -25
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.erb +10 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -4
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +1 -1
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -10
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +5 -51
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_typeahead/index.ts +8 -61
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +2 -17
- data/app/pb_kits/playbook/utilities/object.ts +1 -103
- data/app/pb_kits/playbook/utilities/text.ts +1 -1
- data/dist/chunks/_typeahead-PqkcDf1H.js +36 -0
- data/dist/chunks/_weekday_stacked-BrSrpj7J.js +45 -0
- data/dist/chunks/{lib-e7oBFFDo.js → lib-D3us1bGD.js} +2 -2
- data/dist/chunks/{pb_form_validation-CMXevI1t.js → pb_form_validation-BpihMSOQ.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -2
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +7 -61
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +0 -127
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +0 -55
- data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +0 -275
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +0 -66
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +0 -195
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +0 -73
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +0 -52
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +0 -50
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_infinite_scroll.json +0 -152002
- data/app/pb_kits/playbook/pb_date_picker/index.ts +0 -38
- data/app/pb_kits/playbook/pb_dialog/index.js +0 -75
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +0 -8
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +0 -33
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +0 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +0 -24
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +0 -21
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +0 -49
- data/app/pb_kits/playbook/pb_drawer/index.js +0 -257
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.html.erb +0 -40
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +0 -50
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.md +0 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +0 -72
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.jsx +0 -91
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.html.erb +0 -11
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.jsx +0 -37
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_rails.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_react.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb +0 -11
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/index.js +0 -61
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +0 -60
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.md +0 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +0 -58
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.md +0 -1
- data/app/pb_kits/playbook/pb_select/index.js +0 -38
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.html.erb +0 -7
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.jsx +0 -54
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.md +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb +0 -39
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md +0 -3
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon_rails.html.erb +0 -22
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb +0 -26
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +0 -69
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.md +0 -3
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.html.erb +0 -45
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.md +0 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.html.erb +0 -33
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.md +0 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +0 -66
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.md +0 -1
- data/app/pb_kits/playbook/utilities/object.test.js +0 -237
- data/dist/chunks/_typeahead-CdVbIURO.js +0 -36
- data/dist/chunks/_weekday_stacked-BSTKfYPJ.js +0 -45
@@ -69,17 +69,4 @@ $overlay_colors: (
|
|
69
69
|
pointer-events: none;
|
70
70
|
z-index: 1;
|
71
71
|
}
|
72
|
-
|
73
|
-
&.overlay-hide-scrollbar {
|
74
|
-
& [class*="overflow_x_auto"],
|
75
|
-
& [class*="overflow_y_auto"],
|
76
|
-
& [class*="overflow_auto"] {
|
77
|
-
&::-webkit-scrollbar {
|
78
|
-
display: none !important;
|
79
|
-
}
|
80
|
-
|
81
|
-
-ms-overflow-style: none !important;
|
82
|
-
scrollbar-width: none !important;
|
83
|
-
}
|
84
|
-
}
|
85
72
|
}
|
@@ -11,7 +11,6 @@ export type OverlayChildrenProps = {
|
|
11
11
|
dynamic?: boolean,
|
12
12
|
position: string,
|
13
13
|
size: string,
|
14
|
-
scrollBarNone?: boolean,
|
15
14
|
}
|
16
15
|
|
17
16
|
type OverlayProps = {
|
@@ -24,8 +23,6 @@ type OverlayProps = {
|
|
24
23
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
|
25
24
|
id?: string,
|
26
25
|
layout: { [key: string]: string },
|
27
|
-
scrollBarNone?: boolean,
|
28
|
-
|
29
26
|
}
|
30
27
|
|
31
28
|
const Overlay = (props: OverlayProps) => {
|
@@ -39,12 +36,11 @@ const Overlay = (props: OverlayProps) => {
|
|
39
36
|
htmlOptions = {},
|
40
37
|
id,
|
41
38
|
layout = { "bottom": "full" },
|
42
|
-
scrollBarNone = false,
|
43
39
|
} = props
|
44
40
|
|
45
41
|
const ariaProps = buildAriaProps(aria)
|
46
42
|
const dataProps = buildDataProps(data)
|
47
|
-
const classes = classnames(buildCss('pb_overlay'),
|
43
|
+
const classes = classnames(buildCss('pb_overlay'), globalProps(props), className)
|
48
44
|
const htmlProps = buildHtmlProps(htmlOptions)
|
49
45
|
const dynamicInlineProps = globalInlineProps(props)
|
50
46
|
|
@@ -72,14 +68,12 @@ const Overlay = (props: OverlayProps) => {
|
|
72
68
|
children,
|
73
69
|
color,
|
74
70
|
position: getPosition(),
|
75
|
-
scrollBarNone,
|
76
71
|
size: getSize()
|
77
72
|
}) : OverlayToken({
|
78
73
|
children,
|
79
74
|
color,
|
80
75
|
dynamic: dynamic,
|
81
76
|
position: getPosition(),
|
82
|
-
scrollBarNone,
|
83
77
|
size: getSize()
|
84
78
|
})
|
85
79
|
}
|
@@ -4,11 +4,8 @@ examples:
|
|
4
4
|
- overlay_multi_directional: Multi-directional
|
5
5
|
- overlay_vertical_dynamic_multi_directional: Vertical Dynamic Multi-directional
|
6
6
|
- overlay_toggle: Toggle
|
7
|
-
- overlay_hide_scroll_bar: Hide Scroll Bar
|
8
7
|
|
9
8
|
rails:
|
10
9
|
- overlay_default: Default
|
11
10
|
- overlay_multi_directional: Multi-directional
|
12
|
-
- overlay_vertical_dynamic_multi_directional: Vertical Dynamic Multi-directional
|
13
11
|
- overlay_toggle: Toggle
|
14
|
-
- overlay_hide_scroll_bar: Hide Scroll Bar
|
@@ -2,4 +2,3 @@ export { default as OverlayDefault } from './_overlay_default.jsx'
|
|
2
2
|
export { default as OverlayMultiDirectional } from './_overlay_multi_directional.jsx'
|
3
3
|
export { default as OverlayToggle } from './_overlay_toggle.jsx'
|
4
4
|
export { default as OverlayVerticalDynamicMultiDirectional } from './_overlay_vertical_dynamic_multi_directional.jsx'
|
5
|
-
export { default as OverlayHideScrollBar } from './_overlay_hide_scroll_bar.jsx'
|
@@ -16,14 +16,12 @@ id: object.id,
|
|
16
16
|
<% end %>
|
17
17
|
|
18
18
|
<% else %>
|
19
|
-
<div class="<%= previous_overlay_class_name %>"
|
19
|
+
<div class="<%= previous_overlay_class_name %>"></div>
|
20
20
|
|
21
|
-
|
22
|
-
<%= content.presence %>
|
23
|
-
</div>
|
21
|
+
<%= content.presence %>
|
24
22
|
|
25
23
|
<% if has_subsequent_overlay %>
|
26
|
-
<div class="<%= subsequent_overlay_class_name %>"
|
24
|
+
<div class="<%= subsequent_overlay_class_name %>"></div>
|
27
25
|
<% end %>
|
28
26
|
<% end %>
|
29
27
|
<% end %>
|
@@ -8,13 +8,9 @@ module Playbook
|
|
8
8
|
default: "card_light"
|
9
9
|
prop :layout, type: Playbook::Props::HashProp,
|
10
10
|
default: { "bottom": "full" }
|
11
|
-
prop :dynamic, type: Playbook::Props::Boolean,
|
12
|
-
default: false
|
13
|
-
prop :scroll_bar_none, type: Playbook::Props::Boolean,
|
14
|
-
default: false
|
15
11
|
|
16
12
|
def classname
|
17
|
-
generate_classname("pb_overlay"
|
13
|
+
generate_classname("pb_overlay")
|
18
14
|
end
|
19
15
|
|
20
16
|
def position
|
@@ -109,17 +105,6 @@ module Playbook
|
|
109
105
|
"bg_dark": "#0a0527",
|
110
106
|
}
|
111
107
|
end
|
112
|
-
|
113
|
-
def data_attributes
|
114
|
-
data ||= {}
|
115
|
-
data.merge!("data-pb-overlay" => true)
|
116
|
-
data.merge!("data-overlay-dynamic" => true) if dynamic
|
117
|
-
data
|
118
|
-
end
|
119
|
-
|
120
|
-
def hide_scroll_bar_class
|
121
|
-
scroll_bar_none ? " overlay-hide-scrollbar" : ""
|
122
|
-
end
|
123
108
|
end
|
124
109
|
end
|
125
110
|
end
|
@@ -64,15 +64,3 @@ test('should render children', () => {
|
|
64
64
|
const kit = screen.getByTestId(testId)
|
65
65
|
expect(kit).toHaveTextContent(props.children)
|
66
66
|
})
|
67
|
-
|
68
|
-
test('should add overlay-hide-scrollbar class when scrollBarNone is true', () => {
|
69
|
-
const props = {
|
70
|
-
children,
|
71
|
-
data: { testid: testId },
|
72
|
-
scrollBarNone: true
|
73
|
-
}
|
74
|
-
|
75
|
-
render(<Overlay {...props} />)
|
76
|
-
const kit = screen.getByTestId(testId)
|
77
|
-
expect(kit).toHaveClass('overlay-hide-scrollbar')
|
78
|
-
})
|
@@ -19,7 +19,7 @@ import {
|
|
19
19
|
|
20
20
|
import classnames from "classnames";
|
21
21
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
22
|
-
import { uniqueId } from '
|
22
|
+
import { uniqueId } from 'lodash';
|
23
23
|
|
24
24
|
type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth' | 'maxHeight' | 'minHeight'>
|
25
25
|
|
@@ -84,7 +84,7 @@ const Popover = (props: PbPopoverProps) => {
|
|
84
84
|
} = props;
|
85
85
|
|
86
86
|
const items = globalProps(props).split(' ')
|
87
|
-
const filteredItems = items.filter(item => !item.includes('
|
87
|
+
const filteredItems = items.filter(item => !item.includes('min_width'))
|
88
88
|
const filteredGlobalProps = filteredItems.join(' ')
|
89
89
|
const popoverSpacing =
|
90
90
|
filteredGlobalProps.includes("dark") || !filteredGlobalProps
|
@@ -181,7 +181,7 @@ const PopoverTestClicktoClose3 = () => {
|
|
181
181
|
const btn = screen.getByText(/click me/i)
|
182
182
|
fireEvent.click(btn);
|
183
183
|
const kit = screen.getByText("Click Anywhere");
|
184
|
-
expect(kit).toHaveClass("pb_popover_body
|
184
|
+
expect(kit).toHaveClass("pb_popover_body max_width_240px overflow_handling");
|
185
185
|
});
|
186
186
|
|
187
187
|
test("closes Popover on click anywhere", async () => {
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
/*eslint-disable react/no-multi-comp */
|
2
|
+
|
3
|
+
import React, { forwardRef, useRef } from 'react'
|
2
4
|
import Body from '../pb_body/_body'
|
3
5
|
import Flex from '../pb_flex/_flex'
|
4
6
|
import classnames from 'classnames'
|
@@ -8,7 +10,7 @@ import { globalProps, GlobalProps } from '../utilities/globalProps'
|
|
8
10
|
type RadioProps = {
|
9
11
|
aria?: { [key: string]: string },
|
10
12
|
alignment?: string,
|
11
|
-
checked?: boolean,
|
13
|
+
checked?: boolean,
|
12
14
|
children?: React.ReactChild[] | React.ReactChild,
|
13
15
|
customChildren?: boolean,
|
14
16
|
className?: string,
|
@@ -22,10 +24,10 @@ type RadioProps = {
|
|
22
24
|
name?: string,
|
23
25
|
value?: string,
|
24
26
|
text?: string,
|
25
|
-
onChange
|
27
|
+
onChange: (event: React.FormEvent<HTMLInputElement> | null) => void,
|
26
28
|
} & GlobalProps
|
27
29
|
|
28
|
-
const Radio =
|
30
|
+
const Radio = ({
|
29
31
|
aria = {},
|
30
32
|
alignment,
|
31
33
|
children,
|
@@ -41,123 +43,110 @@ const Radio = forwardRef<HTMLInputElement, RadioProps>(({
|
|
41
43
|
name = 'radio_name',
|
42
44
|
text = 'Radio Text',
|
43
45
|
value = 'radio_text',
|
44
|
-
checked,
|
45
46
|
onChange = () => { void 0 },
|
46
47
|
...props
|
47
|
-
}, ref) => {
|
48
|
-
const
|
49
|
-
const setRefs = (el: HTMLInputElement) => {
|
50
|
-
internalRef.current = el
|
51
|
-
if (typeof ref === 'function') {
|
52
|
-
ref(el)
|
53
|
-
} else if (ref) {
|
54
|
-
(ref as React.MutableRefObject<HTMLInputElement | null>).current = el
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
const ariaProps = buildAriaProps(aria)
|
59
|
-
const dataProps = buildDataProps(data)
|
60
|
-
const htmlProps = buildHtmlProps(htmlOptions)
|
48
|
+
}: RadioProps, ref: any) => {
|
49
|
+
const radioRef = useRef(null);
|
61
50
|
|
51
|
+
const ariaProps = buildAriaProps(aria);
|
52
|
+
const dataProps = buildDataProps(data);
|
53
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
62
54
|
const classes = classnames(
|
63
55
|
buildCss('pb_radio_kit', alignment),
|
64
56
|
dark ? 'dark' : null,
|
65
57
|
error ? 'error' : null,
|
66
58
|
globalProps(props),
|
67
59
|
className
|
68
|
-
)
|
60
|
+
);
|
69
61
|
|
70
62
|
const classesCustom = classnames(
|
71
63
|
dark ? 'dark' : null,
|
72
64
|
error ? 'error' : null,
|
73
65
|
globalProps(props),
|
74
66
|
className
|
75
|
-
)
|
76
|
-
|
77
|
-
const checkedProps = checked !== undefined ? { checked } : {}
|
67
|
+
);
|
78
68
|
|
79
|
-
const displayRadio = (
|
80
|
-
if (children && customChildren
|
81
|
-
return children
|
69
|
+
const displayRadio = (props: RadioProps & any) => {
|
70
|
+
if (children && customChildren == false)
|
71
|
+
return (children)
|
82
72
|
else
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
}
|
73
|
+
return (
|
74
|
+
<input
|
75
|
+
disabled={disabled}
|
76
|
+
id={id}
|
77
|
+
name={name}
|
78
|
+
onChange={onChange}
|
79
|
+
ref={ref}
|
80
|
+
text={text}
|
81
|
+
type="radio"
|
82
|
+
value={value}
|
83
|
+
{...props}
|
84
|
+
/>
|
85
|
+
)}
|
97
86
|
|
98
87
|
const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
|
99
88
|
if (event) {
|
100
|
-
const target = event.target as HTMLElement
|
89
|
+
const target = event.target as HTMLElement;
|
101
90
|
if (
|
102
91
|
target.id === 'pb-radio-children-wrapper' ||
|
103
92
|
target.closest('#pb-radio-children-wrapper')
|
104
93
|
) {
|
105
|
-
|
94
|
+
radioRef.current?.click();
|
106
95
|
}
|
107
96
|
}
|
108
|
-
}
|
97
|
+
};
|
109
98
|
|
110
|
-
return
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
99
|
+
return (
|
100
|
+
customChildren ? (
|
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)}>
|
127
117
|
<input
|
128
|
-
{...checkedProps}
|
129
118
|
disabled={disabled}
|
130
119
|
id={id}
|
131
120
|
name={name}
|
132
121
|
onChange={onChange}
|
133
|
-
ref={
|
122
|
+
ref={radioRef}
|
134
123
|
type="radio"
|
135
124
|
value={value}
|
136
125
|
{...props}
|
137
126
|
/>
|
127
|
+
<span className="pb_radio_button" />
|
128
|
+
</label>
|
129
|
+
<div id="pb-radio-children-wrapper"> {children} </div>
|
130
|
+
</Flex>
|
131
|
+
) : (
|
132
|
+
<label
|
133
|
+
{...ariaProps}
|
134
|
+
{...dataProps}
|
135
|
+
{...htmlProps}
|
136
|
+
className={classes}
|
137
|
+
htmlFor={id}
|
138
|
+
>
|
139
|
+
<>{displayRadio(props)}</>
|
138
140
|
<span className="pb_radio_button" />
|
141
|
+
<Body
|
142
|
+
dark={dark}
|
143
|
+
status={error ? 'negative' : null}
|
144
|
+
text={label}
|
145
|
+
variant={null}
|
146
|
+
/>
|
139
147
|
</label>
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
<label
|
144
|
-
{...ariaProps}
|
145
|
-
{...dataProps}
|
146
|
-
{...htmlProps}
|
147
|
-
className={classes}
|
148
|
-
htmlFor={id}
|
149
|
-
>
|
150
|
-
{displayRadio(props)}
|
151
|
-
<span className="pb_radio_button" />
|
152
|
-
<Body
|
153
|
-
dark={dark}
|
154
|
-
status={error ? 'negative' : null}
|
155
|
-
text={label}
|
156
|
-
variant={null}
|
157
|
-
/>
|
158
|
-
</label>
|
159
|
-
)
|
160
|
-
})
|
148
|
+
)
|
149
|
+
);
|
150
|
+
};
|
161
151
|
|
162
|
-
|
163
|
-
export default Radio
|
152
|
+
export default forwardRef(Radio);
|
@@ -16,7 +16,6 @@ examples:
|
|
16
16
|
- radio_alignment: Alignment
|
17
17
|
- radio_disabled: Disabled
|
18
18
|
- radio_custom_children: Custom Children
|
19
|
-
- radio_react_hook: React Hook Form
|
20
19
|
|
21
20
|
swift:
|
22
21
|
- radio_default_swift: Default
|
@@ -27,4 +26,4 @@ examples:
|
|
27
26
|
- radio_spacing_swift: Spacing
|
28
27
|
- radio_padding_swift: Padding
|
29
28
|
- radio_subtitle_swift: Subtitle
|
30
|
-
- radio_props_swift: ""
|
29
|
+
- radio_props_swift: ""
|
@@ -4,4 +4,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
6
|
export { default as RadioCustomChildren } from './_radio_custom_children.jsx'
|
7
|
-
export { default as RadioReactHook } from './_radio_react_hook.jsx'
|
@@ -86,19 +86,3 @@ test('has disabled attribute', () => {
|
|
86
86
|
expect(input).toHaveAttribute('disabled')
|
87
87
|
})
|
88
88
|
|
89
|
-
|
90
|
-
test('has ref in the input element', () => {
|
91
|
-
const ref = React.createRef()
|
92
|
-
render(
|
93
|
-
<Radio
|
94
|
-
data={{ testid: testId }}
|
95
|
-
name="Radio-name"
|
96
|
-
ref={ref}
|
97
|
-
text="Radio"
|
98
|
-
value="radio value"
|
99
|
-
/>
|
100
|
-
)
|
101
|
-
|
102
|
-
expect(ref.current).not.toBeNull()
|
103
|
-
expect(ref.current?.tagName).toBe('INPUT')
|
104
|
-
})
|
@@ -10,4 +10,3 @@ export { default as SelectInline } from './_select_inline.jsx'
|
|
10
10
|
export { default as SelectInlineShowArrow } from './_select_inline_show_arrow.jsx'
|
11
11
|
export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
|
12
12
|
export { default as SelectMultiple } from './_select_multiple.jsx'
|
13
|
-
export { default as SelectReactHook } from './_select_react_hook.jsx'
|
@@ -1,6 +1,8 @@
|
|
1
|
-
<%=
|
2
|
-
|
3
|
-
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classnames,
|
5
|
+
**combined_html_options) do %>
|
4
6
|
<% if object.label %>
|
5
7
|
<label class="pb_select_kit_label" for="<%= object.name %>">
|
6
8
|
<%= pb_rails("caption", props: { text: object.label, dark: object.dark }) %>
|
@@ -21,7 +21,6 @@ module Playbook
|
|
21
21
|
prop :options, type: Playbook::Props::HashArray, required: false, default: []
|
22
22
|
prop :show_arrow, type: Playbook::Props::Boolean, default: false
|
23
23
|
prop :required, type: Playbook::Props::Boolean, default: false
|
24
|
-
prop :validation_message, type: Playbook::Props::String, default: ""
|
25
24
|
|
26
25
|
def classnames
|
27
26
|
classname + inline_class + compact_class + show_arrow_class
|
@@ -89,13 +88,6 @@ module Playbook
|
|
89
88
|
"app/pb_kits/playbook/utilities/icons/angle-down.svg"
|
90
89
|
end
|
91
90
|
|
92
|
-
def data_attributes
|
93
|
-
data = attributes[:data] || {}
|
94
|
-
data.merge!("data-pb-select" => true)
|
95
|
-
data.merge!("data-validation-message" => validation_message) if validation_message.present?
|
96
|
-
data
|
97
|
-
end
|
98
|
-
|
99
91
|
private
|
100
92
|
|
101
93
|
def error_class
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname,
|
5
|
+
**combined_html_options) do %>
|
2
6
|
|
3
7
|
<% if object.multi %>
|
4
8
|
<%= check_box_tag(object.name, object.value, object.checked, object.additional_input_options) %>
|
@@ -17,7 +17,7 @@ const formatCurrencyDefaultValue = (value: string): string => {
|
|
17
17
|
|
18
18
|
// Parse the numeric value as a float to handle decimals
|
19
19
|
const dollars = parseFloat(numericValue)
|
20
|
-
if (isNaN(dollars)) return ''
|
20
|
+
if (isNaN(dollars) || dollars === 0) return ''
|
21
21
|
|
22
22
|
// Format as currency
|
23
23
|
return new Intl.NumberFormat('en-US', {
|
@@ -30,9 +30,10 @@ const formatCurrencyDefaultValue = (value: string): string => {
|
|
30
30
|
const formatCurrency = (value: string): string => {
|
31
31
|
const numericValue = value.replace(/[^0-9]/g, '').slice(0, 15)
|
32
32
|
|
33
|
-
if (!numericValue
|
33
|
+
if (!numericValue) return ''
|
34
34
|
|
35
35
|
const dollars = parseFloat((parseInt(numericValue) / 100).toFixed(2))
|
36
|
+
if (dollars === 0) return ''
|
36
37
|
|
37
38
|
return new Intl.NumberFormat('en-US', {
|
38
39
|
style: 'currency',
|
@@ -243,7 +243,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
243
243
|
}
|
244
244
|
[class=pb_timeline_item_left_block] {
|
245
245
|
margin-bottom: $space_lg;
|
246
|
-
|
246
|
+
width: $space_lg;
|
247
247
|
}
|
248
248
|
[class=pb_timeline_item_right_block] {
|
249
249
|
@include flex_wrapper(column);
|
@@ -263,7 +263,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
263
263
|
}
|
264
264
|
[class=pb_timeline_item_left_block] {
|
265
265
|
margin-bottom: $space_lg;
|
266
|
-
|
266
|
+
width: $space_lg;
|
267
267
|
}
|
268
268
|
[class=pb_timeline_item_right_block] {
|
269
269
|
@include flex_wrapper(column);
|
@@ -31,38 +31,6 @@
|
|
31
31
|
@include pb_title_thin;
|
32
32
|
}
|
33
33
|
|
34
|
-
&[class*=_display] {
|
35
|
-
font-size: clamp(24px, calc(1.25vw + 5.3vw), 128px);
|
36
|
-
}
|
37
|
-
|
38
|
-
&[class*=_dynamic] {
|
39
|
-
&[class*=_xs] {
|
40
|
-
font-size: min(2vw, 80vw / 16);
|
41
|
-
}
|
42
|
-
|
43
|
-
&[class*=_sm] {
|
44
|
-
font-size: min(2.5vw, 96vw / 16);
|
45
|
-
}
|
46
|
-
|
47
|
-
&[class*=_md] {
|
48
|
-
font-size: min(4vw, 160vw / 16);
|
49
|
-
}
|
50
|
-
|
51
|
-
&[class*=_lg] {
|
52
|
-
font-size: min(5vw, 192vw / 16);
|
53
|
-
}
|
54
|
-
|
55
|
-
&[class*=_xl] {
|
56
|
-
font-size: min(6vw, 224vw / 16);
|
57
|
-
}
|
58
|
-
|
59
|
-
&[class*=_xxl] {
|
60
|
-
font-size: min(8vw, 256vw / 16);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
|
65
|
-
|
66
34
|
@each $size, $size_value in $breakpoints_grid {
|
67
35
|
@for $title_size_value from 1 through 4 {
|
68
36
|
$min_size: map-get($size_value, "min");
|
@@ -3,7 +3,7 @@ import classnames from 'classnames'
|
|
3
3
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
4
4
|
import { deprecatedProps, GlobalProps, globalProps } from '../utilities/globalProps'
|
5
5
|
|
6
|
-
type SizeType = 1 | 2 | 3 | 4 | "1" | "2" | "3" | "4"
|
6
|
+
type SizeType = 1 | 2 | 3 | 4 | "1" | "2" | "3" | "4"
|
7
7
|
type SizeResponsiveType = {[key: string]: SizeType}
|
8
8
|
|
9
9
|
type TitleProps = {
|
@@ -16,7 +16,6 @@ type TitleProps = {
|
|
16
16
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
17
17
|
id?: string,
|
18
18
|
size?: SizeType | SizeResponsiveType,
|
19
|
-
displaySize?: null | "xs" | "sm" | "md" | "lg" | "xl" | "xxl",
|
20
19
|
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span",
|
21
20
|
text?: string,
|
22
21
|
variant?: null | "link",
|
@@ -33,7 +32,6 @@ const Title = (props: TitleProps): React.ReactElement => {
|
|
33
32
|
htmlOptions = {},
|
34
33
|
id,
|
35
34
|
size = 3,
|
36
|
-
displaySize = null,
|
37
35
|
bold = true,
|
38
36
|
tag = 'h3',
|
39
37
|
text,
|
@@ -58,16 +56,9 @@ const Title = (props: TitleProps): React.ReactElement => {
|
|
58
56
|
return css.trim()
|
59
57
|
}
|
60
58
|
|
61
|
-
const buildDisplaySize = () => {
|
62
|
-
if (displaySize) {
|
63
|
-
return `pb_title_kit_dynamic_${displaySize}`
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
59
|
const classes = classnames(
|
68
60
|
buildCss('pb_title_kit', isSizeNumberOrString ? `size_${size}` : "", variant, color, getBold),
|
69
61
|
globalProps(props),
|
70
|
-
buildDisplaySize(),
|
71
62
|
buildResponsiveSizeCss(),
|
72
63
|
className
|
73
64
|
)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
<%= pb_rails("title", props: {
|
2
|
-
margin_bottom: "md"
|
3
2
|
}) do %>
|
4
3
|
Default Title
|
5
4
|
<% end %>
|
6
5
|
|
6
|
+
<br/>
|
7
|
+
|
7
8
|
<%= pb_rails("title", props: { text: "Title 1", tag: "h1", size: 1 }) %>
|
8
9
|
<%= pb_rails("title", props: { text: "Title 2", tag: "h2", size: 2 }) %>
|
9
10
|
<%= pb_rails("title", props: { text: "Title 3", tag: "h3", size: 3 }) %>
|