playbook_ui 14.17.0.pre.alpha.play1966highchartsgaugedefaultpoc7347 → 14.17.0.pre.alpha.play2065passphrasewithselect7273
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_copy_button/_copy_button.tsx +45 -19
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +1 -3
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +5 -13
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +1 -8
- data/dist/chunks/_typeahead-BY6AFq1l.js +22 -0
- data/dist/chunks/_weekday_stacked-BwWArBYi.js +45 -0
- data/dist/chunks/lib-BGzBzFZX.js +29 -0
- data/dist/chunks/{pb_form_validation-DUYz51EH.js → pb_form_validation-BvNy9Bd6.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -19
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -14
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +0 -54
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +0 -3
- data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +0 -45
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +0 -31
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +0 -83
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx +0 -94
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md +0 -1
- data/dist/chunks/_typeahead-Bj5y64Ch.js +0 -22
- data/dist/chunks/_weekday_stacked-DmUdsm2C.js +0 -45
- data/dist/chunks/lib-CmHH0j0i.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: 988011be4025b14893c9c1fe0950f94c0675bf89ad49411bfe44ff2cac44a06e
|
4
|
+
data.tar.gz: f0343e02babc04057365026dc0de42e6e32a01eb8ed061beaeb454cbc5898676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce4c7b62fe6597ff9242d79550bce33e8abc970e233ca3a432fc2778798c5f854fe13183c0e26d10eee9a31c968265aa29047ec22d0e64de6ff051a5376b531c
|
7
|
+
data.tar.gz: 9c3ab0c466d18f9ce9f0ca87ea0758153b5ba8a2f7646de2a2cc5020fbb369ddcf4b652dc34f02e96b7f81a0fe21954b5839ee5ec2d64df19811316e238036ff
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
import React, { useState } from 'react'
|
2
3
|
import classnames from 'classnames'
|
3
4
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
4
5
|
import { globalProps } from '../utilities/globalProps'
|
@@ -6,19 +7,16 @@ import { globalProps } from '../utilities/globalProps'
|
|
6
7
|
import Button from '../pb_button/_button'
|
7
8
|
import Tooltip from '../pb_tooltip/_tooltip'
|
8
9
|
|
9
|
-
import usePBCopy from './usePBCopy'
|
10
|
-
|
11
10
|
type CopyButtonProps = {
|
12
|
-
aria?: { [key: string]: string }
|
13
|
-
className?: string
|
14
|
-
data?: { [key: string]: string }
|
15
|
-
id?: string
|
16
|
-
from?: string
|
17
|
-
text?: string
|
18
|
-
tooltipPlacement?:
|
19
|
-
tooltipText?: string
|
20
|
-
value?: string
|
21
|
-
timeout?: number
|
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,
|
22
20
|
}
|
23
21
|
|
24
22
|
const CopyButton = (props: CopyButtonProps) => {
|
@@ -29,34 +27,62 @@ const CopyButton = (props: CopyButtonProps) => {
|
|
29
27
|
from = '',
|
30
28
|
id,
|
31
29
|
text= 'Copy',
|
32
|
-
timeout = 1000,
|
33
30
|
tooltipPlacement= 'bottom',
|
34
31
|
tooltipText = 'Copied!',
|
35
32
|
value = '',
|
36
33
|
} = props
|
37
34
|
|
38
|
-
const [copied,
|
35
|
+
const [copied, setCopied] = useState(false)
|
39
36
|
|
40
37
|
const ariaProps = buildAriaProps(aria)
|
41
38
|
const dataProps = buildDataProps(data)
|
42
39
|
const classes = classnames(buildCss('pb_copy_button_kit'), globalProps(props), className)
|
43
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
|
+
|
44
68
|
return (
|
45
|
-
<div
|
69
|
+
<div
|
70
|
+
{...ariaProps}
|
46
71
|
{...dataProps}
|
47
72
|
className={classes}
|
48
73
|
id={id}
|
49
74
|
>
|
50
|
-
<Tooltip
|
75
|
+
<Tooltip
|
51
76
|
forceOpenTooltip={copied}
|
52
77
|
placement={tooltipPlacement}
|
53
78
|
showTooltip={false}
|
54
79
|
text={tooltipText}
|
55
80
|
>
|
56
|
-
<Button
|
81
|
+
<Button
|
82
|
+
icon='copy'
|
57
83
|
onClick={copy}
|
58
84
|
>
|
59
|
-
{text}
|
85
|
+
{ text }
|
60
86
|
</Button>
|
61
87
|
</Tooltip>
|
62
88
|
</div>
|
@@ -1,3 +1,2 @@
|
|
1
1
|
export { default as CopyButtonDefault } from './_copy_button_default.jsx'
|
2
|
-
export { default as CopyButtonFrom } from './_copy_button_from.jsx'
|
3
|
-
export { default as CopyButtonHook } from './_copy_button_hook.jsx'
|
2
|
+
export { default as CopyButtonFrom } from './_copy_button_from.jsx'
|
@@ -1,5 +1,4 @@
|
|
1
1
|
export { default as GaugeDefault } from './_gauge_default.jsx'
|
2
|
-
export { default as GaugePbStyles } from './_gauge_pb_styles.jsx'
|
3
2
|
export { default as GaugeDisableAnimation } from './_gauge_disable_animation.jsx'
|
4
3
|
export { default as GaugeFullCircle } from './_gauge_full_circle.jsx'
|
5
4
|
export { default as GaugeHeight } from './_gauge_height.jsx'
|
@@ -84,8 +84,8 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
84
84
|
'single-line': singleLine,
|
85
85
|
'no-hover': disableHover,
|
86
86
|
'sticky-header': sticky,
|
87
|
-
'sticky-left-column': stickyLeftColumn
|
88
|
-
'sticky-right-column': stickyRightColumn
|
87
|
+
'sticky-left-column': stickyLeftColumn,
|
88
|
+
'sticky-right-column': stickyRightColumn,
|
89
89
|
'striped': striped,
|
90
90
|
'header-borderless': headerStyle === 'borderless',
|
91
91
|
'header-floating': headerStyle === 'floating',
|
@@ -1,5 +1,3 @@
|
|
1
1
|
The `collapsibleContent` can display any content, including nested Table Rows.
|
2
2
|
|
3
|
-
Additionally, the `collapsibleSideHighlight` can also be removed by setting it to false if needed. This prop is set to true by default.
|
4
|
-
|
5
|
-
**NOTE**: We advise against using the `disableHover` Table prop when nesting Table Rows within a Table.
|
3
|
+
Additionally, the `collapsibleSideHighlight` can also be removed by setting it to false if needed. This prop is set to true by default.
|
@@ -1,5 +1,3 @@
|
|
1
1
|
The `collapsible_content` can display any content, including nested Table Rows.
|
2
2
|
|
3
|
-
Additionally, the `collapsible_side_highlight` can also be removed by setting it to false if needed. This prop is set to true by default.
|
4
|
-
|
5
|
-
**NOTE**: We advise against using the `disable_hover` Table prop when nesting Table Rows within a Table.
|
3
|
+
Additionally, the `collapsible_side_highlight` can also be removed by setting it to false if needed. This prop is set to true by default.
|
@@ -1,3 +1 @@
|
|
1
|
-
The `collapsible_content` can also be used to display nested Tables within each Row.
|
2
|
-
|
3
|
-
**NOTE**: We advise against using the `disable_hover` Table prop when nesting Tables within a Table.
|
1
|
+
The `collapsible_content` can also be used to display nested Tables within each Row.
|
@@ -25,7 +25,7 @@ type TextInputProps = {
|
|
25
25
|
name: string,
|
26
26
|
label: string,
|
27
27
|
mask?: 'currency' | 'zipCode' | 'postalCode' | 'ssn',
|
28
|
-
onChange: (e: React.FormEvent<HTMLInputElement
|
28
|
+
onChange: (e: React.FormEvent<HTMLInputElement>) => void,
|
29
29
|
placeholder: string,
|
30
30
|
required?: boolean,
|
31
31
|
type: string,
|
@@ -102,16 +102,10 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
102
102
|
|
103
103
|
let cursorPosition = e.target.selectionStart;
|
104
104
|
const isAtEnd = cursorPosition === inputValue.length;
|
105
|
-
|
105
|
+
|
106
106
|
const formattedValue = INPUTMASKS[mask].format(inputValue)
|
107
|
-
|
108
|
-
let sanitizedValue = formattedValue;
|
109
|
-
if (INPUTMASKS[mask].sanitize) {
|
110
|
-
sanitizedValue = INPUTMASKS[mask].sanitize(formattedValue)
|
111
|
-
}
|
112
|
-
|
113
107
|
e.target.value = formattedValue
|
114
|
-
|
108
|
+
|
115
109
|
// Keep cursor position
|
116
110
|
if (!isAtEnd) {
|
117
111
|
// Account for extra characters (e.g., commas added/removed in currency)
|
@@ -122,11 +116,9 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
122
116
|
}
|
123
117
|
e.target.selectionStart = e.target.selectionEnd = cursorPosition
|
124
118
|
}
|
125
|
-
|
126
|
-
onChange(e, sanitizedValue);
|
127
|
-
} else {
|
128
|
-
onChange(e)
|
129
119
|
}
|
120
|
+
|
121
|
+
onChange(e)
|
130
122
|
}
|
131
123
|
|
132
124
|
const childInput = children ? children.type === "input" : undefined
|
@@ -6,4 +6,3 @@ export { default as TextInputAddOn } from './_text_input_add_on.jsx'
|
|
6
6
|
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
|
-
export { default as TextInputSanitize } from './_text_input_sanitize.jsx'
|
@@ -3,7 +3,6 @@ type InputMask = {
|
|
3
3
|
formatDefaultValue: (value: string) => string
|
4
4
|
pattern: string
|
5
5
|
placeholder: string
|
6
|
-
sanitize?: (value: string) => string;
|
7
6
|
}
|
8
7
|
|
9
8
|
type InputMaskDictionary = {
|
@@ -74,41 +73,35 @@ export const INPUTMASKS: InputMaskDictionary = {
|
|
74
73
|
// eslint-disable-next-line no-useless-escape
|
75
74
|
pattern: '^\\$\\d{1,3}(?:,\\d{3})*(?:\\.\\d{2})?$',
|
76
75
|
placeholder: '$0.00',
|
77
|
-
sanitize: (value: string) => value.replace(/[$,]/g, ''),
|
78
76
|
},
|
79
77
|
zipCode: {
|
80
78
|
format: formatBasicPostal,
|
81
79
|
formatDefaultValue: formatBasicPostal,
|
82
80
|
pattern: '\\d{5}',
|
83
81
|
placeholder: '12345',
|
84
|
-
sanitize: (value: string) => value,
|
85
82
|
},
|
86
83
|
postalCode: {
|
87
84
|
format: formatExtendedPostal,
|
88
85
|
formatDefaultValue: formatExtendedPostal,
|
89
86
|
pattern: '\\d{5}-\\d{4}',
|
90
87
|
placeholder: '12345-6789',
|
91
|
-
sanitize: (value: string) => value.replace(/-/g, ''),
|
92
88
|
},
|
93
89
|
ssn: {
|
94
90
|
format: formatSSN,
|
95
91
|
formatDefaultValue: formatSSN,
|
96
92
|
pattern: '\\d{3}-\\d{2}-\\d{4}',
|
97
93
|
placeholder: '123-45-6789',
|
98
|
-
sanitize: (value: string) => value.replace(/-/g, ''),
|
99
94
|
},
|
100
95
|
creditCard: {
|
101
96
|
format: formatCreditCard,
|
102
97
|
formatDefaultValue: formatCreditCard,
|
103
98
|
pattern: '\\d{4} \\d{4} \\d{4} \\d{4}',
|
104
99
|
placeholder: '1234 5678 9012 3456',
|
105
|
-
sanitize: (value: string) => value.replace(/\s/g, ''),
|
106
100
|
},
|
107
101
|
cvv: {
|
108
102
|
format: formatCVV,
|
109
103
|
formatDefaultValue: formatCVV,
|
110
104
|
pattern: '\\d{3,4}',
|
111
105
|
placeholder: '123',
|
112
|
-
sanitize: (value: string) => value,
|
113
106
|
},
|
114
|
-
}
|
107
|
+
}
|