playbook_ui 15.4.0.pre.alpha.testing6712538 → 15.4.0.pre.alpha.testingseparation12395
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_bar_graph/BarGraphStyles.scss +58 -0
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +8 -21
- data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +2 -6
- data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +0 -3
- data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +0 -24
- 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 +2 -1
- 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 +0 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +0 -3
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +0 -1
- data/app/pb_kits/playbook/pb_date_time/date_time.rb +0 -1
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_date_time/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +0 -3
- 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 +0 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +0 -33
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_dropdown/index.js +13 -31
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.scss +262 -384
- data/app/pb_kits/playbook/pb_progress_step/docs/_description.md +5 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.html.erb +1 -4
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.jsx +3 -14
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.html.erb +7 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_progress_step/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_progress_step/progress_step.test.js +0 -41
- data/app/pb_kits/playbook/pb_table/_table.tsx +26 -28
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -4
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +0 -1
- data/app/pb_kits/playbook/utilities/_truncate.scss +0 -2
- data/app/pb_kits/playbook/utilities/globalProps.ts +8 -26
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +0 -18
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +0 -18
- data/dist/chunks/_typeahead-DYoSbiJE.js +6 -0
- data/dist/chunks/lib-BrAPgXB5.js +29 -0
- data/dist/chunks/vendor.js +3 -23
- 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 +5 -23
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.html.erb +0 -9
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant.jsx +0 -24
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_rails.md +0 -1
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_button_variant_react.md +0 -1
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +0 -14
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +0 -1
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +0 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +0 -22
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.html.erb +0 -14
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.jsx +0 -29
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_color.md +0 -3
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.jsx +0 -31
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_custom_icon.md +0 -1
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_default.md +0 -3
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tracker.md +0 -3
- data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_vertical.md +0 -1
- data/dist/chunks/_typeahead-kRdz5zPn.js +0 -6
- data/dist/chunks/lib-CgpqUb6l.js +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d624bbeb1e46932cd1e856f16b68be71e5dcfdfa453efd9fa039041de3cdf479
|
|
4
|
+
data.tar.gz: ba1d653a0fd61df21f526b94f5142f29a10696a0a09e6336e27192d54dd1e3c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d970af9311875357c6aeb3f0ebcd32a76ba599cffbb76703c2a9384a521b68189d33a84c5d82cb4d3bee9c2add55d334cb56a53f15422330baf7c4b1ab5a430
|
|
7
|
+
data.tar.gz: 2dd2ab0a7f9c8835de257faca45e419462626ee9d8b46326dc9707d9fa762e1579f0cbd8110904f732c3fc30b3e86db149ea2048f82802f48159d019830e4d98
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
@import "../tokens/colors";
|
|
2
|
+
@import "../tokens/typography";
|
|
3
|
+
@import url("https://code.highcharts.com/css/highcharts.css");
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
--highcharts-color-0: #{$data_1};
|
|
7
|
+
--highcharts-color-1: #{$data_2};
|
|
8
|
+
--highcharts-color-2: #{$data_3};
|
|
9
|
+
--highcharts-color-3: #{$data_4};
|
|
10
|
+
--highcharts-color-4: #{$data_5};
|
|
11
|
+
--highcharts-color-5: #{$data_6};
|
|
12
|
+
--highcharts-color-6: #{$data_7};
|
|
13
|
+
--highcharts-color-7: #{$data_8};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.highcharts-title {
|
|
17
|
+
font-family: $font_family_base;
|
|
18
|
+
font-weight: $bold;
|
|
19
|
+
font-size: $heading_3;
|
|
20
|
+
color: $text_lt_default;
|
|
21
|
+
fill: $text_lt_default;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.highcharts-subtitle {
|
|
25
|
+
font-family: $font_family_base;
|
|
26
|
+
color: $text_lt_light;
|
|
27
|
+
fill: $text_lt_light;
|
|
28
|
+
font-weight: $regular;
|
|
29
|
+
font-size: $text_base;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.highcharts-yaxis > .highcharts-axis-title {
|
|
33
|
+
color: $text_lt_lighter;
|
|
34
|
+
fill: $text_lt_lighter;
|
|
35
|
+
font-family: $font_family_base;
|
|
36
|
+
font-weight: $bold;
|
|
37
|
+
font-size: $text_smaller;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.highcharts-axis-labels {
|
|
41
|
+
font-family: $font_family_base;
|
|
42
|
+
color: $text_lt_lighter;
|
|
43
|
+
fill: $text_lt_lighter;
|
|
44
|
+
font-weight: $bold;
|
|
45
|
+
font-size: $text_smaller;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.highcharts-grid-line {
|
|
49
|
+
stroke: $border_light;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.highcharts-point {
|
|
53
|
+
border-radius: 3px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.highcharts-axis-line {
|
|
57
|
+
stroke: $border_light;
|
|
58
|
+
}
|
|
@@ -5,7 +5,6 @@ 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'
|
|
9
8
|
|
|
10
9
|
import usePBCopy from './usePBCopy'
|
|
11
10
|
|
|
@@ -19,7 +18,6 @@ type CopyButtonProps = {
|
|
|
19
18
|
tooltipPlacement?: 'top' | 'right' | 'bottom' | 'left'
|
|
20
19
|
tooltipText?: string
|
|
21
20
|
value?: string
|
|
22
|
-
variant?: 'button' | 'icon'
|
|
23
21
|
timeout?: number
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -30,12 +28,11 @@ const CopyButton = (props: CopyButtonProps) => {
|
|
|
30
28
|
data = {},
|
|
31
29
|
from = '',
|
|
32
30
|
id,
|
|
33
|
-
text
|
|
31
|
+
text= 'Copy',
|
|
34
32
|
timeout = 1000,
|
|
35
|
-
tooltipPlacement
|
|
33
|
+
tooltipPlacement= 'bottom',
|
|
36
34
|
tooltipText = 'Copied!',
|
|
37
35
|
value = '',
|
|
38
|
-
variant = 'icon',
|
|
39
36
|
} = props
|
|
40
37
|
|
|
41
38
|
const [copied, copy] = usePBCopy({ value, from, timeout })
|
|
@@ -45,8 +42,7 @@ const CopyButton = (props: CopyButtonProps) => {
|
|
|
45
42
|
const classes = classnames(buildCss('pb_copy_button_kit'), globalProps(props), className)
|
|
46
43
|
|
|
47
44
|
return (
|
|
48
|
-
<div
|
|
49
|
-
{...ariaProps}
|
|
45
|
+
<div {...ariaProps}
|
|
50
46
|
{...dataProps}
|
|
51
47
|
className={classes}
|
|
52
48
|
id={id}
|
|
@@ -57,20 +53,11 @@ const CopyButton = (props: CopyButtonProps) => {
|
|
|
57
53
|
showTooltip={false}
|
|
58
54
|
text={tooltipText}
|
|
59
55
|
>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/>
|
|
66
|
-
) : (
|
|
67
|
-
<Button
|
|
68
|
-
icon="copy"
|
|
69
|
-
onClick={copy}
|
|
70
|
-
>
|
|
71
|
-
{text}
|
|
72
|
-
</Button>
|
|
73
|
-
)}
|
|
56
|
+
<Button icon="copy"
|
|
57
|
+
onClick={copy}
|
|
58
|
+
>
|
|
59
|
+
{text}
|
|
60
|
+
</Button>
|
|
74
61
|
</Tooltip>
|
|
75
62
|
</div>
|
|
76
63
|
)
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
<%= pb_content_tag do %>
|
|
2
|
-
|
|
3
|
-
<%=
|
|
4
|
-
<% else %>
|
|
5
|
-
<%= pb_rails("button", props: { icon: "copy" }) do %>
|
|
6
|
-
<%= object.text %>
|
|
7
|
-
<% end %>
|
|
2
|
+
<%= pb_rails("button", props: { icon: "copy" }) do %>
|
|
3
|
+
<%= object.text %>
|
|
8
4
|
<% end %>
|
|
9
5
|
<% if object.id %>
|
|
10
6
|
<%= pb_rails("tooltip", props: {
|
|
@@ -37,29 +37,6 @@ 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
|
-
|
|
63
40
|
test('passes text and tooltip props to button', () => {
|
|
64
41
|
render(
|
|
65
42
|
<CopyButton
|
|
@@ -68,7 +45,6 @@ test('passes text and tooltip props to button', () => {
|
|
|
68
45
|
tooltipPlacement="right"
|
|
69
46
|
tooltipText="Text copied!"
|
|
70
47
|
value="copy"
|
|
71
|
-
variant="button"
|
|
72
48
|
/>
|
|
73
49
|
)
|
|
74
50
|
|
|
@@ -1,2 +1,2 @@
|
|
|
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: "
|
|
1
|
+
<%= pb_rails("copy_button", props: { id: "default-copy-button", text: "Copy Text", 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: "Copy and paste here" }) %>
|
|
@@ -7,6 +7,7 @@ const CopyButtonDefault = (props) => (
|
|
|
7
7
|
<div>
|
|
8
8
|
<CopyButton
|
|
9
9
|
{...props}
|
|
10
|
+
text="Copy Text"
|
|
10
11
|
tooltipPlacement="right"
|
|
11
12
|
tooltipText="Text copied!"
|
|
12
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,7 +15,7 @@ const CopyButtonDefault = (props) => (
|
|
|
14
15
|
|
|
15
16
|
<Textarea
|
|
16
17
|
{...props}
|
|
17
|
-
placeholder="
|
|
18
|
+
placeholder="Copy and paste here"
|
|
18
19
|
/>
|
|
19
20
|
</div>
|
|
20
21
|
)
|
|
@@ -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" }) %>
|
|
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" }) %>
|
|
5
5
|
<%= pb_rails("text_input", props: { margin_top: "xs", id: "copy-input" , value: "Copy and paste here" }) %>
|
|
@@ -21,7 +21,6 @@ const CopyButtonFrom = (props) => {
|
|
|
21
21
|
text="Copy Body text"
|
|
22
22
|
tooltipPlacement="right"
|
|
23
23
|
tooltipText="Body text copied!"
|
|
24
|
-
variant="button"
|
|
25
24
|
/>
|
|
26
25
|
|
|
27
26
|
<TextInput
|
|
@@ -37,7 +36,6 @@ const CopyButtonFrom = (props) => {
|
|
|
37
36
|
text="Copy Text Input"
|
|
38
37
|
tooltipPlacement="right"
|
|
39
38
|
tooltipText="Text input copied!"
|
|
40
|
-
variant="button"
|
|
41
39
|
/>
|
|
42
40
|
|
|
43
41
|
<Textarea
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
examples:
|
|
2
2
|
rails:
|
|
3
3
|
- copy_button_default: Default
|
|
4
|
-
- copy_button_button_variant: Button Variant
|
|
5
4
|
- copy_button_from: Copy From
|
|
6
5
|
- copy_button_hook_rails: Copy Hook
|
|
7
6
|
|
|
8
7
|
react:
|
|
9
8
|
- copy_button_default: Default
|
|
10
|
-
- copy_button_button_variant: Button Variant
|
|
11
9
|
- copy_button_from: Copy From
|
|
12
10
|
- copy_button_hook: Copy Hook
|
|
@@ -1,4 +1,3 @@
|
|
|
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'
|
|
@@ -17,7 +17,6 @@ type DateTimeProps = {
|
|
|
17
17
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
|
18
18
|
id?: string,
|
|
19
19
|
size?: "sm" | "md",
|
|
20
|
-
showCurrentYear?: boolean,
|
|
21
20
|
showDayOfWeek: boolean,
|
|
22
21
|
showIcon?: boolean,
|
|
23
22
|
timeZone?: string
|
|
@@ -33,7 +32,6 @@ const DateTime = (props: DateTimeProps): React.ReactElement => {
|
|
|
33
32
|
showDayOfWeek = false,
|
|
34
33
|
datetime,
|
|
35
34
|
id,
|
|
36
|
-
showCurrentYear = false,
|
|
37
35
|
showIcon = false,
|
|
38
36
|
size = 'md',
|
|
39
37
|
timeZone = 'America/New_York',
|
|
@@ -61,7 +59,6 @@ const DateTime = (props: DateTimeProps): React.ReactElement => {
|
|
|
61
59
|
vertical="baseline"
|
|
62
60
|
>
|
|
63
61
|
<FormattedDate
|
|
64
|
-
showCurrentYear={showCurrentYear}
|
|
65
62
|
showDayOfWeek={showDayOfWeek}
|
|
66
63
|
size={size}
|
|
67
64
|
value={datetime}
|
|
@@ -16,7 +16,6 @@ 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
|
|
20
19
|
|
|
21
20
|
def classname
|
|
22
21
|
generate_classname("pb_date_time_kit", align)
|
|
@@ -1,16 +1,14 @@
|
|
|
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
|
|
8
7
|
|
|
9
8
|
react:
|
|
10
9
|
- date_time_default: Default
|
|
11
10
|
- date_time_align: Alignment
|
|
12
11
|
- date_time_size: Size
|
|
13
|
-
- date_time_show_current_year: Show Current Year
|
|
14
12
|
|
|
15
13
|
swift:
|
|
16
14
|
- date_time_default_swift: Default
|
|
@@ -1,4 +1,3 @@
|
|
|
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,7 +17,6 @@ type DateTimeStackedProps = {
|
|
|
17
17
|
datetime: Date,
|
|
18
18
|
dark: boolean,
|
|
19
19
|
timeZone?: string,
|
|
20
|
-
showCurrentYear?: boolean,
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
@@ -29,7 +28,6 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
|
29
28
|
dark,
|
|
30
29
|
htmlOptions = {},
|
|
31
30
|
timeZone = 'America/New_York',
|
|
32
|
-
showCurrentYear = false,
|
|
33
31
|
} = props
|
|
34
32
|
|
|
35
33
|
const classes = buildCss('pb_date_time_stacked_kit', globalProps(props))
|
|
@@ -48,7 +46,6 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
|
|
|
48
46
|
bold
|
|
49
47
|
dark={dark}
|
|
50
48
|
date={date || datetime}
|
|
51
|
-
showCurrentYear={showCurrentYear}
|
|
52
49
|
/>
|
|
53
50
|
</FlexItem>
|
|
54
51
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
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 }) %>
|
|
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,36 +41,3 @@ 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
|
-
})
|
|
@@ -2,11 +2,9 @@ examples:
|
|
|
2
2
|
|
|
3
3
|
rails:
|
|
4
4
|
- date_time_stacked_default: Default
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
7
6
|
react:
|
|
8
7
|
- date_time_stacked_default: Default
|
|
9
|
-
- date_time_stacked_show_current_year: Show Current Year
|
|
10
8
|
|
|
11
9
|
swift:
|
|
12
10
|
- date_time_stacked_default_swift: Default
|
|
@@ -33,8 +33,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
33
33
|
this.formPillProps = this.element.dataset.formPillProps
|
|
34
34
|
? JSON.parse(this.element.dataset.formPillProps)
|
|
35
35
|
: {};
|
|
36
|
-
const baseInput = this.element.querySelector(DROPDOWN_INPUT);
|
|
37
|
-
this.wasOriginallyRequired = baseInput && baseInput.hasAttribute("required");
|
|
38
36
|
this.setDefaultValue();
|
|
39
37
|
this.bindEventListeners();
|
|
40
38
|
this.bindSearchInput();
|
|
@@ -358,6 +356,17 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
358
356
|
}
|
|
359
357
|
|
|
360
358
|
clearFormValidation(input) {
|
|
359
|
+
if (input.checkValidity()) {
|
|
360
|
+
const dropdownWrapperElement = input.closest(".dropdown_wrapper");
|
|
361
|
+
dropdownWrapperElement.classList.remove("error");
|
|
362
|
+
|
|
363
|
+
const errorLabelElement = dropdownWrapperElement.querySelector(
|
|
364
|
+
".pb_body_kit_negative"
|
|
365
|
+
);
|
|
366
|
+
if (errorLabelElement) {
|
|
367
|
+
errorLabelElement.remove();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
361
370
|
if (this.isMultiSelect) {
|
|
362
371
|
if (this.selectedOptions.size > 0) {
|
|
363
372
|
const dropdownWrapperElement = input.closest(".dropdown_wrapper");
|
|
@@ -368,19 +377,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
368
377
|
if (errorLabelElement) {
|
|
369
378
|
errorLabelElement.remove();
|
|
370
379
|
}
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
if (input.checkValidity()) {
|
|
376
|
-
const dropdownWrapperElement = input.closest(".dropdown_wrapper");
|
|
377
|
-
dropdownWrapperElement.classList.remove("error");
|
|
378
|
-
|
|
379
|
-
const errorLabelElement = dropdownWrapperElement.querySelector(
|
|
380
|
-
".pb_body_kit_negative"
|
|
381
|
-
);
|
|
382
|
-
if (errorLabelElement) {
|
|
383
|
-
errorLabelElement.remove();
|
|
384
380
|
}
|
|
385
381
|
}
|
|
386
382
|
}
|
|
@@ -589,9 +585,7 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
589
585
|
// for multi_select, for each selectedOption, create a hidden input
|
|
590
586
|
const name = baseInput.getAttribute("name");
|
|
591
587
|
this.selectedOptions.forEach((raw) => {
|
|
592
|
-
const
|
|
593
|
-
// Use id if available, otherwise fall back to value
|
|
594
|
-
const id = optionData.id || optionData.value;
|
|
588
|
+
const id = JSON.parse(raw).id;
|
|
595
589
|
const inp = document.createElement("input");
|
|
596
590
|
inp.type = "hidden";
|
|
597
591
|
inp.name = name;
|
|
@@ -599,19 +593,7 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
599
593
|
inp.dataset.generated = "true";
|
|
600
594
|
baseInput.insertAdjacentElement("afterend", inp);
|
|
601
595
|
});
|
|
602
|
-
|
|
603
|
-
// For multi-select, remove required from base input when there are selections
|
|
604
|
-
// The generated inputs handle the form submission with actual values
|
|
605
|
-
// Restore required attribute when there are no selections (if it was originally required)
|
|
606
|
-
if (this.selectedOptions.size > 0) {
|
|
607
|
-
baseInput.value = "";
|
|
608
|
-
baseInput.removeAttribute("required");
|
|
609
|
-
} else {
|
|
610
|
-
baseInput.value = "";
|
|
611
|
-
if (this.wasOriginallyRequired) {
|
|
612
|
-
baseInput.setAttribute("required", "");
|
|
613
|
-
}
|
|
614
|
-
}
|
|
596
|
+
baseInput.value = "";
|
|
615
597
|
}
|
|
616
598
|
|
|
617
599
|
handleBackspaceClear() {
|