playbook_ui 14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5757 → 14.12.0.pre.alpha.PBNTR720railscarddraggable5649
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +3 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_loading_react.md → _advanced_table_loading.md} +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +3 -17
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +11 -15
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +3 -14
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +0 -9
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +0 -5
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js +5 -7
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +8 -12
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_table/table_row.rb +1 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -3
- data/dist/chunks/{_typeahead-BIhRQo8Q.js → _typeahead-BWwaAo_0.js} +3 -3
- data/dist/chunks/_weekday_stacked-zyBCd1s8.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +0 -6
- 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/pb_forms_helper.rb +4 -13
- data/lib/playbook/version.rb +1 -1
- metadata +6 -26
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.html.erb +0 -38
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.scss +0 -3
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +0 -92
- data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +0 -64
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +0 -21
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +0 -45
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.md +0 -1
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +0 -8
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +0 -58
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb +0 -52
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md +0 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb +0 -52
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb +0 -80
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +0 -1
- data/dist/chunks/_weekday_stacked-VKMYuo6-.js +0 -45
- data/lib/playbook/pb_forms_global_props_helper.rb +0 -136
- /data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/{_fixed_confirmation_toast_auto_close_react.md → _fixed_confirmation_toast_auto_close.md} +0 -0
@@ -1,10 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "pb_forms_global_props_helper"
|
4
|
-
|
5
3
|
module Playbook
|
6
4
|
module PbFormsHelper
|
7
|
-
include Playbook::PbFormsGlobalPropsHelper
|
8
5
|
# Renders a pb form with ::Playbook::Forms::Builder, that can render
|
9
6
|
# Playbook kits in the most railsie way.
|
10
7
|
#
|
@@ -26,17 +23,11 @@ module Playbook
|
|
26
23
|
# @param validate [Boolean] whether validation should be triggered or not
|
27
24
|
# @see [#form_with] for other options
|
28
25
|
def pb_form_with(data: {}, validate: false, loading: false, **kwargs, &block)
|
29
|
-
global_props, form_options = extract_all_props(kwargs)
|
30
|
-
|
31
|
-
classnames = ["pb-form"]
|
32
|
-
classnames << form_options[:class] if form_options[:class].present?
|
33
|
-
classnames << "pb_form_loading" if loading
|
34
|
-
classnames.concat(generate_prop_classes(global_props))
|
35
|
-
|
36
26
|
data = data.merge("pb-form-validation" => validate)
|
37
|
-
|
38
|
-
|
39
|
-
|
27
|
+
classname = ["pb-form", kwargs[:class]].join(" ")
|
28
|
+
classname += " pb_form_loading" if loading
|
29
|
+
options = kwargs.merge(
|
30
|
+
class: classname,
|
40
31
|
data: data,
|
41
32
|
builder: ::Playbook::Forms::Builder
|
42
33
|
)
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.12.0.pre.alpha.
|
4
|
+
version: 14.12.0.pre.alpha.PBNTR720railscarddraggable5649
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-01-
|
12
|
+
date: 2025-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -300,16 +300,13 @@ files:
|
|
300
300
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.md
|
301
301
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.jsx
|
302
302
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md
|
303
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb
|
304
303
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.jsx
|
305
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/
|
306
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading_react.md
|
304
|
+
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.md
|
307
305
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx
|
308
306
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx
|
309
307
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.md
|
310
308
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx
|
311
309
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md
|
312
|
-
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.html.erb
|
313
310
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.jsx
|
314
311
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.md
|
315
312
|
- app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.jsx
|
@@ -798,14 +795,6 @@ files:
|
|
798
795
|
- app/pb_kits/playbook/pb_contact/docs/_description.md
|
799
796
|
- app/pb_kits/playbook/pb_contact/docs/example.yml
|
800
797
|
- app/pb_kits/playbook/pb_contact/docs/index.js
|
801
|
-
- app/pb_kits/playbook/pb_copy_button/_copy_button.scss
|
802
|
-
- app/pb_kits/playbook/pb_copy_button/_copy_button.tsx
|
803
|
-
- app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx
|
804
|
-
- app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx
|
805
|
-
- app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx
|
806
|
-
- app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.md
|
807
|
-
- app/pb_kits/playbook/pb_copy_button/docs/example.yml
|
808
|
-
- app/pb_kits/playbook/pb_copy_button/docs/index.js
|
809
798
|
- app/pb_kits/playbook/pb_currency/_currency.scss
|
810
799
|
- app/pb_kits/playbook/pb_currency/_currency.tsx
|
811
800
|
- app/pb_kits/playbook/pb_currency/currency.html.erb
|
@@ -1343,10 +1332,8 @@ files:
|
|
1343
1332
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss
|
1344
1333
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx
|
1345
1334
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_description.md
|
1346
|
-
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb
|
1347
1335
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.jsx
|
1348
|
-
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/
|
1349
|
-
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_react.md
|
1336
|
+
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.md
|
1350
1337
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.html.erb
|
1351
1338
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.jsx
|
1352
1339
|
- app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.md
|
@@ -2733,16 +2720,10 @@ files:
|
|
2733
2720
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.md
|
2734
2721
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx
|
2735
2722
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.md
|
2736
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb
|
2737
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md
|
2738
2723
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.jsx
|
2739
2724
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md
|
2740
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb
|
2741
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md
|
2742
2725
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.jsx
|
2743
2726
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md
|
2744
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb
|
2745
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md
|
2746
2727
|
- app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.jsx
|
2747
2728
|
- app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.md
|
2748
2729
|
- app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents_as_divs.html.erb
|
@@ -3311,8 +3292,8 @@ files:
|
|
3311
3292
|
- app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
|
3312
3293
|
- app/pb_kits/playbook/utilities/text.ts
|
3313
3294
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
3314
|
-
- dist/chunks/_typeahead-
|
3315
|
-
- dist/chunks/_weekday_stacked-
|
3295
|
+
- dist/chunks/_typeahead-BWwaAo_0.js
|
3296
|
+
- dist/chunks/_weekday_stacked-zyBCd1s8.js
|
3316
3297
|
- dist/chunks/lazysizes-B7xYodB-.js
|
3317
3298
|
- dist/chunks/lib-kMuhBuU7.js
|
3318
3299
|
- dist/chunks/pb_form_validation-DBJ0wZuS.js
|
@@ -3367,7 +3348,6 @@ files:
|
|
3367
3348
|
- lib/playbook/overflow.rb
|
3368
3349
|
- lib/playbook/pagination_renderer.rb
|
3369
3350
|
- lib/playbook/pb_doc_helper.rb
|
3370
|
-
- lib/playbook/pb_forms_global_props_helper.rb
|
3371
3351
|
- lib/playbook/pb_forms_helper.rb
|
3372
3352
|
- lib/playbook/pb_kit_helper.rb
|
3373
3353
|
- lib/playbook/position.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<% column_definitions = [
|
2
|
-
{
|
3
|
-
accessor: "year",
|
4
|
-
label: "Year",
|
5
|
-
cellAccessors: ["quarter", "month", "day"],
|
6
|
-
},
|
7
|
-
{
|
8
|
-
accessor: "newEnrollments",
|
9
|
-
label: "New Enrollments",
|
10
|
-
},
|
11
|
-
{
|
12
|
-
accessor: "scheduledMeetings",
|
13
|
-
label: "Scheduled Meetings",
|
14
|
-
},
|
15
|
-
{
|
16
|
-
accessor: "attendanceRate",
|
17
|
-
label: "Attendance Rate",
|
18
|
-
},
|
19
|
-
{
|
20
|
-
accessor: "completedClasses",
|
21
|
-
label: "Completed Classes",
|
22
|
-
},
|
23
|
-
{
|
24
|
-
accessor: "classCompletionRate",
|
25
|
-
label: "Class Completion Rate",
|
26
|
-
},
|
27
|
-
{
|
28
|
-
accessor: "graduatedStudents",
|
29
|
-
label: "Graduated Students",
|
30
|
-
}
|
31
|
-
] %>
|
32
|
-
|
33
|
-
<%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
|
@@ -1 +0,0 @@
|
|
1
|
-
The optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided.
|
@@ -1,38 +0,0 @@
|
|
1
|
-
|
2
|
-
<% column_definitions = [
|
3
|
-
{
|
4
|
-
accessor: "year",
|
5
|
-
label: "Year",
|
6
|
-
cellAccessors: ["quarter", "month", "day"],
|
7
|
-
},
|
8
|
-
{
|
9
|
-
accessor: "newEnrollments",
|
10
|
-
label: "New Enrollments",
|
11
|
-
},
|
12
|
-
{
|
13
|
-
accessor: "scheduledMeetings",
|
14
|
-
label: "Scheduled Meetings",
|
15
|
-
},
|
16
|
-
{
|
17
|
-
accessor: "attendanceRate",
|
18
|
-
label: "Attendance Rate",
|
19
|
-
},
|
20
|
-
{
|
21
|
-
accessor: "completedClasses",
|
22
|
-
label: "Completed Classes",
|
23
|
-
},
|
24
|
-
{
|
25
|
-
accessor: "classCompletionRate",
|
26
|
-
label: "Class Completion Rate",
|
27
|
-
},
|
28
|
-
{
|
29
|
-
accessor: "graduatedStudents",
|
30
|
-
label: "Graduated Students",
|
31
|
-
},
|
32
|
-
] %>
|
33
|
-
|
34
|
-
<%= pb_rails("title", props: { size: 4 }) do %> Not Responsive <% end %>
|
35
|
-
<%= pb_rails("advanced_table", props: { id: "table_props_table_non_responsive", table_data: @table_data, column_definitions: column_definitions, responsive: "none" }) %>
|
36
|
-
|
37
|
-
<%= pb_rails("title", props: { padding_top: "sm", size: 4 }) do %> Responsive as Default <% end %>
|
38
|
-
<%= pb_rails("advanced_table", props: { id: "table_props_table_responsive", table_data: @table_data, column_definitions: column_definitions }) %>
|
@@ -1,92 +0,0 @@
|
|
1
|
-
|
2
|
-
import React, { useState } from 'react'
|
3
|
-
import classnames from 'classnames'
|
4
|
-
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
5
|
-
import { globalProps } from '../utilities/globalProps'
|
6
|
-
|
7
|
-
import Button from '../pb_button/_button'
|
8
|
-
import Tooltip from '../pb_tooltip/_tooltip'
|
9
|
-
|
10
|
-
type CopyButtonProps = {
|
11
|
-
aria?: { [key: string]: string },
|
12
|
-
className?: string,
|
13
|
-
data?: { [key: string]: string },
|
14
|
-
id?: string,
|
15
|
-
from?: string,
|
16
|
-
text?: string,
|
17
|
-
tooltipPlacement?: "top" | "right" | "bottom" | "left",
|
18
|
-
tooltipText?: string,
|
19
|
-
value?: string,
|
20
|
-
}
|
21
|
-
|
22
|
-
const CopyButton = (props: CopyButtonProps) => {
|
23
|
-
const {
|
24
|
-
aria = {},
|
25
|
-
className,
|
26
|
-
data = {},
|
27
|
-
from = '',
|
28
|
-
id,
|
29
|
-
text= 'Copy',
|
30
|
-
tooltipPlacement= 'bottom',
|
31
|
-
tooltipText = 'Copied!',
|
32
|
-
value = '',
|
33
|
-
} = props
|
34
|
-
|
35
|
-
const [copied, setCopied] = useState(false)
|
36
|
-
|
37
|
-
const ariaProps = buildAriaProps(aria)
|
38
|
-
const dataProps = buildDataProps(data)
|
39
|
-
const classes = classnames(buildCss('pb_copy_button_kit'), globalProps(props), className)
|
40
|
-
|
41
|
-
const copy = () => {
|
42
|
-
if (!from && !value) {
|
43
|
-
return
|
44
|
-
}
|
45
|
-
|
46
|
-
if (value) {
|
47
|
-
navigator.clipboard.writeText(value)
|
48
|
-
} else if (from) {
|
49
|
-
const copyElement = document.getElementById(from);
|
50
|
-
let copyText = copyElement?.innerText
|
51
|
-
|
52
|
-
if (copyElement instanceof HTMLTextAreaElement || copyElement instanceof HTMLInputElement) {
|
53
|
-
copyText = copyElement.value;
|
54
|
-
}
|
55
|
-
|
56
|
-
if (copyText) {
|
57
|
-
navigator.clipboard.writeText(copyText)
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
setCopied(true)
|
62
|
-
|
63
|
-
setTimeout(() => {
|
64
|
-
setCopied(false)
|
65
|
-
}, 1000);
|
66
|
-
}
|
67
|
-
|
68
|
-
return (
|
69
|
-
<div
|
70
|
-
{...ariaProps}
|
71
|
-
{...dataProps}
|
72
|
-
className={classes}
|
73
|
-
id={id}
|
74
|
-
>
|
75
|
-
<Tooltip
|
76
|
-
forceOpenTooltip={copied}
|
77
|
-
placement={tooltipPlacement}
|
78
|
-
showTooltip={false}
|
79
|
-
text={tooltipText}
|
80
|
-
>
|
81
|
-
<Button
|
82
|
-
icon='copy'
|
83
|
-
onClick={copy}
|
84
|
-
>
|
85
|
-
{ text }
|
86
|
-
</Button>
|
87
|
-
</Tooltip>
|
88
|
-
</div>
|
89
|
-
)
|
90
|
-
}
|
91
|
-
|
92
|
-
export default CopyButton
|
@@ -1,64 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { CopyButton } from 'playbook-ui'
|
3
|
-
import { ensureAccessible, renderKit, render, fireEvent, screen } from '../utilities/test-utils'
|
4
|
-
|
5
|
-
const props = {
|
6
|
-
data: { testid: 'default', value: 'copy' }
|
7
|
-
}
|
8
|
-
|
9
|
-
test('returns namespaced class name', () => {
|
10
|
-
const kit = renderKit(CopyButton, props)
|
11
|
-
expect(kit).toBeInTheDocument()
|
12
|
-
expect(kit).toHaveClass('pb_copy_button_kit')
|
13
|
-
})
|
14
|
-
|
15
|
-
it('should be accessible', async () => {
|
16
|
-
ensureAccessible(CopyButton, props)
|
17
|
-
})
|
18
|
-
|
19
|
-
// It's difficult to actually use navigator.clipboard.readText, so we mock
|
20
|
-
it('copies the value to clipboard and pastes it into an input', async () => {
|
21
|
-
Object.defineProperty(global, 'navigator', {
|
22
|
-
value: {
|
23
|
-
clipboard: {
|
24
|
-
writeText: jest.fn().mockResolvedValueOnce(undefined),
|
25
|
-
},
|
26
|
-
},
|
27
|
-
writable: true,
|
28
|
-
})
|
29
|
-
|
30
|
-
render(<CopyButton {...props} />)
|
31
|
-
|
32
|
-
const copyButton = screen.getByTestId('default')
|
33
|
-
fireEvent.click(copyButton)
|
34
|
-
|
35
|
-
await navigator.clipboard.writeText('copy')
|
36
|
-
|
37
|
-
expect(navigator.clipboard.writeText).toHaveBeenCalledWith("copy");
|
38
|
-
})
|
39
|
-
|
40
|
-
test('passes text and tooltip props to button', () => {
|
41
|
-
render(
|
42
|
-
<CopyButton
|
43
|
-
data={{ testid: 'text-test' }}
|
44
|
-
text={"text"}
|
45
|
-
tooltipPlacement="right"
|
46
|
-
tooltipText="Text copied!"
|
47
|
-
value="copy"
|
48
|
-
/>
|
49
|
-
)
|
50
|
-
|
51
|
-
const content = screen.getByText("text")
|
52
|
-
expect(content).toHaveTextContent("text")
|
53
|
-
|
54
|
-
const kit = screen.getByTestId('text-test')
|
55
|
-
const button = kit.querySelector('.pb_button_kit_primary_inline_enabled')
|
56
|
-
expect(button).toBeInTheDocument()
|
57
|
-
|
58
|
-
fireEvent.click(button)
|
59
|
-
const tooltipContent = screen.getByText("Text copied!")
|
60
|
-
expect(tooltipContent).toHaveTextContent("Text copied!")
|
61
|
-
|
62
|
-
const tooltip = kit.querySelector('.pb_tooltip_kit')
|
63
|
-
expect(tooltip).toBeInTheDocument()
|
64
|
-
})
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { CopyButton, Textarea } from 'playbook-ui'
|
3
|
-
|
4
|
-
const CopyButtonDefault = (props) => (
|
5
|
-
<div>
|
6
|
-
<CopyButton
|
7
|
-
{...props}
|
8
|
-
text="Copy Text"
|
9
|
-
tooltipPlacement="right"
|
10
|
-
tooltipText="Text copied!"
|
11
|
-
value="Playbook makes it easy to support bleeding edge, or legacy systems. Use Playbook’s 200+ components and end-to-end design language to create simple, intuitive and beautiful experiences with ease."
|
12
|
-
/>
|
13
|
-
|
14
|
-
<Textarea
|
15
|
-
{...props}
|
16
|
-
placeholder="Copy and paste here"
|
17
|
-
/>
|
18
|
-
</div>
|
19
|
-
)
|
20
|
-
|
21
|
-
export default CopyButtonDefault
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import React, { useState } from 'react'
|
2
|
-
import { CopyButton, Body, TextInput, Textarea } from 'playbook-ui'
|
3
|
-
|
4
|
-
const CopyButtonFrom = (props) => {
|
5
|
-
const [text, setText] = useState("Copy this text input text")
|
6
|
-
|
7
|
-
const handleChange = (event) => {
|
8
|
-
setText(event.target.value);
|
9
|
-
}
|
10
|
-
|
11
|
-
return (<div>
|
12
|
-
<Body id="body">Copy this body text!</Body>
|
13
|
-
<CopyButton
|
14
|
-
{...props}
|
15
|
-
from="body"
|
16
|
-
marginBottom="sm"
|
17
|
-
text="Copy Body text"
|
18
|
-
tooltipPlacement="right"
|
19
|
-
tooltipText="Body text copied!"
|
20
|
-
/>
|
21
|
-
|
22
|
-
<TextInput
|
23
|
-
{...props}
|
24
|
-
id="textinput"
|
25
|
-
onChange={handleChange}
|
26
|
-
value={text}
|
27
|
-
/>
|
28
|
-
<CopyButton
|
29
|
-
{...props}
|
30
|
-
from="textinput"
|
31
|
-
marginBottom="sm"
|
32
|
-
text="Copy Text Input"
|
33
|
-
tooltipPlacement="right"
|
34
|
-
tooltipText="Text input copied!"
|
35
|
-
/>
|
36
|
-
|
37
|
-
<Textarea
|
38
|
-
{...props}
|
39
|
-
placeholder="Copy and paste here"
|
40
|
-
/>
|
41
|
-
</div>
|
42
|
-
)
|
43
|
-
}
|
44
|
-
|
45
|
-
export default CopyButtonFrom
|
@@ -1 +0,0 @@
|
|
1
|
-
Provide an element's ID as the `from` parameter, and its text will be copied. If the element is an input, its `value` will be copied; otherwise, the `innerText` will be used. Additionally, if a `value` prop is provided, it will override the content from the `from` element and be copied instead.
|
@@ -1,58 +0,0 @@
|
|
1
|
-
<%= pb_rails("button", props: { text: "Show Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close" } }) %>
|
2
|
-
<%= pb_rails("button", props: { text: "Show Closeable Auto Close Toast", variant: "secondary", data: { toast: "#toast-auto-close-closeable" } }) %>
|
3
|
-
|
4
|
-
<%= pb_rails("fixed_confirmation_toast", props: {
|
5
|
-
auto_close: 3000,
|
6
|
-
classname: "toast-to-hide",
|
7
|
-
id: "toast-auto-close",
|
8
|
-
text: "I will disappear in 3 seconds.",
|
9
|
-
status: "tip",
|
10
|
-
vertical: "top",
|
11
|
-
horizontal: "center"
|
12
|
-
}) %>
|
13
|
-
|
14
|
-
<%= pb_rails("fixed_confirmation_toast", props: {
|
15
|
-
auto_close: 10000,
|
16
|
-
closeable: true,
|
17
|
-
id: "toast-auto-close-closeable",
|
18
|
-
text: "I will disappear in 10 seconds.",
|
19
|
-
status: "tip",
|
20
|
-
vertical: "top",
|
21
|
-
horizontal: "center"
|
22
|
-
}) %>
|
23
|
-
|
24
|
-
<script>
|
25
|
-
document.addEventListener('DOMContentLoaded', () => {
|
26
|
-
// Initialize toast elements and buttons
|
27
|
-
const toasts = {
|
28
|
-
'#toast-auto-close': document.querySelector("#toast-auto-close"),
|
29
|
-
'#toast-auto-close-closeable': document.querySelector("#toast-auto-close-closeable")
|
30
|
-
}
|
31
|
-
|
32
|
-
const buttons = {
|
33
|
-
'#toast-auto-close': document.querySelector("button[data-toast='#toast-auto-close']"),
|
34
|
-
'#toast-auto-close-closeable': document.querySelector("button[data-toast='#toast-auto-close-closeable']")
|
35
|
-
}
|
36
|
-
|
37
|
-
// Store original toasts and remove them from DOM
|
38
|
-
const originalToasts = {}
|
39
|
-
Object.entries(toasts).forEach(([id, toast]) => {
|
40
|
-
if (toast) {
|
41
|
-
originalToasts[id] = toast.cloneNode(true)
|
42
|
-
toast.remove()
|
43
|
-
}
|
44
|
-
})
|
45
|
-
|
46
|
-
// Set up button click handlers
|
47
|
-
Object.keys(buttons).forEach((toastId) => {
|
48
|
-
const button = buttons[toastId]
|
49
|
-
if (button) {
|
50
|
-
button.onclick = () => {
|
51
|
-
const newToast = originalToasts[toastId].cloneNode(true)
|
52
|
-
newToast.style.display = "flex"
|
53
|
-
document.body.appendChild(newToast)
|
54
|
-
}
|
55
|
-
}
|
56
|
-
})
|
57
|
-
})
|
58
|
-
</script>
|
@@ -1,3 +0,0 @@
|
|
1
|
-
Auto close is used when you want the confirmation toast to close automatically after a certain time. `auto_close` property will be a delay number in ms.
|
2
|
-
|
3
|
-
The script tag in this code snippet is for demonstration purposes only. It clones the toasts in order to have it appear with a button click prompt and not upon initial page load. In a typical production environment the event triggering a fixed confirmation toast to appear would be handled by a controller or a separate javascript file.
|
data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
<% content = capture do %>
|
2
|
-
<%= pb_rails("card", props: { border_none: true, border_radius: "none", padding: "md" }) do %>
|
3
|
-
<%= pb_rails("body", props: { text: "Expanded Custom Layout", padding_bottom: "sm" }) %>
|
4
|
-
<%= pb_rails("flex", props: { justify: "between" }) do %>
|
5
|
-
<%= pb_rails("image", props: { size: "sm", url: "https://unsplash.it/500/400/?image=634" }) %>
|
6
|
-
<%= pb_rails("image", props: { size: "sm", url: "https://unsplash.it/500/400/?image=634" }) %>
|
7
|
-
<%= pb_rails("image", props: { size: "sm", url: "https://unsplash.it/500/400/?image=634" }) %>
|
8
|
-
<%= pb_rails("image", props: { size: "sm", url: "https://unsplash.it/500/400/?image=634" }) %>
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<%= pb_rails("table", props: { size: "sm" }) do %>
|
14
|
-
<%= pb_rails("table/table_head") do %>
|
15
|
-
<%= pb_rails("table/table_row") do %>
|
16
|
-
<%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
|
17
|
-
<%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
|
18
|
-
<%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
|
19
|
-
<%= pb_rails("table/table_header", props: { text: "Column 4"}) %>
|
20
|
-
<%= pb_rails("table/table_header", props: { text: "Column 5"}) %>
|
21
|
-
<%= pb_rails("table/table_header", props: { text: ""}) %>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
<%= pb_rails("table/table_body") do %>
|
25
|
-
<%= pb_rails("table/table_row", props: { collapsible: true, collapsible_content: content, id: "2" }) do %>
|
26
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
27
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
28
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
29
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
30
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
31
|
-
<%= pb_rails("table/table_cell", props: { text_align: "right"}) do %>
|
32
|
-
<%= pb_rails("icon", props: { icon: "chevron-down", fixed_width: true, color: "primary" }) %>
|
33
|
-
<% end %>
|
34
|
-
<% end %>
|
35
|
-
<%= pb_rails("table/table_row") do %>
|
36
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
37
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
38
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
39
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
40
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
41
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
42
|
-
<% end %>
|
43
|
-
<%= pb_rails("table/table_row") do %>
|
44
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
45
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
46
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
47
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
48
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
49
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
50
|
-
<% end %>
|
51
|
-
<% end %>
|
52
|
-
<% end %>
|
data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md
DELETED
File without changes
|
data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
<% content = capture do %>
|
2
|
-
<%= pb_rails("table", props: { container: false, border_radius: "none", size: "sm"}) do %>
|
3
|
-
<%= pb_rails("background", props: { tag: "tr" }) do %>
|
4
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
5
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
6
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
7
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
8
|
-
<%= pb_rails("table/table_cell") do %>Expanded<% end %>
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<%= pb_rails("table", props: { size: "sm" }) do %>
|
14
|
-
<%= pb_rails("table/table_head") do %>
|
15
|
-
<%= pb_rails("table/table_row") do %>
|
16
|
-
<%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
|
17
|
-
<%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
|
18
|
-
<%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
|
19
|
-
<%= pb_rails("table/table_header", props: { text: "Column 4"}) %>
|
20
|
-
<%= pb_rails("table/table_header", props: { text: "Column 5"}) %>
|
21
|
-
<%= pb_rails("table/table_header", props: { text: ""}) %>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
<%= pb_rails("table/table_body") do %>
|
25
|
-
<%= pb_rails("table/table_row", props: { collapsible: true, collapsible_content: content, collapsible_side_highlight: false, id: "3" }) do %>
|
26
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
27
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
28
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
29
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
30
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
31
|
-
<%= pb_rails("table/table_cell", props: { text_align: "right"}) do %>
|
32
|
-
<%= pb_rails("icon", props: { icon: "chevron-down", fixed_width: true, color: "primary" }) %>
|
33
|
-
<% end %>
|
34
|
-
<% end %>
|
35
|
-
<%= pb_rails("table/table_row") do %>
|
36
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
37
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
38
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
39
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
40
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
41
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
42
|
-
<% end %>
|
43
|
-
<%= pb_rails("table/table_row") do %>
|
44
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
|
45
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
|
46
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
|
47
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4"}) %>
|
48
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5"}) %>
|
49
|
-
<%= pb_rails("table/table_cell", props: { text: ""}) %>
|
50
|
-
<% end %>
|
51
|
-
<% end %>
|
52
|
-
<% end %>
|