playbook_ui 14.10.0.pre.alpha.PLAY1750pbcontenttagkitbutton5308 → 14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5274
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/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +8 -53
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +18 -23
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +4 -6
- data/app/pb_kits/playbook/pb_button/button.html.erb +3 -2
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +6 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +12 -7
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +14 -9
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +11 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +14 -8
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +15 -24
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx +1 -3
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx +1 -4
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +1 -8
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_table/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +0 -18
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +1 -22
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +0 -80
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +5 -6
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -5
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb +5 -4
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx +4 -4
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/timeline.rb +6 -6
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -1
- data/app/pb_kits/playbook/utilities/globalProps.ts +9 -18
- data/dist/chunks/_typeahead-gJLWiR0r.js +22 -0
- data/dist/chunks/_weekday_stacked-BT8jIMPK.js +45 -0
- data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
- data/dist/chunks/vendor.js +1 -1
- 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/classnames.rb +0 -1
- data/lib/playbook/spacing.rb +0 -21
- data/lib/playbook/version.rb +1 -1
- metadata +5 -6
- data/app/pb_kits/playbook/utilities/_gap.scss +0 -29
- data/dist/chunks/_typeahead-C2iCBqxQ.js +0 -36
- data/dist/chunks/_weekday_stacked-CWnbnW7m.js +0 -45
- data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
@@ -6,7 +6,7 @@ type InputMask = {
|
|
6
6
|
}
|
7
7
|
|
8
8
|
type InputMaskDictionary = {
|
9
|
-
[key in 'currency' | 'zipCode' | 'postalCode' | 'ssn'
|
9
|
+
[key in 'currency' | 'zipCode' | 'postalCode' | 'ssn']: InputMask
|
10
10
|
}
|
11
11
|
|
12
12
|
const formatCurrencyDefaultValue = (value: string): string => {
|
@@ -58,15 +58,6 @@ const formatSSN = (value: string): string => {
|
|
58
58
|
.replace(/(\d{3})(?=\d)/, '$1-')
|
59
59
|
}
|
60
60
|
|
61
|
-
const formatCreditCard = (value: string): string => {
|
62
|
-
const cleaned = value.replace(/\D/g, '').slice(0, 16)
|
63
|
-
return cleaned.replace(/(\d{4})(?=\d)/g, '$1 ')
|
64
|
-
}
|
65
|
-
|
66
|
-
const formatCVV = (value: string): string => {
|
67
|
-
return value.replace(/\D/g, '').slice(0, 4)
|
68
|
-
}
|
69
|
-
|
70
61
|
export const INPUTMASKS: InputMaskDictionary = {
|
71
62
|
currency: {
|
72
63
|
format: formatCurrency,
|
@@ -93,16 +84,4 @@ export const INPUTMASKS: InputMaskDictionary = {
|
|
93
84
|
pattern: '\\d{3}-\\d{2}-\\d{4}',
|
94
85
|
placeholder: '123-45-6789',
|
95
86
|
},
|
96
|
-
creditCard: {
|
97
|
-
format: formatCreditCard,
|
98
|
-
formatDefaultValue: formatCreditCard,
|
99
|
-
pattern: '\\d{4} \\d{4} \\d{4} \\d{4}',
|
100
|
-
placeholder: '1234 5678 9012 3456',
|
101
|
-
},
|
102
|
-
cvv: {
|
103
|
-
format: formatCVV,
|
104
|
-
formatDefaultValue: formatCVV,
|
105
|
-
pattern: '\\d{3,4}',
|
106
|
-
placeholder: '123',
|
107
|
-
},
|
108
87
|
}
|
@@ -226,83 +226,3 @@ test('returns masked ssn value', () => {
|
|
226
226
|
|
227
227
|
expect(input.value).toBe('123-45-6789')
|
228
228
|
})
|
229
|
-
|
230
|
-
const TextInputCreditCardMask = (props) => {
|
231
|
-
const [creditCard, setValue] = useState('')
|
232
|
-
const handleOnChange = ({ target }) => {
|
233
|
-
setValue(target.value)
|
234
|
-
}
|
235
|
-
|
236
|
-
return (
|
237
|
-
<TextInput
|
238
|
-
mask="creditCard"
|
239
|
-
onChange={handleOnChange}
|
240
|
-
value={creditCard}
|
241
|
-
{...props}
|
242
|
-
/>
|
243
|
-
)
|
244
|
-
}
|
245
|
-
|
246
|
-
test('returns masked credit card value', () => {
|
247
|
-
render(
|
248
|
-
<TextInputCreditCardMask
|
249
|
-
data={{ testid: testId }}
|
250
|
-
/>
|
251
|
-
)
|
252
|
-
|
253
|
-
const kit = screen.getByTestId(testId)
|
254
|
-
|
255
|
-
const input = within(kit).getByRole('textbox')
|
256
|
-
|
257
|
-
fireEvent.change(input, { target: { value: '1234567890123456' } })
|
258
|
-
|
259
|
-
expect(input.value).toBe('1234 5678 9012 3456')
|
260
|
-
|
261
|
-
fireEvent.change(input, { target: { value: '1234' } })
|
262
|
-
|
263
|
-
expect(input.value).toBe('1234')
|
264
|
-
|
265
|
-
fireEvent.change(input, { target: { value: '' } })
|
266
|
-
|
267
|
-
expect(input.value).toBe('')
|
268
|
-
})
|
269
|
-
|
270
|
-
const TextInputCVVMask = (props) => {
|
271
|
-
const [cvv, setValue] = useState('')
|
272
|
-
const handleOnChange = ({ target }) => {
|
273
|
-
setValue(target.value)
|
274
|
-
}
|
275
|
-
|
276
|
-
return (
|
277
|
-
<TextInput
|
278
|
-
mask="cvv"
|
279
|
-
onChange={handleOnChange}
|
280
|
-
value={cvv}
|
281
|
-
{...props}
|
282
|
-
/>
|
283
|
-
)
|
284
|
-
}
|
285
|
-
|
286
|
-
test('returns masked CVV value', () => {
|
287
|
-
render(
|
288
|
-
<TextInputCVVMask
|
289
|
-
data={{ testid: testId }}
|
290
|
-
/>
|
291
|
-
)
|
292
|
-
|
293
|
-
const kit = screen.getByTestId(testId)
|
294
|
-
|
295
|
-
const input = within(kit).getByRole('textbox')
|
296
|
-
|
297
|
-
fireEvent.change(input, { target: { value: '1234' } })
|
298
|
-
|
299
|
-
expect(input.value).toBe('1234')
|
300
|
-
|
301
|
-
fireEvent.change(input, { target: { value: '123' } })
|
302
|
-
|
303
|
-
expect(input.value).toBe('123')
|
304
|
-
|
305
|
-
fireEvent.change(input, { target: { value: '' } })
|
306
|
-
|
307
|
-
expect(input.value).toBe('')
|
308
|
-
})
|
@@ -66,9 +66,6 @@ $gap_lg: $height_from_top + $space_lg;
|
|
66
66
|
[class*=pb_timeline_item_kit] {
|
67
67
|
&[class*=_solid] {
|
68
68
|
flex-basis: 100%;
|
69
|
-
[class=pb_timeline_item_left_block] {
|
70
|
-
height: 0px;
|
71
|
-
}
|
72
69
|
[class=pb_timeline_item_step] {
|
73
70
|
@include flex_wrapper(row);
|
74
71
|
margin-top: $space_xs;
|
@@ -80,9 +77,6 @@ $gap_lg: $height_from_top + $space_lg;
|
|
80
77
|
}
|
81
78
|
&[class*=_dotted] {
|
82
79
|
flex-basis: 100%;
|
83
|
-
[class=pb_timeline_item_left_block] {
|
84
|
-
height: 0;
|
85
|
-
}
|
86
80
|
[class=pb_timeline_item_step] {
|
87
81
|
@include flex_wrapper(row);
|
88
82
|
margin-top: $space_xs;
|
@@ -92,6 +86,11 @@ $gap_lg: $height_from_top + $space_lg;
|
|
92
86
|
}
|
93
87
|
}
|
94
88
|
}
|
89
|
+
[class=pb_timeline_item_step] {
|
90
|
+
> :first-child:not([class^=pb_icon_circle_kit]) {
|
91
|
+
margin-top: $space_xs;
|
92
|
+
}
|
93
|
+
}
|
95
94
|
}
|
96
95
|
&[class*=_with_date] {
|
97
96
|
@include flex_wrapper(row);
|
@@ -20,7 +20,7 @@ type TimelineProps = {
|
|
20
20
|
id?: string,
|
21
21
|
orientation?: string,
|
22
22
|
showDate?: boolean,
|
23
|
-
|
23
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg' | 'none',
|
24
24
|
} & GlobalProps
|
25
25
|
|
26
26
|
const Timeline = ({
|
@@ -32,15 +32,15 @@ const Timeline = ({
|
|
32
32
|
id,
|
33
33
|
orientation = 'horizontal',
|
34
34
|
showDate = false,
|
35
|
-
|
35
|
+
gap = 'none',
|
36
36
|
...props
|
37
37
|
}: TimelineProps): React.ReactElement => {
|
38
38
|
const ariaProps = buildAriaProps(aria)
|
39
39
|
const dataProps = buildDataProps(data)
|
40
40
|
const htmlProps = buildHtmlProps(htmlOptions)
|
41
41
|
const dateStyle = showDate === true ? '_with_date' : ''
|
42
|
-
const
|
43
|
-
const timelineCss = buildCss('pb_timeline_kit', `${orientation}`, dateStyle,
|
42
|
+
const gapStyle = gap === 'none' ? '' : `gap_${gap}`
|
43
|
+
const timelineCss = buildCss('pb_timeline_kit', `${orientation}`, dateStyle, gapStyle)
|
44
44
|
|
45
45
|
return (
|
46
46
|
<div
|
@@ -60,4 +60,4 @@ Timeline.Step = TimelineStep
|
|
60
60
|
Timeline.Label = TimelineLabel
|
61
61
|
Timeline.Detail = TimelineDetail
|
62
62
|
|
63
|
-
export default Timeline
|
63
|
+
export default Timeline
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= pb_rails("flex", props: { justify: "evenly" }) do %>
|
2
2
|
<%= pb_rails("flex/flex_item") do %>
|
3
|
-
<%= pb_rails("timeline", props: {orientation: "vertical",
|
3
|
+
<%= pb_rails("timeline", props: {orientation: "vertical", gap: "xs"}) do %>
|
4
4
|
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
|
5
5
|
<%= pb_rails("body", props: {
|
6
6
|
text: "Conversation started",
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<% end %>
|
24
24
|
|
25
25
|
<%= pb_rails("flex/flex_item") do %>
|
26
|
-
<%= pb_rails("timeline", props: {orientation: "vertical",
|
26
|
+
<%= pb_rails("timeline", props: {orientation: "vertical", gap: "sm"}) do %>
|
27
27
|
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
|
28
28
|
<%= pb_rails("body", props: {
|
29
29
|
text: "Conversation started",
|
@@ -46,7 +46,7 @@
|
|
46
46
|
<% end %>
|
47
47
|
|
48
48
|
<%= pb_rails("flex/flex_item") do %>
|
49
|
-
<%= pb_rails("timeline", props: {orientation: "vertical",
|
49
|
+
<%= pb_rails("timeline", props: {orientation: "vertical", gap: "md"}) do %>
|
50
50
|
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
|
51
51
|
<%= pb_rails("body", props: {
|
52
52
|
text: "Conversation started",
|
@@ -69,7 +69,7 @@
|
|
69
69
|
<% end %>
|
70
70
|
|
71
71
|
<%= pb_rails("flex/flex_item") do %>
|
72
|
-
<%= pb_rails("timeline", props: {orientation: "vertical",
|
72
|
+
<%= pb_rails("timeline", props: {orientation: "vertical", gap: "lg"}) do %>
|
73
73
|
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal"}) do %>
|
74
74
|
<%= pb_rails("body", props: {
|
75
75
|
text: "Conversation started",
|
@@ -91,3 +91,4 @@
|
|
91
91
|
<% end %>
|
92
92
|
<% end %>
|
93
93
|
<% end %>
|
94
|
+
|
@@ -10,7 +10,7 @@ const TimelineWithGap = (props) => (
|
|
10
10
|
<Flex justify="evenly">
|
11
11
|
<FlexItem>
|
12
12
|
<Timeline
|
13
|
-
|
13
|
+
gap="xs"
|
14
14
|
orientation="vertical"
|
15
15
|
>
|
16
16
|
<Timeline.Item
|
@@ -51,7 +51,7 @@ const TimelineWithGap = (props) => (
|
|
51
51
|
</FlexItem>
|
52
52
|
<FlexItem>
|
53
53
|
<Timeline
|
54
|
-
|
54
|
+
gap="sm"
|
55
55
|
orientation="vertical"
|
56
56
|
>
|
57
57
|
<Timeline.Item
|
@@ -92,7 +92,7 @@ const TimelineWithGap = (props) => (
|
|
92
92
|
</FlexItem>
|
93
93
|
<FlexItem>
|
94
94
|
<Timeline
|
95
|
-
|
95
|
+
gap="md"
|
96
96
|
orientation="vertical"
|
97
97
|
>
|
98
98
|
<Timeline.Item
|
@@ -134,7 +134,7 @@ const TimelineWithGap = (props) => (
|
|
134
134
|
</FlexItem>
|
135
135
|
<FlexItem>
|
136
136
|
<Timeline
|
137
|
-
|
137
|
+
gap="lg"
|
138
138
|
orientation="vertical"
|
139
139
|
>
|
140
140
|
<Timeline.Item
|
@@ -1 +1 @@
|
|
1
|
-
Use the optional `
|
1
|
+
Use the optional `gap` prop to render the timeline kit with adjusted spacing between nodes. The `gap` prop will only work when utilized with a vertical timeline. Horizontal timelines will show no difference in spacing.
|
@@ -8,15 +8,15 @@ module Playbook
|
|
8
8
|
default: "horizontal"
|
9
9
|
prop :show_date, type: Playbook::Props::Boolean,
|
10
10
|
default: false
|
11
|
-
prop :
|
12
|
-
|
13
|
-
|
11
|
+
prop :gap, type: Playbook::Props::Enum,
|
12
|
+
values: %w[xs sm md lg none],
|
13
|
+
default: "none"
|
14
14
|
|
15
15
|
def classname
|
16
16
|
generate_classname("pb_timeline_kit",
|
17
17
|
orientation,
|
18
18
|
date_class,
|
19
|
-
|
19
|
+
gap_class)
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
@@ -25,8 +25,8 @@ module Playbook
|
|
25
25
|
show_date ? "with_date" : nil
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
|
28
|
+
def gap_class
|
29
|
+
gap == "none" ? nil : "gap_#{gap}"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -108,10 +108,6 @@ type MinWidth = {
|
|
108
108
|
minWidth?: string,
|
109
109
|
}
|
110
110
|
|
111
|
-
type Gap = {
|
112
|
-
gap?: string,
|
113
|
-
}
|
114
|
-
|
115
111
|
type NumberSpacing = {
|
116
112
|
numberSpacing?: "tabular",
|
117
113
|
}
|
@@ -200,7 +196,7 @@ type MinHeight = {
|
|
200
196
|
export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
201
197
|
BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
|
202
198
|
FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
|
203
|
-
LineHeight & Margin & Width & MinWidth & MaxWidth &
|
199
|
+
LineHeight & Margin & Width & MinWidth & MaxWidth & NumberSpacing & Order & Overflow & Padding &
|
204
200
|
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left & Height & MaxHeight & MinHeight;
|
205
201
|
|
206
202
|
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
@@ -376,11 +372,6 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
376
372
|
css += maxWidth ? `max_width_${filterClassName(maxWidth)} ` : ''
|
377
373
|
return css.trimEnd()
|
378
374
|
},
|
379
|
-
gapProps: ({ gap }: Gap) => {
|
380
|
-
let css = ''
|
381
|
-
css += gap ? `gap_${gap} ` : ''
|
382
|
-
return css.trimEnd()
|
383
|
-
},
|
384
375
|
minHeightProps: ({ minHeight }: MinHeight) => {
|
385
376
|
const heightValues = ["auto", "xs", "sm", "md", "lg", "xl", "xxl", "xxxl"]
|
386
377
|
if (heightValues.includes(minHeight)) {
|
@@ -539,15 +530,15 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
539
530
|
},
|
540
531
|
|
541
532
|
|
542
|
-
topProps: ({top}) => getPositioningPropsClasses('top', top),
|
543
|
-
|
544
|
-
rightProps: ({right}) => getPositioningPropsClasses('right', right),
|
533
|
+
topProps: ({top}) => getPositioningPropsClasses('top', top),
|
545
534
|
|
546
|
-
|
535
|
+
rightProps: ({right}) => getPositioningPropsClasses('right', right),
|
547
536
|
|
537
|
+
bottomProps:({bottom}) => getPositioningPropsClasses('bottom', bottom),
|
538
|
+
|
548
539
|
leftProps: ({left}) => getPositioningPropsClasses('left', left),
|
549
|
-
|
550
|
-
|
540
|
+
|
541
|
+
|
551
542
|
textAlignProps: ({ textAlign }: TextAlign) => {
|
552
543
|
if (typeof textAlign === 'object') {
|
553
544
|
return getResponsivePropClasses(textAlign, 'text_align')
|
@@ -567,7 +558,7 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
567
558
|
|
568
559
|
const PROP_INLINE_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => {[key: string]: any}} = {
|
569
560
|
heightProps: ({ height }: Height) => {
|
570
|
-
return height ? { height } : {};
|
561
|
+
return height ? { height } : {};
|
571
562
|
},
|
572
563
|
|
573
564
|
maxHeightProps: ({ maxHeight }: MaxHeight) => {
|
@@ -575,7 +566,7 @@ const PROP_INLINE_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => {[
|
|
575
566
|
},
|
576
567
|
|
577
568
|
minHeightProps: ({ minHeight }: MinHeight) => {
|
578
|
-
return minHeight ? { minHeight } : {};
|
569
|
+
return minHeight ? { minHeight } : {};
|
579
570
|
},
|
580
571
|
}
|
581
572
|
|