playbook_ui 15.4.0.pre.alpha.play254712379 → 15.4.0.pre.alpha.testing6712538
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/docs/_advanced_table_column_styling.jsx +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.jsx +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +2 -1
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +21 -8
- data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +6 -2
- data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +3 -0
- data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +24 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.html.erb +9 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.jsx +24 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_rails.md +1 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_react.md +1 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.html.erb +2 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +1 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb +2 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +2 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +10 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +10 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +7 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +7 -0
- data/app/pb_kits/playbook/pb_currency/docs/_description.md +2 -2
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.rb +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +14 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +33 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +22 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dropdown/index.js +31 -13
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_alignment.jsx +2 -1
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_default.jsx +2 -1
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_orientation.jsx +2 -1
- data/app/pb_kits/playbook/pb_empty_state/docs/_empty_state_size.jsx +2 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +4 -1
- data/app/pb_kits/playbook/pb_loading_inline/docs/_loading_inline_variant.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_colors.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_height.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_horizontal.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_non_clickable.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_legend_position.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_negative_numbers.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_secondary_y_axis.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_spline.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_pb_bar_graph_stacked.jsx +1 -2
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_live_data.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_color.jsx +1 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_complex.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_full_circle.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_height.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_min_max.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_pb_gauge_chart_units.jsx +2 -1
- data/app/pb_kits/playbook/pb_pb_line_graph/docs/_pb_line_graph_colors.jsx +1 -1
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.jsx +4 -1
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +3 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +8 -61
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +2 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +11 -19
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +7 -16
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +3 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +28 -26
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +4 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +4 -0
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +2 -1
- data/app/pb_kits/playbook/pb_user/docs/_user_font_options.jsx +1 -1
- data/app/pb_kits/playbook/utilities/_truncate.scss +2 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
- data/dist/chunks/_typeahead-kRdz5zPn.js +6 -0
- data/dist/chunks/lib-CgpqUb6l.js +29 -0
- data/dist/chunks/vendor.js +37 -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 +1 -1
- metadata +21 -13
- data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +0 -58
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default_rails.md +0 -7
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline_rails.md +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky_rails.md +0 -1
- data/dist/chunks/_line_graph-8BUASxIP.js +0 -1
- data/dist/chunks/_typeahead-DESMSfUO.js +0 -24
- data/dist/chunks/_weekday_stacked-EQMaMJvC.js +0 -37
- data/dist/chunks/componentRegistry-DzmmLR2x.js +0 -1
- data/dist/chunks/lib-CzQFzKzw.js +0 -29
- data/dist/chunks/pb_form_validation-Bf9TK15t.js +0 -1
- data/dist/playbook-doc.js +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ba3c087c2d2427377e05cc7552c2e72b2ed5f661d5e68fb41e4b476878cb299e
|
|
4
|
+
data.tar.gz: bda64fa599febb5aa7720b356a36c4a8eeb8932f35107261e200213c5e998355
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e5969dfec2524550306d50dff0d360efcb10a851b0016cbae743cea3554226a90721f79455c1088f58506e8009ac573a72ac9e731a47252d20d36fc7a7027d9
|
|
7
|
+
data.tar.gz: 5686d6ca3e4a7fead6dc35c9333e3b7d445a5d96315fdb3bb98057f1b4f1e46aa32a908aa6f1db17f19643d2a19cfdfd4b8c5c38d468eccafe08467bc7552c5c
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react"
|
|
2
|
-
import
|
|
2
|
+
import AdvancedTable from '../_advanced_table'
|
|
3
|
+
import Flex from '../../pb_flex/_flex'
|
|
4
|
+
import Button from '../../pb_button/_button'
|
|
3
5
|
import MOCK_DATA from "./advanced_table_mock_data.json"
|
|
4
6
|
import PAGINATION_MOCK_DATA from "./advanced_table_pagination_mock_data.json"
|
|
5
7
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import
|
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
|
3
|
+
import TextInput from '../../pb_text_input/_text_input'
|
|
4
|
+
import Body from '../../pb_body/_body'
|
|
3
5
|
import MOCK_DATA from "./advanced_table_mock_data.json";
|
|
4
6
|
|
|
5
7
|
const AdvancedTableInlineEditing = (props) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import AdvancedTable from '../_advanced_table'
|
|
3
3
|
import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
|
|
4
|
-
import
|
|
4
|
+
import colors from '../../tokens/exports/_colors.module.scss'
|
|
5
|
+
|
|
5
6
|
|
|
6
7
|
const AdvancedTableRowStyling = (props) => {
|
|
7
8
|
const columnDefinitions = [
|
|
@@ -5,6 +5,7 @@ import { globalProps } from '../utilities/globalProps'
|
|
|
5
5
|
|
|
6
6
|
import Button from '../pb_button/_button'
|
|
7
7
|
import Tooltip from '../pb_tooltip/_tooltip'
|
|
8
|
+
import CircleIconButton from '../pb_circle_icon_button/_circle_icon_button'
|
|
8
9
|
|
|
9
10
|
import usePBCopy from './usePBCopy'
|
|
10
11
|
|
|
@@ -18,6 +19,7 @@ type CopyButtonProps = {
|
|
|
18
19
|
tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left'
|
|
19
20
|
tooltipText?: string
|
|
20
21
|
value?: string
|
|
22
|
+
variant?: 'button' | 'icon'
|
|
21
23
|
timeout?: number
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -28,11 +30,12 @@ const CopyButton = (props: CopyButtonProps) => {
|
|
|
28
30
|
data = {},
|
|
29
31
|
from = '',
|
|
30
32
|
id,
|
|
31
|
-
text= 'Copy',
|
|
33
|
+
text = 'Copy',
|
|
32
34
|
timeout = 1000,
|
|
33
|
-
tooltipPlacement= 'bottom',
|
|
35
|
+
tooltipPlacement = 'bottom',
|
|
34
36
|
tooltipText = 'Copied!',
|
|
35
37
|
value = '',
|
|
38
|
+
variant = 'icon',
|
|
36
39
|
} = props
|
|
37
40
|
|
|
38
41
|
const [copied, copy] = usePBCopy({ value, from, timeout })
|
|
@@ -42,7 +45,8 @@ const CopyButton = (props: CopyButtonProps) => {
|
|
|
42
45
|
const classes = classnames(buildCss('pb_copy_button_kit'), globalProps(props), className)
|
|
43
46
|
|
|
44
47
|
return (
|
|
45
|
-
<div
|
|
48
|
+
<div
|
|
49
|
+
{...ariaProps}
|
|
46
50
|
{...dataProps}
|
|
47
51
|
className={classes}
|
|
48
52
|
id={id}
|
|
@@ -53,11 +57,20 @@ const CopyButton = (props: CopyButtonProps) => {
|
|
|
53
57
|
showTooltip={false}
|
|
54
58
|
text={tooltipText}
|
|
55
59
|
>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
{variant === 'icon' ? (
|
|
61
|
+
<CircleIconButton
|
|
62
|
+
icon="copy"
|
|
63
|
+
onClick={copy}
|
|
64
|
+
variant="link"
|
|
65
|
+
/>
|
|
66
|
+
) : (
|
|
67
|
+
<Button
|
|
68
|
+
icon="copy"
|
|
69
|
+
onClick={copy}
|
|
70
|
+
>
|
|
71
|
+
{text}
|
|
72
|
+
</Button>
|
|
73
|
+
)}
|
|
61
74
|
</Tooltip>
|
|
62
75
|
</div>
|
|
63
76
|
)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<%= pb_content_tag do %>
|
|
2
|
-
|
|
3
|
-
<%=
|
|
2
|
+
<% if object.variant == "icon" %>
|
|
3
|
+
<%= pb_rails("circle_icon_button", props: { icon: "copy", variant: "link" }) %>
|
|
4
|
+
<% else %>
|
|
5
|
+
<%= pb_rails("button", props: { icon: "copy" }) do %>
|
|
6
|
+
<%= object.text %>
|
|
7
|
+
<% end %>
|
|
4
8
|
<% end %>
|
|
5
9
|
<% if object.id %>
|
|
6
10
|
<%= pb_rails("tooltip", props: {
|
|
@@ -37,6 +37,29 @@ it('copies the value to clipboard and pastes it into an input', async () => {
|
|
|
37
37
|
expect(navigator.clipboard.writeText).toHaveBeenCalledWith("copy");
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
+
test('passes text and tooltip props to icon variant', () => {
|
|
41
|
+
render(
|
|
42
|
+
<CopyButton
|
|
43
|
+
data={{ testid: 'text-test' }}
|
|
44
|
+
tooltipPlacement="right"
|
|
45
|
+
tooltipText="Text copied!"
|
|
46
|
+
value="copy"
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
const kit = screen.getByTestId('text-test')
|
|
51
|
+
const button = kit.querySelector('.pb_button_kit.pb_button_link.pb_button_inline.pb_button_enabled')
|
|
52
|
+
expect(button).toBeInTheDocument()
|
|
53
|
+
|
|
54
|
+
fireEvent.click(button)
|
|
55
|
+
const tooltipContent = screen.getByText("Text copied!")
|
|
56
|
+
expect(tooltipContent).toHaveTextContent("Text copied!")
|
|
57
|
+
|
|
58
|
+
const tooltip = kit.querySelector('.pb_tooltip_kit')
|
|
59
|
+
expect(tooltip).toBeInTheDocument()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
|
|
40
63
|
test('passes text and tooltip props to button', () => {
|
|
41
64
|
render(
|
|
42
65
|
<CopyButton
|
|
@@ -45,6 +68,7 @@ test('passes text and tooltip props to button', () => {
|
|
|
45
68
|
tooltipPlacement="right"
|
|
46
69
|
tooltipText="Text copied!"
|
|
47
70
|
value="copy"
|
|
71
|
+
variant="button"
|
|
48
72
|
/>
|
|
49
73
|
)
|
|
50
74
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= pb_rails("copy_button", props: {
|
|
2
|
+
text: "Copy Text",
|
|
3
|
+
tooltip_position: "right",
|
|
4
|
+
tooltip_text: "Text copied!",
|
|
5
|
+
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.",
|
|
6
|
+
variant: "button",
|
|
7
|
+
}) %>
|
|
8
|
+
|
|
9
|
+
<%= pb_rails("textarea", props: { margin_top: "xs", placeholder: "Copy and paste here" }) %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import CopyButton from '../_copy_button'
|
|
4
|
+
import Textarea from '../../pb_textarea/_textarea'
|
|
5
|
+
|
|
6
|
+
const CopyButtonVariant = (props) => (
|
|
7
|
+
<div>
|
|
8
|
+
<CopyButton
|
|
9
|
+
{...props}
|
|
10
|
+
text="Copy Text"
|
|
11
|
+
tooltipPlacement="right"
|
|
12
|
+
tooltipText="Text copied!"
|
|
13
|
+
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."
|
|
14
|
+
variant="button"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<Textarea
|
|
18
|
+
{...props}
|
|
19
|
+
placeholder="Copy and paste here"
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
export default CopyButtonVariant
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Pass in `variant: "button"` to replace the Circle Icon Button with the Button kit. Set the button's text with the `text` prop.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Pass in `variant="button"` to replace the Circle Icon Button with the Button kit. Set the button's text with the `text` prop.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
<%= pb_rails("copy_button", props: { id: "default-copy-button",
|
|
2
|
-
<%= pb_rails("textarea", props: { margin_top: "xs", placeholder: "
|
|
1
|
+
<%= pb_rails("copy_button", props: { id: "default-copy-button", 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." } ) %>
|
|
2
|
+
<%= pb_rails("textarea", props: { margin_top: "xs", placeholder: "Click the icon above to copy and paste here" }) %>
|
|
@@ -7,7 +7,6 @@ const CopyButtonDefault = (props) => (
|
|
|
7
7
|
<div>
|
|
8
8
|
<CopyButton
|
|
9
9
|
{...props}
|
|
10
|
-
text="Copy Text"
|
|
11
10
|
tooltipPlacement="right"
|
|
12
11
|
tooltipText="Text copied!"
|
|
13
12
|
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."
|
|
@@ -15,7 +14,7 @@ const CopyButtonDefault = (props) => (
|
|
|
15
14
|
|
|
16
15
|
<Textarea
|
|
17
16
|
{...props}
|
|
18
|
-
placeholder="
|
|
17
|
+
placeholder="Click the icon above to copy and paste here"
|
|
19
18
|
/>
|
|
20
19
|
</div>
|
|
21
20
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%= pb_rails("body", props: { id: "body", text: "Copy this body text!"}) %>
|
|
2
|
-
<%= pb_rails("copy_button", props: { text: "Copy Body text", from: "body", id: "copy-body-button" }) %>
|
|
2
|
+
<%= pb_rails("copy_button", props: { text: "Copy Body text", from: "body", id: "copy-body-button", variant: "button" }) %>
|
|
3
3
|
<%= pb_rails("text_input", props: { margin_top: "xs", placeholder: "Copy and paste here" }) %>
|
|
4
|
-
<%= pb_rails("copy_button", props: { text: "Copy Text Input", from: "copy-input", id: "copy-input-button" }) %>
|
|
4
|
+
<%= pb_rails("copy_button", props: { text: "Copy Text Input", from: "copy-input", id: "copy-input-button", variant: "button" }) %>
|
|
5
5
|
<%= pb_rails("text_input", props: { margin_top: "xs", id: "copy-input" , value: "Copy and paste here" }) %>
|
|
@@ -21,6 +21,7 @@ const CopyButtonFrom = (props) => {
|
|
|
21
21
|
text="Copy Body text"
|
|
22
22
|
tooltipPlacement="right"
|
|
23
23
|
tooltipText="Body text copied!"
|
|
24
|
+
variant="button"
|
|
24
25
|
/>
|
|
25
26
|
|
|
26
27
|
<TextInput
|
|
@@ -36,6 +37,7 @@ const CopyButtonFrom = (props) => {
|
|
|
36
37
|
text="Copy Text Input"
|
|
37
38
|
tooltipPlacement="right"
|
|
38
39
|
tooltipText="Text input copied!"
|
|
40
|
+
variant="button"
|
|
39
41
|
/>
|
|
40
42
|
|
|
41
43
|
<Textarea
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
examples:
|
|
2
2
|
rails:
|
|
3
3
|
- copy_button_default: Default
|
|
4
|
+
- copy_button_button_variant: Button Variant
|
|
4
5
|
- copy_button_from: Copy From
|
|
5
6
|
- copy_button_hook_rails: Copy Hook
|
|
6
7
|
|
|
7
8
|
react:
|
|
8
9
|
- copy_button_default: Default
|
|
10
|
+
- copy_button_button_variant: Button Variant
|
|
9
11
|
- copy_button_from: Copy From
|
|
10
12
|
- copy_button_hook: Copy Hook
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as CopyButtonDefault } from './_copy_button_default.jsx'
|
|
2
2
|
export { default as CopyButtonFrom } from './_copy_button_from.jsx'
|
|
3
3
|
export { default as CopyButtonHook } from './_copy_button_hook.jsx'
|
|
4
|
+
export { default as CopyButtonButtonVariant } from './_copy_button_button_variant.jsx'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Abbreviate larger amounts into thousands (K), millions (M), billions (B), and even trillions (T).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Use `decimals: "matching"` when you want the full decimal amount displayed as a single number rather than split visually.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Use `decimals="matching"` when you want the full decimal amount displayed as a single number rather than split visually.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Small `Currency` kits have the negative sign on the lefthand side of the "$" symbol.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Remove the "$" symbol by setting an empty string: `symbol: ""`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Remove the "$" symbol by setting an empty string: `symbol=""`.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Use to display monetary amounts, typically on dashboards or other layouts to show an overview or summary.
|
|
2
|
-
Cents
|
|
1
|
+
Use this kit to display monetary amounts, typically on dashboards or other layouts to show an overview or summary. Pairing it with labels improves user understanding.
|
|
2
|
+
Cents are automatically ".00" unless otherwise overwritten (i.e. `unit` prop).
|
|
@@ -17,6 +17,7 @@ type DateTimeProps = {
|
|
|
17
17
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
|
18
18
|
id?: string,
|
|
19
19
|
size?: "sm" | "md",
|
|
20
|
+
showCurrentYear?: boolean,
|
|
20
21
|
showDayOfWeek: boolean,
|
|
21
22
|
showIcon?: boolean,
|
|
22
23
|
timeZone?: string
|
|
@@ -32,6 +33,7 @@ const DateTime = (props: DateTimeProps): React.ReactElement => {
|
|
|
32
33
|
showDayOfWeek = false,
|
|
33
34
|
datetime,
|
|
34
35
|
id,
|
|
36
|
+
showCurrentYear = false,
|
|
35
37
|
showIcon = false,
|
|
36
38
|
size = 'md',
|
|
37
39
|
timeZone = 'America/New_York',
|
|
@@ -59,6 +61,7 @@ const DateTime = (props: DateTimeProps): React.ReactElement => {
|
|
|
59
61
|
vertical="baseline"
|
|
60
62
|
>
|
|
61
63
|
<FormattedDate
|
|
64
|
+
showCurrentYear={showCurrentYear}
|
|
62
65
|
showDayOfWeek={showDayOfWeek}
|
|
63
66
|
size={size}
|
|
64
67
|
value={datetime}
|
|
@@ -16,6 +16,7 @@ module Playbook
|
|
|
16
16
|
prop :dark, type: Playbook::Props::Boolean, default: false
|
|
17
17
|
prop :show_icon, type: Playbook::Props::Boolean, default: false
|
|
18
18
|
prop :show_day_of_week, type: Playbook::Props::Boolean, default: false
|
|
19
|
+
prop :show_current_year, type: Playbook::Props::Boolean, default: false
|
|
19
20
|
|
|
20
21
|
def classname
|
|
21
22
|
generate_classname("pb_date_time_kit", align)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import DateTime from '../_date_time'
|
|
3
|
+
|
|
4
|
+
const DateTimeShowCurrentYear = (props) => (
|
|
5
|
+
<div>
|
|
6
|
+
<DateTime
|
|
7
|
+
datetime={new Date()}
|
|
8
|
+
showCurrentYear
|
|
9
|
+
{...props}
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
export default DateTimeShowCurrentYear
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Pass in `show_current_year` to show this date's current year.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Pass in `showCurrentYear` to show this date's current year.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
examples:
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
rails:
|
|
4
4
|
- date_time_default: Default
|
|
5
5
|
- date_time_align: Alignment
|
|
6
6
|
- date_time_size: Size
|
|
7
|
+
- date_time_show_current_year: Show Current Year
|
|
7
8
|
|
|
8
9
|
react:
|
|
9
10
|
- date_time_default: Default
|
|
10
11
|
- date_time_align: Alignment
|
|
11
12
|
- date_time_size: Size
|
|
13
|
+
- date_time_show_current_year: Show Current Year
|
|
12
14
|
|
|
13
15
|
swift:
|
|
14
16
|
- date_time_default_swift: Default
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as DateTimeDefault } from './_date_time_default.jsx'
|
|
2
2
|
export { default as DateTimeAlign } from './_date_time_align.jsx'
|
|
3
3
|
export { default as DateTimeSize } from './_date_time_size.jsx'
|
|
4
|
+
export { default as DateTimeShowCurrentYear } from './_date_time_show_current_year.jsx'
|
|
@@ -17,6 +17,7 @@ type DateTimeStackedProps = {
|
|
|
17
17
|
datetime: Date,
|
|
18
18
|
dark: boolean,
|
|
19
19
|
timeZone?: string,
|
|
20
|
+
showCurrentYear?: boolean,
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
@@ -28,6 +29,7 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
|
28
29
|
dark,
|
|
29
30
|
htmlOptions = {},
|
|
30
31
|
timeZone = 'America/New_York',
|
|
32
|
+
showCurrentYear = false,
|
|
31
33
|
} = props
|
|
32
34
|
|
|
33
35
|
const classes = buildCss('pb_date_time_stacked_kit', globalProps(props))
|
|
@@ -46,6 +48,7 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
|
46
48
|
bold
|
|
47
49
|
dark={dark}
|
|
48
50
|
date={date || datetime}
|
|
51
|
+
showCurrentYear={showCurrentYear}
|
|
49
52
|
/>
|
|
50
53
|
</FlexItem>
|
|
51
54
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<%= pb_content_tag do %>
|
|
1
|
+
<%= pb_content_tag do %>
|
|
2
2
|
|
|
3
3
|
<%= pb_rails("flex", props: {classname: "flex-container", vertical: "stretch"}) do %>
|
|
4
4
|
<%= pb_rails("body", props: {classname: "flex-item"}) do %>
|
|
5
|
-
<%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark }) %>
|
|
5
|
+
<%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark, show_current_year: object.show_current_year }) %>
|
|
6
6
|
<% end %>
|
|
7
7
|
<%= pb_rails("section_separator", props: { orientation: "vertical", classname: "date-time-padding" }) %>
|
|
8
8
|
<%= pb_rails("body", props: {classname: "flex-item"}) do %>
|
|
@@ -41,3 +41,36 @@ test('renders time in timezone', () => {
|
|
|
41
41
|
const kit = renderKit(DateTimeStacked, props)
|
|
42
42
|
expect(kit).toHaveTextContent(`${monthDayYear}11:00aMDT`)
|
|
43
43
|
})
|
|
44
|
+
|
|
45
|
+
test('renders current year when showCurrentYear is true', () => {
|
|
46
|
+
const currentYearDate = new Date()
|
|
47
|
+
const currentYear = currentYearDate.getFullYear()
|
|
48
|
+
|
|
49
|
+
const kit = renderKit(DateTimeStacked, {
|
|
50
|
+
data: { testid: 'datetimestacked-current-year' },
|
|
51
|
+
datetime: currentYearDate,
|
|
52
|
+
dark: false,
|
|
53
|
+
showCurrentYear: true,
|
|
54
|
+
})
|
|
55
|
+
expect(kit).toHaveTextContent(currentYear.toString())
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test('hides current year by default', () => {
|
|
59
|
+
const currentYearDate = new Date()
|
|
60
|
+
const currentYear = currentYearDate.getFullYear()
|
|
61
|
+
|
|
62
|
+
const kit = renderKit(DateTimeStacked, {
|
|
63
|
+
data: { testid: 'datetimestacked-hide-year' },
|
|
64
|
+
datetime: currentYearDate,
|
|
65
|
+
dark: false,
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const yearElement = kit.querySelector('.pb_caption_kit_xs')
|
|
69
|
+
|
|
70
|
+
if (yearElement) {
|
|
71
|
+
expect(yearElement.textContent).not.toBe(currentYear.toString())
|
|
72
|
+
} else {
|
|
73
|
+
|
|
74
|
+
expect(yearElement).toBeNull()
|
|
75
|
+
}
|
|
76
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import DateTimeStacked from '../_date_time_stacked'
|
|
4
|
+
|
|
5
|
+
const DateTimeStackedShowCurrentYear = (props) => (
|
|
6
|
+
<div>
|
|
7
|
+
<DateTimeStacked
|
|
8
|
+
datetime={new Date()}
|
|
9
|
+
showCurrentYear
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
<br />
|
|
13
|
+
<DateTimeStacked
|
|
14
|
+
datetime={new Date()}
|
|
15
|
+
showCurrentYear
|
|
16
|
+
timeZone="America/Denver"
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default DateTimeStackedShowCurrentYear;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
By default, the Date Time Stacked kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true as shown here.
|
|
@@ -2,9 +2,11 @@ examples:
|
|
|
2
2
|
|
|
3
3
|
rails:
|
|
4
4
|
- date_time_stacked_default: Default
|
|
5
|
-
|
|
5
|
+
- date_time_stacked_show_current_year: Show Current Year
|
|
6
|
+
|
|
6
7
|
react:
|
|
7
8
|
- date_time_stacked_default: Default
|
|
9
|
+
- date_time_stacked_show_current_year: Show Current Year
|
|
8
10
|
|
|
9
11
|
swift:
|
|
10
12
|
- date_time_stacked_default_swift: Default
|