playbook_ui 15.0.0.pre.alpha.PLAY2420atfirstcolumnborderfix10658 → 15.0.0.pre.alpha.PLAY2422fixedconftoastaccessibility10327
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/_playbook.scss +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +11 -12
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +7 -7
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +2 -7
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +7 -51
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +2 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +9 -12
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_card/_card.scss +4 -12
- data/app/pb_kits/playbook/pb_card/_card.tsx +3 -3
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +0 -10
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.html.erb +0 -3
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.jsx +0 -8
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +0 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +0 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +0 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +4 -6
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +4 -48
- data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +8 -6
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +65 -0
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +0 -1
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +2 -13
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -9
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +0 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -2
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.html.erb +1 -1
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -3
- data/app/pb_kits/playbook/pb_loading_inline/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_loading_inline/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +1 -1
- data/app/pb_kits/playbook/pb_loading_inline/loading_inline.rb +0 -11
- data/app/pb_kits/playbook/pb_nav/_item.tsx +5 -19
- data/app/pb_kits/playbook/pb_nav/item.html.erb +2 -6
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +0 -3
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +3 -2
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +0 -38
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +8 -24
- data/app/pb_kits/playbook/pb_timestamp/docs/_time_stamp_default.md +1 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.html.erb +10 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.jsx +9 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.html.erb +17 -3
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.jsx +15 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.html.erb +2 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.jsx +2 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.html.erb +14 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.jsx +14 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.html.erb +4 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_unstyled.jsx +4 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.jsx +1 -0
- data/app/pb_kits/playbook/pb_timestamp/docs/example.yml +6 -18
- data/app/pb_kits/playbook/pb_timestamp/docs/index.js +0 -6
- data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +7 -29
- data/app/pb_kits/playbook/pb_timestamp/timestamp.test.js +4 -69
- data/dist/chunks/{_line_graph-CUfJ7E4h.js → _line_graph-CApw7aQD.js} +1 -1
- data/dist/chunks/_typeahead-J1_avqdO.js +6 -0
- data/dist/chunks/_weekday_stacked-DMSGdE48.js +37 -0
- data/dist/chunks/{lib-BTs5acfO.js → lib-CY5ZPzic.js} +1 -1
- data/dist/chunks/{pb_form_validation-CKkaQFX3.js → pb_form_validation-D3b0JKHH.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +1 -15
- data/dist/playbook-doc.js +2 -2
- 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/forms/builder/form_field_builder.rb +2 -37
- data/lib/playbook/version.rb +1 -1
- metadata +9 -100
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.html.erb +0 -5
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.jsx +0 -24
- data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.scss +0 -0
- data/app/pb_kits/playbook/pb_pb_bar_graph/_pb_bar_graph.tsx +0 -62
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.html.erb +0 -35
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.jsx +0 -49
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors_rails.md +0 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors_react.md +0 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.html.erb +0 -38
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.jsx +0 -51
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.html.erb +0 -46
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.jsx +0 -62
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.md +0 -3
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.html.erb +0 -47
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.jsx +0 -60
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.html.erb +0 -25
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.jsx +0 -36
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_non_clickable.jsx +0 -44
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.html.erb +0 -100
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.jsx +0 -126
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.html.erb +0 -32
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.jsx +0 -48
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.html.erb +0 -68
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.jsx +0 -81
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.html.erb +0 -31
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.jsx +0 -42
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.md +0 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.html.erb +0 -35
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.jsx +0 -51
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/example.yml +0 -27
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/index.js +0 -11
- data/app/pb_kits/playbook/pb_pb_bar_graph/pbBarGraphTheme.ts +0 -106
- data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.html.erb +0 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/pb_bar_graph.rb +0 -28
- data/app/pb_kits/playbook/pb_pb_bar_graph/pbbargraph.test.jsx +0 -31
- data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.scss +0 -3
- data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.tsx +0 -62
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.html.erb +0 -31
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.jsx +0 -81
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.html.erb +0 -25
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.jsx +0 -40
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.md +0 -5
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.html.erb +0 -27
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.jsx +0 -39
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.md +0 -5
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.html.erb +0 -93
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.jsx +0 -131
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.md +0 -14
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.html.erb +0 -42
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.jsx +0 -58
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.html.erb +0 -24
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.jsx +0 -38
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.html.erb +0 -22
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +0 -33
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.html.erb +0 -118
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.jsx +0 -144
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_live_data.jsx +0 -60
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.html.erb +0 -24
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.jsx +0 -42
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.html.erb +0 -38
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.jsx +0 -52
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/example.yml +0 -29
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/index.js +0 -11
- data/app/pb_kits/playbook/pb_pb_circle_chart/pbCircleChartTheme.ts +0 -88
- data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.html.erb +0 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.rb +0 -28
- data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.test.jsx +0 -51
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_autocomplete.html.erb +0 -41
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_autocomplete.jsx +0 -80
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_autocomplete.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.md +0 -5
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_current_year.html.erb +0 -12
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_current_year.jsx +0 -25
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_date.html.erb +0 -4
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_date.jsx +0 -17
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_date.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_time.html.erb +0 -18
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_time.jsx +0 -44
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_show_time.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.md +0 -5
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_current_year.html.erb +0 -16
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_current_year.jsx +0 -30
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_date.html.erb +0 -16
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_date.jsx +0 -30
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_date.md +0 -1
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_time.html.erb +0 -26
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_time.jsx +0 -41
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_show_time.md +0 -1
- data/dist/chunks/_typeahead-DCp1lVJx.js +0 -6
- data/dist/chunks/_weekday_stacked-DlGphUxE.js +0 -37
@@ -0,0 +1,65 @@
|
|
1
|
+
// Three places in Nitro depend on this function inside the window scope.
|
2
|
+
// We will keep this file until we remove this dependency from Nitro.
|
3
|
+
const dialogHelper = () => {
|
4
|
+
const openTrigger = document.querySelectorAll("[data-open-dialog]");
|
5
|
+
const closeTrigger = document.querySelectorAll("[data-close-dialog]");
|
6
|
+
const dialogs = document.querySelectorAll(".pb_dialog_rails")
|
7
|
+
|
8
|
+
const loadingButton = document.querySelector('[data-disable-with="Loading"]');
|
9
|
+
if (loadingButton) {
|
10
|
+
loadingButton.addEventListener("click", function() {
|
11
|
+
const okayLoadingButton = document.querySelector('[data-disable-with="Loading"]');
|
12
|
+
const cancelButton = document.querySelector('[data-disable-cancel-with="Loading"]');
|
13
|
+
let currentClass = okayLoadingButton.className;
|
14
|
+
let cancelClass = cancelButton ? cancelButton.className : "";
|
15
|
+
|
16
|
+
let newClass = currentClass.replace("_enabled", "_disabled_loading");
|
17
|
+
let newCancelClass = cancelClass.replace("_enabled", "_disabled");
|
18
|
+
|
19
|
+
// Disable the buttons
|
20
|
+
okayLoadingButton.disabled = true;
|
21
|
+
if (cancelButton) cancelButton.disabled = true;
|
22
|
+
|
23
|
+
okayLoadingButton.className = newClass;
|
24
|
+
if (cancelButton) cancelButton.className = newCancelClass;
|
25
|
+
});
|
26
|
+
}
|
27
|
+
|
28
|
+
|
29
|
+
openTrigger.forEach((open) => {
|
30
|
+
open.addEventListener("click", () => {
|
31
|
+
var openTriggerData = open.dataset.openDialog;
|
32
|
+
var targetDialog = document.getElementById(openTriggerData)
|
33
|
+
if (targetDialog.open) return;
|
34
|
+
targetDialog.showModal();
|
35
|
+
});
|
36
|
+
});
|
37
|
+
|
38
|
+
closeTrigger.forEach((close) => {
|
39
|
+
close.addEventListener("click", () => {
|
40
|
+
var closeTriggerData = close.dataset.closeDialog;
|
41
|
+
document.getElementById(closeTriggerData).close();
|
42
|
+
});
|
43
|
+
});
|
44
|
+
|
45
|
+
// Close dialog box on outside click
|
46
|
+
dialogs.forEach((dialogElement) => {
|
47
|
+
dialogElement.addEventListener("mousedown", (event) => {
|
48
|
+
const dialogParentDataset = dialogElement.parentElement.dataset
|
49
|
+
if (dialogParentDataset.overlayClick === "overlay_close") return
|
50
|
+
|
51
|
+
const dialogModal = event.target.getBoundingClientRect()
|
52
|
+
const clickedOutsideDialogModal = event.clientX < dialogModal.left ||
|
53
|
+
event.clientX > dialogModal.right ||
|
54
|
+
event.clientY < dialogModal.top ||
|
55
|
+
event.clientY > dialogModal.bottom
|
56
|
+
|
57
|
+
if (clickedOutsideDialogModal) {
|
58
|
+
dialogElement.close()
|
59
|
+
event.stopPropagation()
|
60
|
+
}
|
61
|
+
})
|
62
|
+
})
|
63
|
+
};
|
64
|
+
|
65
|
+
export default dialogHelper;
|
@@ -2,8 +2,8 @@
|
|
2
2
|
<%= pb_rails("flex", props: {classname:object.classname, spacing:"between", padding:"sm", align:"center"}) do %>
|
3
3
|
<%= content.presence || object.title %>
|
4
4
|
|
5
|
-
<button class="dialog-button-class pb_dialog_close_icon" type="button" data-close-dialog= <%= object.id %>
|
6
|
-
<%= pb_rails("icon", props: { custom_icon: Playbook::Engine::root.join(times_icon)
|
5
|
+
<button class="dialog-button-class pb_dialog_close_icon" type="button" data-close-dialog= <%= object.id %> >
|
6
|
+
<%= pb_rails("icon", props: { custom_icon: Playbook::Engine::root.join(times_icon) }) %>
|
7
7
|
</button>
|
8
8
|
<% end %>
|
9
9
|
<%= pb_rails("section_separator") %>
|
@@ -91,7 +91,6 @@
|
|
91
91
|
<%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
|
92
92
|
<%= form.typeahead :example_typeahead, props: { data: { typeahead_example1: true, user: {} }, label: true, placeholder: "Search for a user" } %>
|
93
93
|
<%= form.text_field :example_text_field, props: { label: true } %>
|
94
|
-
<%= form.text_field :example_text_field_2, props: { label: "Text Field Custom Label" } %>
|
95
94
|
<%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field", hidden_inputs: true } %>
|
96
95
|
<%= form.email_field :example_email_field, props: { label: true } %>
|
97
96
|
<%= form.number_field :example_number_field, props: { label: true } %>
|
@@ -20,7 +20,7 @@ export type IconSizes = "lg"
|
|
20
20
|
| ""
|
21
21
|
|
22
22
|
type IconProps = {
|
23
|
-
aria?: {
|
23
|
+
aria?: {[key: string]: string},
|
24
24
|
border?: string,
|
25
25
|
className?: string,
|
26
26
|
color?: string,
|
@@ -211,15 +211,7 @@ const Icon = (props: IconProps) => {
|
|
211
211
|
)
|
212
212
|
|
213
213
|
aria.label ? null : aria.label = `${icon} icon`
|
214
|
-
|
215
|
-
const normalizedAria: { [key: string]: string } = Object.fromEntries(
|
216
|
-
Object.entries(aria).map(([key, value]) => [
|
217
|
-
key,
|
218
|
-
typeof value === "boolean" ? String(value) : value,
|
219
|
-
])
|
220
|
-
)
|
221
|
-
|
222
|
-
const ariaProps = buildAriaProps(normalizedAria)
|
214
|
+
const ariaProps: {[key: string]: any} = buildAriaProps(aria)
|
223
215
|
const dataProps: {[key: string]: any} = buildDataProps(data)
|
224
216
|
const htmlProps = buildHtmlProps(htmlOptions)
|
225
217
|
|
@@ -230,7 +222,6 @@ const Icon = (props: IconProps) => {
|
|
230
222
|
<>
|
231
223
|
{
|
232
224
|
React.cloneElement(iconElement || customIcon, {
|
233
|
-
...ariaProps,
|
234
225
|
...dataProps,
|
235
226
|
...htmlProps,
|
236
227
|
className: classes,
|
@@ -246,7 +237,6 @@ const Icon = (props: IconProps) => {
|
|
246
237
|
return (
|
247
238
|
<>
|
248
239
|
<span
|
249
|
-
{...ariaProps}
|
250
240
|
{...dataProps}
|
251
241
|
{...htmlProps}
|
252
242
|
className={classesEmoji}
|
@@ -260,7 +250,6 @@ const Icon = (props: IconProps) => {
|
|
260
250
|
return (
|
261
251
|
<>
|
262
252
|
<i
|
263
|
-
{...ariaProps}
|
264
253
|
{...dataProps}
|
265
254
|
{...htmlProps}
|
266
255
|
className={classes}
|
@@ -110,20 +110,12 @@ module Playbook
|
|
110
110
|
svg["class"] = %w[pb_custom_icon svg-inline--fa].concat([object.custom_icon_classname]).join(" ")
|
111
111
|
svg["id"] = object.id
|
112
112
|
svg["data"] = object.data
|
113
|
+
svg["aria"] = object.aria
|
113
114
|
svg["height"] = "auto"
|
114
115
|
svg["width"] = "auto"
|
115
116
|
svg["tabindex"] = object.tabindex
|
116
117
|
fill_color = object.color || "currentColor"
|
117
118
|
doc.at_css("path")["fill"] = fill_color
|
118
|
-
|
119
|
-
if object.aria.present?
|
120
|
-
object.aria.each do |key, value|
|
121
|
-
k = key.to_s
|
122
|
-
attr = k.start_with?("aria-") ? k : "aria-#{k.tr('_', '-')}"
|
123
|
-
svg[attr] = value
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
119
|
raw doc
|
128
120
|
rescue OpenURI::HTTPError, StandardError
|
129
121
|
# Handle any exceptions and return an empty string
|
@@ -16,7 +16,6 @@ type LoadingInlineProps = {
|
|
16
16
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
17
17
|
id?: string,
|
18
18
|
text?: string,
|
19
|
-
variant?: "dotted" | "solid" ,
|
20
19
|
}
|
21
20
|
|
22
21
|
const LoadingInline = (props: LoadingInlineProps) => {
|
@@ -29,7 +28,6 @@ const LoadingInline = (props: LoadingInlineProps) => {
|
|
29
28
|
htmlOptions = {},
|
30
29
|
id,
|
31
30
|
text = ' Loading',
|
32
|
-
variant = 'dotted',
|
33
31
|
} = props
|
34
32
|
|
35
33
|
const ariaProps = buildAriaProps(aria)
|
@@ -56,7 +54,7 @@ const LoadingInline = (props: LoadingInlineProps) => {
|
|
56
54
|
<Icon
|
57
55
|
aria={{ label: 'loading icon' }}
|
58
56
|
fixedWidth
|
59
|
-
icon=
|
57
|
+
icon="spinner"
|
60
58
|
pulse
|
61
59
|
/>
|
62
60
|
{text}
|
@@ -3,11 +3,9 @@ examples:
|
|
3
3
|
rails:
|
4
4
|
- loading_inline_default: Default
|
5
5
|
- loading_inline_custom: Custom Text
|
6
|
-
- loading_inline_variant: Variant
|
7
6
|
|
8
7
|
|
9
8
|
|
10
9
|
react:
|
11
10
|
- loading_inline_default: Default
|
12
11
|
- loading_inline_custom: Custom Text
|
13
|
-
- loading_inline_variant: Variant
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= pb_content_tag do %>
|
2
2
|
|
3
3
|
<%= pb_rails("body", props: { color: "light", dark: object.dark }) do %>
|
4
|
-
<%= pb_rails("icon", props: { aria: { label: "loading icon" }, fixed_width: true, icon:
|
4
|
+
<%= pb_rails("icon", props: { aria: { label: "loading icon" }, fixed_width: true, icon: "spinner", pulse: true }) %> <%= object.text %>
|
5
5
|
<% end %>
|
6
6
|
<% end %>
|
@@ -8,21 +8,10 @@ module Playbook
|
|
8
8
|
default: "left"
|
9
9
|
prop :dark, type: Playbook::Props::Boolean, default: false
|
10
10
|
prop :text, type: Playbook::Props::String, default: "Loading"
|
11
|
-
prop :variant, type: Playbook::Props::Enum,
|
12
|
-
values: %w[dotted solid],
|
13
|
-
default: "dotted"
|
14
11
|
|
15
12
|
def classname
|
16
13
|
generate_classname("pb_loading_inline_kit", align)
|
17
14
|
end
|
18
|
-
|
19
|
-
def spinner_icon
|
20
|
-
if variant == "dotted"
|
21
|
-
"spinner"
|
22
|
-
elsif variant == "solid"
|
23
|
-
"spinner-solid"
|
24
|
-
end
|
25
|
-
end
|
26
15
|
end
|
27
16
|
end
|
28
17
|
end
|
@@ -140,8 +140,7 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
|
|
140
140
|
delete filteredProps?.marginLeft;
|
141
141
|
|
142
142
|
|
143
|
-
const
|
144
|
-
const Tag = isLink ? "a" : "div"
|
143
|
+
const Tag = link ? "a" : "div";
|
145
144
|
const activeClass = active === true ? "active" : "";
|
146
145
|
const highlightedBorderClass = active === true && highlighted_border === false ? "highlighted_border_none" : "";
|
147
146
|
const collapsibleTrailClass = collapsible && collapsibleTrail ? "collapsible_trail" : "";
|
@@ -201,13 +200,6 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
|
|
201
200
|
|
202
201
|
const collapsibleClasses = buildCss("collapsible_nav_wrapper", activeClass, highlightedBorderClass, collapsibleTrailClass)
|
203
202
|
|
204
|
-
const handleKeyDown = (e: React.KeyboardEvent) => {
|
205
|
-
if (!isLink && (e.key === "Enter" || e.key === " ")) {
|
206
|
-
e.preventDefault()
|
207
|
-
onClick?.()
|
208
|
-
}
|
209
|
-
}
|
210
|
-
|
211
203
|
return (
|
212
204
|
<>
|
213
205
|
{collapsible ? (
|
@@ -230,18 +222,15 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
|
|
230
222
|
{...dataProps}
|
231
223
|
{...htmlProps}
|
232
224
|
className={classes}
|
233
|
-
href={
|
225
|
+
href={link}
|
234
226
|
id={id}
|
235
|
-
|
236
|
-
tabIndex={!isLink ? 0 : undefined}
|
237
|
-
target={isLink ? target : undefined}
|
227
|
+
target={target}
|
238
228
|
>
|
239
229
|
{imageUrl && (
|
240
230
|
<div
|
241
231
|
className="pb_nav_list_item_icon_section_collapsible"
|
242
232
|
key={imageUrl}
|
243
233
|
onClick={(e) => handleIconClick(e)}
|
244
|
-
onKeyDown={!isLink ? handleKeyDown : undefined}
|
245
234
|
>
|
246
235
|
<Image className="pb_nav_img_wrapper"
|
247
236
|
url={imageUrl}
|
@@ -276,13 +265,10 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
|
|
276
265
|
{...dataProps}
|
277
266
|
{...htmlProps}
|
278
267
|
className={classes}
|
279
|
-
href={
|
268
|
+
href={link}
|
280
269
|
id={id}
|
281
270
|
onClick={onClick}
|
282
|
-
|
283
|
-
role={!isLink ? "button" : undefined}
|
284
|
-
tabIndex={!isLink ? 0 : undefined}
|
285
|
-
target={isLink ? target : undefined}
|
271
|
+
target={target}
|
286
272
|
>
|
287
273
|
{imageUrl && (
|
288
274
|
<div className="pb_nav_list_item_icon_section"
|
@@ -3,9 +3,7 @@
|
|
3
3
|
<%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs", dark: object.dark, classname:object.margin_classes }) do %>
|
4
4
|
<%= pb_content_tag( object.tag,
|
5
5
|
href: object.link && object.link,
|
6
|
-
target: object.link && object.target
|
7
|
-
onkeydown: !object.link ? "if(event.key==='Enter'||event.key===' '){event.preventDefault(); this.click();}" : nil,
|
8
|
-
tabindex: object.link ? nil : 0,
|
6
|
+
target: object.link && object.target
|
9
7
|
) do %>
|
10
8
|
<% if object.image_url %>
|
11
9
|
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper_collapsible" }) %>
|
@@ -25,9 +23,7 @@
|
|
25
23
|
<% else %>
|
26
24
|
<%= pb_content_tag( object.tag,
|
27
25
|
href: object.link && object.link,
|
28
|
-
target: object.link && object.target
|
29
|
-
onkeydown: !object.link ? "if(event.key==='Enter'||event.key===' '){event.preventDefault(); this.click();}" : nil,
|
30
|
-
tabindex: object.link ? nil : 0,
|
26
|
+
target: object.link && object.target
|
31
27
|
) do %>
|
32
28
|
<% if object.image_url %>
|
33
29
|
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
|
@@ -36,7 +36,6 @@ type TextInputProps = {
|
|
36
36
|
alignment?: "right" | "left",
|
37
37
|
border?: boolean,
|
38
38
|
},
|
39
|
-
autoComplete?: boolean | string,
|
40
39
|
} & GlobalProps
|
41
40
|
|
42
41
|
const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>) => {
|
@@ -60,7 +59,6 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
60
59
|
type = 'text',
|
61
60
|
value = '',
|
62
61
|
children = null,
|
63
|
-
autoComplete = true,
|
64
62
|
} = props
|
65
63
|
|
66
64
|
const ariaProps = buildAriaProps(aria)
|
@@ -144,7 +142,6 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
144
142
|
childInput ? React.cloneElement(children, { className: "text_input" }) :
|
145
143
|
(<input
|
146
144
|
{...domSafeProps(props)}
|
147
|
-
autoComplete={typeof autoComplete === "string" ? autoComplete : ( autoComplete ? undefined : "off" )}
|
148
145
|
className="text_input"
|
149
146
|
disabled={disabled}
|
150
147
|
id={id}
|
@@ -9,8 +9,6 @@ examples:
|
|
9
9
|
- text_input_no_label: No Label
|
10
10
|
- text_input_options: Input Options
|
11
11
|
- text_input_mask: Mask
|
12
|
-
- text_input_autocomplete: Autocomplete
|
13
|
-
|
14
12
|
react:
|
15
13
|
- text_input_default: Default
|
16
14
|
- text_input_error: With Error
|
@@ -21,7 +19,6 @@ examples:
|
|
21
19
|
- text_input_no_label: No Label
|
22
20
|
- text_input_mask: Mask
|
23
21
|
- text_input_sanitize: Sanitized Masked Input
|
24
|
-
- text_input_autocomplete: Autocomplete
|
25
22
|
|
26
23
|
|
27
24
|
swift:
|
@@ -7,4 +7,3 @@ export { default as TextInputInline } from './_text_input_inline.jsx'
|
|
7
7
|
export { default as TextInputNoLabel } from './_text_input_no_label.jsx'
|
8
8
|
export { default as TextInputMask } from './_text_input_mask.jsx'
|
9
9
|
export { default as TextInputSanitize } from './_text_input_sanitize.jsx'
|
10
|
-
export { default as TextInputAutocomplete } from './_text_input_autocomplete.jsx'
|
@@ -15,7 +15,8 @@ module Playbook
|
|
15
15
|
"cvv" => '\d{3,4}',
|
16
16
|
}.freeze
|
17
17
|
|
18
|
-
prop :autocomplete,
|
18
|
+
prop :autocomplete, type: Playbook::Props::Boolean,
|
19
|
+
default: true
|
19
20
|
prop :disabled, type: Playbook::Props::Boolean,
|
20
21
|
default: false
|
21
22
|
prop :error
|
@@ -68,7 +69,7 @@ module Playbook
|
|
68
69
|
|
69
70
|
def all_input_options
|
70
71
|
{
|
71
|
-
autocomplete: autocomplete
|
72
|
+
autocomplete: autocomplete ? nil : "off",
|
72
73
|
class: "text_input #{input_options.dig(:classname) || ''}",
|
73
74
|
data: validation_data,
|
74
75
|
disabled: disabled,
|
@@ -306,41 +306,3 @@ test('returns masked CVV value', () => {
|
|
306
306
|
|
307
307
|
expect(input.value).toBe('')
|
308
308
|
})
|
309
|
-
|
310
|
-
test('adds autocomplete string attribute', () => {
|
311
|
-
render(
|
312
|
-
<TextInput
|
313
|
-
autoComplete="family-name"
|
314
|
-
data={{ testid: testId }}
|
315
|
-
/>
|
316
|
-
)
|
317
|
-
|
318
|
-
const kit = screen.getByTestId(testId)
|
319
|
-
const input = within(kit).getByRole('textbox')
|
320
|
-
expect(input).toHaveAttribute("autocomplete", "family-name")
|
321
|
-
})
|
322
|
-
|
323
|
-
test('adds autocomplete "off" attribute', () => {
|
324
|
-
render(
|
325
|
-
<TextInput
|
326
|
-
autoComplete={false}
|
327
|
-
data={{ testid: testId }}
|
328
|
-
/>
|
329
|
-
)
|
330
|
-
|
331
|
-
const kit = screen.getByTestId(testId)
|
332
|
-
const input = within(kit).getByRole('textbox')
|
333
|
-
expect(input).toHaveAttribute("autocomplete", "off")
|
334
|
-
})
|
335
|
-
|
336
|
-
test('does not add autocomplete attribute otherwise', () => {
|
337
|
-
render(
|
338
|
-
<TextInput
|
339
|
-
data={{ testid: testId }}
|
340
|
-
/>
|
341
|
-
)
|
342
|
-
|
343
|
-
const kit = screen.getByTestId(testId)
|
344
|
-
const input = within(kit).getByRole('textbox')
|
345
|
-
expect(input).not.toHaveAttribute("autocomplete")
|
346
|
-
})
|
@@ -18,11 +18,9 @@ type TimestampProps = {
|
|
18
18
|
timezone: string,
|
19
19
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
20
20
|
id?: string,
|
21
|
-
showCurrentYear?: boolean,
|
22
21
|
showDate?: boolean,
|
23
22
|
showUser?: boolean,
|
24
23
|
hideUpdated?: boolean,
|
25
|
-
showTime?: boolean,
|
26
24
|
showTimezone?: boolean,
|
27
25
|
unstyled?: boolean,
|
28
26
|
variant?: "default" | "elapsed" | "updated"
|
@@ -39,11 +37,9 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
|
|
39
37
|
text,
|
40
38
|
timezone,
|
41
39
|
timestamp,
|
42
|
-
showCurrentYear = false,
|
43
40
|
showDate = true,
|
44
41
|
showUser = false,
|
45
42
|
hideUpdated = false,
|
46
|
-
showTime = true,
|
47
43
|
showTimezone = false,
|
48
44
|
unstyled = false,
|
49
45
|
variant = 'default',
|
@@ -59,6 +55,7 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
|
|
59
55
|
)
|
60
56
|
|
61
57
|
const currentYear = new Date().getFullYear().toString()
|
58
|
+
const dateDisplay = `${DateTime.toMonth(timestamp, timezone)} ${DateTime.toDay(timestamp, timezone)}`
|
62
59
|
const shouldShowUser = showUser == true && text.length > 0
|
63
60
|
const shouldShowTimezone = showTimezone == true && timezone.length > 0
|
64
61
|
const updatedText = hideUpdated ? "" : "Last updated"
|
@@ -73,26 +70,16 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
|
|
73
70
|
return timeDisplay
|
74
71
|
}
|
75
72
|
|
76
|
-
const baseDateDisplay = () => {
|
77
|
-
let display = `${DateTime.toMonth(timestamp, timezone)} ${DateTime.toDay(timestamp, timezone)}`
|
78
|
-
if (DateTime.toYear(timestamp, timezone).toString() !== currentYear || showCurrentYear) {
|
79
|
-
display = `${display}, ${DateTime.toYear(timestamp, timezone)}`
|
80
|
-
}
|
81
|
-
return display
|
82
|
-
}
|
83
|
-
|
84
73
|
const fullDateDisplay = () => {
|
85
|
-
|
86
|
-
|
74
|
+
let fullDisplay = `${DateTime.toMonth(timestamp, timezone)} ${DateTime.toDay(timestamp, timezone)}`
|
75
|
+
if (DateTime.toYear(timestamp, timezone).toString() !== currentYear) {
|
76
|
+
fullDisplay = `${fullDisplay}, ${DateTime.toYear(timestamp, timezone)}`
|
77
|
+
}
|
78
|
+
return `${fullDisplay} ${' \u00b7 '} ${fullTimeDisplay()}`
|
87
79
|
}
|
88
80
|
|
89
81
|
const formatUpdatedString = () => {
|
90
|
-
|
91
|
-
if (shouldShowUser) finalUpdatedString.push(`by ${text}`)
|
92
|
-
if (showDate && !showTime) finalUpdatedString.push(`on ${baseDateDisplay()}`)
|
93
|
-
if (showDate && showTime) finalUpdatedString.push(`on ${baseDateDisplay()} at ${timeDisplay}`)
|
94
|
-
if (showTime && !showDate) finalUpdatedString.push(`at ${timeDisplay}`)
|
95
|
-
return `Last updated ${finalUpdatedString.join(' ')}`
|
82
|
+
return `Last updated ${userDisplay} on ${dateDisplay} at ${timeDisplay}`
|
96
83
|
}
|
97
84
|
|
98
85
|
const formatElapsedString = () => {
|
@@ -106,10 +93,7 @@ const Timestamp = (props: TimestampProps): React.ReactElement => {
|
|
106
93
|
case 'elapsed':
|
107
94
|
return formatElapsedString()
|
108
95
|
default:
|
109
|
-
|
110
|
-
if (showDate && !showTime) return baseDateDisplay()
|
111
|
-
if (!showDate && showTime) return fullTimeDisplay()
|
112
|
-
return text
|
96
|
+
return showDate ? timestamp ? fullDateDisplay() : text : fullTimeDisplay()
|
113
97
|
}
|
114
98
|
}
|
115
99
|
|
@@ -0,0 +1 @@
|
|
1
|
+
Use these only to display status updates in areas that has a lot of data.
|
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
<%= pb_rails("timestamp", props: {
|
10
10
|
timestamp: DateTime.now,
|
11
|
+
show_date: true,
|
11
12
|
align: "left"
|
12
13
|
}) %>
|
13
14
|
|
@@ -15,6 +16,7 @@
|
|
15
16
|
|
16
17
|
<%= pb_rails("timestamp", props: {
|
17
18
|
timestamp: DateTime.now + 4.years,
|
19
|
+
show_date: true,
|
18
20
|
align: "left"
|
19
21
|
}) %>
|
20
22
|
|
@@ -22,6 +24,7 @@
|
|
22
24
|
|
23
25
|
<%= pb_rails("timestamp", props: {
|
24
26
|
timestamp: DateTime.now - 1.year,
|
27
|
+
show_date: true,
|
25
28
|
align: "left"
|
26
29
|
}) %>
|
27
30
|
|
@@ -37,6 +40,7 @@
|
|
37
40
|
|
38
41
|
<%= pb_rails("timestamp", props: {
|
39
42
|
timestamp: DateTime.now,
|
43
|
+
show_date: true,
|
40
44
|
align: "center"
|
41
45
|
}) %>
|
42
46
|
|
@@ -44,6 +48,7 @@
|
|
44
48
|
|
45
49
|
<%= pb_rails("timestamp", props: {
|
46
50
|
timestamp: DateTime.now + 4.years,
|
51
|
+
show_date: true,
|
47
52
|
align: "center"
|
48
53
|
}) %>
|
49
54
|
|
@@ -51,6 +56,7 @@
|
|
51
56
|
|
52
57
|
<%= pb_rails("timestamp", props: {
|
53
58
|
timestamp: DateTime.now - 1.year,
|
59
|
+
show_date: true,
|
54
60
|
align: "center"
|
55
61
|
}) %>
|
56
62
|
|
@@ -58,6 +64,7 @@
|
|
58
64
|
|
59
65
|
<%= pb_rails("timestamp", props: {
|
60
66
|
timestamp: DateTime.now,
|
67
|
+
show_date: false,
|
61
68
|
align: "right"
|
62
69
|
}) %>
|
63
70
|
|
@@ -65,6 +72,7 @@
|
|
65
72
|
|
66
73
|
<%= pb_rails("timestamp", props: {
|
67
74
|
timestamp: DateTime.now,
|
75
|
+
show_date: true,
|
68
76
|
align: "right"
|
69
77
|
}) %>
|
70
78
|
|
@@ -72,6 +80,7 @@
|
|
72
80
|
|
73
81
|
<%= pb_rails("timestamp", props: {
|
74
82
|
timestamp: DateTime.now + 4.years,
|
83
|
+
show_date: true,
|
75
84
|
align: "right"
|
76
85
|
}) %>
|
77
86
|
|
@@ -79,5 +88,6 @@
|
|
79
88
|
|
80
89
|
<%= pb_rails("timestamp", props: {
|
81
90
|
timestamp: DateTime.now - 1.year,
|
91
|
+
show_date: true,
|
82
92
|
align: "right"
|
83
93
|
}) %>
|