playbook_ui 14.6.2 → 14.7.0.pre.rc.0
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/pb_card/_card.tsx +5 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +4 -4
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +3 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +2 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
- data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +7 -2
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +3 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +39 -2
- data/dist/chunks/_typeahead-BhHnXJjy.js +22 -0
- data/dist/chunks/{_weekday_stacked-Cy__g00H.js → _weekday_stacked-C_QAqbqJ.js} +2 -2
- data/dist/chunks/lazysizes-B7xYodB-.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/kit_base.rb +21 -1
- data/lib/playbook/version.rb +2 -2
- metadata +8 -8
- data/dist/chunks/_typeahead-BV_n6U5W.js +0 -22
- data/dist/chunks/lazysizes-DHz07jlL.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: 656e9e66e2df384c9f3d9ad833d269551418aa20f70c3e8cb4b8b017ce1b2db1
|
4
|
+
data.tar.gz: 28c337d7bd834f0d8448010014dc8bbbab8162f02ee5afe95cd8caacc250aee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6578a809aafafb0bbe3be5e2ad11701e14dc359fb34d4157153a1909fc6d06ca9b3ac9c98461a7205bd9f3565d51fa626b64500fcea13b55d79302c9e011f7b0
|
7
|
+
data.tar.gz: 598e947939ac29bdc05f48871d9a63d41295836bc44cf225a3374a1c72c6f92e13c9e684b26d26ba9d04095b50a126dac0d79f4e322c54470021efbe51b29ce5
|
@@ -5,7 +5,7 @@ import { get } from 'lodash'
|
|
5
5
|
import classnames from 'classnames'
|
6
6
|
|
7
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
8
|
-
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
8
|
+
import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
|
9
9
|
import type { ProductColors, CategoryColors, BackgroundColors } from '../types/colors'
|
10
10
|
|
11
11
|
import Icon from '../pb_icon/_icon'
|
@@ -49,6 +49,7 @@ type CardBodyProps = {
|
|
49
49
|
padding?: string,
|
50
50
|
} & GlobalProps
|
51
51
|
|
52
|
+
|
52
53
|
// Header component
|
53
54
|
const Header = (props: CardHeaderProps) => {
|
54
55
|
const { children, className, headerColor = 'category_1', headerColorStriped = false } = props
|
@@ -107,6 +108,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
107
108
|
|
108
109
|
// coerce to array
|
109
110
|
const cardChildren = React.Children.toArray(children)
|
111
|
+
const dynamicInlineProps = globalInlineProps(props);
|
110
112
|
|
111
113
|
const subComponentTags = (tagName: string) => {
|
112
114
|
return cardChildren.filter((c: string) => (
|
@@ -135,6 +137,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
135
137
|
{...dataProps}
|
136
138
|
{...htmlProps}
|
137
139
|
className={classnames(cardCss, globalProps(props), className)}
|
140
|
+
style={dynamicInlineProps}
|
138
141
|
>
|
139
142
|
{subComponentTags('Header')}
|
140
143
|
{
|
@@ -163,6 +166,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
163
166
|
{...dataProps}
|
164
167
|
{...htmlProps}
|
165
168
|
className={classnames(cardCss, globalProps(props), className)}
|
169
|
+
style={dynamicInlineProps}
|
166
170
|
>
|
167
171
|
{subComponentTags('Header')}
|
168
172
|
{nonHeaderChildren}
|
@@ -6,7 +6,7 @@ import classnames from "classnames";
|
|
6
6
|
import Modal from "react-modal";
|
7
7
|
|
8
8
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
9
|
-
import { globalProps } from "../utilities/globalProps";
|
9
|
+
import { globalProps, globalInlineProps } from "../utilities/globalProps";
|
10
10
|
|
11
11
|
import Body from "../pb_body/_body";
|
12
12
|
import Button from "../pb_button/_button";
|
@@ -91,6 +91,8 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
91
91
|
beforeClose: "pb_dialog_overlay_before_close",
|
92
92
|
};
|
93
93
|
|
94
|
+
const dynamicInlineProps = globalInlineProps(props);
|
95
|
+
|
94
96
|
const classes = classnames(
|
95
97
|
buildCss("pb_dialog_wrapper"),
|
96
98
|
globalProps(props),
|
@@ -184,6 +186,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
184
186
|
overlayClassName={overlayClassNames}
|
185
187
|
portalClassName={portalClassName}
|
186
188
|
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick && !loading}
|
189
|
+
style={{ content: dynamicInlineProps }}
|
187
190
|
>
|
188
191
|
<>
|
189
192
|
{title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
|
@@ -192,6 +195,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
192
195
|
<Dialog.Body
|
193
196
|
className="dialog_status_text_align"
|
194
197
|
padding="md"
|
198
|
+
|
195
199
|
>
|
196
200
|
<Flex align="center"
|
197
201
|
orientation="column"
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
@import "./scss_partials/dropdown_animation";
|
11
11
|
|
12
|
-
|
12
|
+
.pb_dropdown {
|
13
13
|
.dropdown_wrapper {
|
14
14
|
[class*="dropdown_trigger_wrapper"] {
|
15
15
|
@include pb_body;
|
@@ -131,7 +131,7 @@
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
|
134
|
-
|
134
|
+
&.separators_hidden {
|
135
135
|
.dropdown_wrapper {
|
136
136
|
.pb_dropdown_container {
|
137
137
|
|
@@ -142,7 +142,7 @@
|
|
142
142
|
}
|
143
143
|
}
|
144
144
|
|
145
|
-
|
145
|
+
&.subtle {
|
146
146
|
.dropdown_wrapper {
|
147
147
|
.pb_dropdown_container {
|
148
148
|
|
@@ -178,7 +178,7 @@
|
|
178
178
|
}
|
179
179
|
}
|
180
180
|
|
181
|
-
|
181
|
+
&.separators_hidden {
|
182
182
|
.dropdown_wrapper {
|
183
183
|
.pb_dropdown_container {
|
184
184
|
[class*="pb_dropdown_option"]:first-child {
|
@@ -74,8 +74,10 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
74
74
|
const htmlProps = buildHtmlProps(htmlOptions);
|
75
75
|
const separatorsClass = separators ? '' : 'separators_hidden'
|
76
76
|
const classes = classnames(
|
77
|
-
buildCss("pb_dropdown"
|
77
|
+
buildCss("pb_dropdown"),
|
78
78
|
globalProps(props),
|
79
|
+
variant,
|
80
|
+
separatorsClass,
|
79
81
|
className
|
80
82
|
);
|
81
83
|
|
@@ -24,7 +24,7 @@ module Playbook
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def classname
|
27
|
-
generate_classname("pb_dropdown", variant, separators_class)
|
27
|
+
generate_classname("pb_dropdown", variant, separators_class, separator: " ")
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
@@ -38,7 +38,7 @@ module Playbook
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def separators_class
|
41
|
-
separators ?
|
41
|
+
separators ? "" : "separators_hidden"
|
42
42
|
end
|
43
43
|
|
44
44
|
def options_with_blank
|
@@ -50,7 +50,7 @@ test('generated default kit and classname', () => {
|
|
50
50
|
|
51
51
|
const kit = screen.getByTestId(testId)
|
52
52
|
expect(kit).toBeInTheDocument()
|
53
|
-
expect(kit).toHaveClass('
|
53
|
+
expect(kit).toHaveClass('pb_dropdown')
|
54
54
|
})
|
55
55
|
|
56
56
|
test('generated default Trigger and Container when none passed in', () => {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import { buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
4
|
-
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
4
|
+
import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
|
5
5
|
import { GenericObject, Sizes } from '../types'
|
6
6
|
|
7
7
|
type FlexProps = {
|
@@ -61,6 +61,7 @@ const Flex = (props: FlexProps): React.ReactElement => {
|
|
61
61
|
const alignSelfClass = alignSelf !== 'none' ? `align_self_${alignSelf}` : ''
|
62
62
|
const dataProps = buildDataProps(data)
|
63
63
|
const htmlProps = buildHtmlProps(htmlOptions)
|
64
|
+
const dynamicInlineProps = globalInlineProps(props)
|
64
65
|
|
65
66
|
|
66
67
|
return (
|
@@ -83,6 +84,7 @@ const Flex = (props: FlexProps): React.ReactElement => {
|
|
83
84
|
globalProps(props),
|
84
85
|
className
|
85
86
|
)}
|
87
|
+
style={dynamicInlineProps}
|
86
88
|
{...dataProps}
|
87
89
|
{...htmlProps}
|
88
90
|
>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import { buildCss, buildHtmlProps } from '../utilities/props'
|
4
|
-
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
4
|
+
import { globalProps, GlobalProps, globalInlineProps} from '../utilities/globalProps'
|
5
5
|
type FlexItemPropTypes = {
|
6
6
|
children: React.ReactNode[] | React.ReactNode,
|
7
7
|
fixedSize?: string,
|
@@ -35,14 +35,20 @@ const FlexItem = (props: FlexItemPropTypes): React.ReactElement => {
|
|
35
35
|
const fixedStyle =
|
36
36
|
fixedSize !== undefined ? { flexBasis: `${fixedSize}` } : null
|
37
37
|
const orderClass = order !== 'none' ? `order_${order}` : null
|
38
|
+
const dynamicInlineProps = globalInlineProps(props)
|
39
|
+
const combinedStyles = {
|
40
|
+
...fixedStyle,
|
41
|
+
...dynamicInlineProps
|
42
|
+
}
|
38
43
|
|
39
44
|
const htmlProps = buildHtmlProps(htmlOptions)
|
40
45
|
|
46
|
+
|
41
47
|
return (
|
42
48
|
<div
|
43
49
|
{...htmlProps}
|
44
50
|
className={classnames(buildCss('pb_flex_item_kit', growClass, shrinkClass, flexClass, displayFlexClass), orderClass, alignSelfClass, globalProps(props), className)}
|
45
|
-
style={
|
51
|
+
style={combinedStyles}
|
46
52
|
>
|
47
53
|
{children}
|
48
54
|
</div>
|
@@ -20,8 +20,13 @@ module Playbook
|
|
20
20
|
generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, display_flex_class) + align_self_class
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
23
|
+
def inline_styles
|
24
|
+
styles = []
|
25
|
+
styles << "flex-basis: #{fixed_size};" if fixed_size.present?
|
26
|
+
styles << "height: #{height};" if height.present?
|
27
|
+
styles << "min-height: #{min_height};" if min_height.present?
|
28
|
+
styles << "max-height: #{max_height};" if max_height.present?
|
29
|
+
styles.join(" ")
|
25
30
|
end
|
26
31
|
|
27
32
|
private
|
@@ -21,7 +21,7 @@ import classnames from "classnames";
|
|
21
21
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
22
22
|
import { uniqueId } from 'lodash';
|
23
23
|
|
24
|
-
type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth'>
|
24
|
+
type ModifiedGlobalProps = Omit<GlobalProps, 'minWidth' | 'maxHeight' | 'minHeight'>
|
25
25
|
|
26
26
|
type PbPopoverProps = {
|
27
27
|
aria?: { [key: string]: string };
|
@@ -170,12 +170,24 @@ type ZIndex = {
|
|
170
170
|
zIndex?: ZIndexType,
|
171
171
|
} | ZIndexResponsiveType
|
172
172
|
|
173
|
+
type Height = {
|
174
|
+
height?: string
|
175
|
+
}
|
176
|
+
|
177
|
+
type MaxHeight = {
|
178
|
+
maxHeight?: string
|
179
|
+
}
|
180
|
+
|
181
|
+
type MinHeight = {
|
182
|
+
minHeight?: string
|
183
|
+
}
|
184
|
+
|
173
185
|
// keep this as the last type definition
|
174
186
|
export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
175
187
|
BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
|
176
188
|
FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
|
177
189
|
LineHeight & Margin & MinWidth & MaxWidth & NumberSpacing & Order & Overflow & Padding &
|
178
|
-
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left;
|
190
|
+
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left & Height & MaxHeight & MinHeight;
|
179
191
|
|
180
192
|
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
181
193
|
const keys: string[] = Object.keys(prop)
|
@@ -498,7 +510,22 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
498
510
|
} else {
|
499
511
|
return verticalAlign ? `vertical_align_${verticalAlign} ` : ''
|
500
512
|
}
|
501
|
-
}
|
513
|
+
},
|
514
|
+
|
515
|
+
}
|
516
|
+
|
517
|
+
const PROP_INLINE_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => {[key: string]: any}} = {
|
518
|
+
heightProps: ({ height }: Height) => {
|
519
|
+
return height ? { height } : {};
|
520
|
+
},
|
521
|
+
|
522
|
+
maxHeightProps: ({ maxHeight }: MaxHeight) => {
|
523
|
+
return maxHeight ? { maxHeight } : {};
|
524
|
+
},
|
525
|
+
|
526
|
+
minHeightProps: ({ minHeight }: MinHeight) => {
|
527
|
+
return minHeight ? { minHeight } : {};
|
528
|
+
},
|
502
529
|
}
|
503
530
|
|
504
531
|
type DefaultProps = {[key: string]: string} | Record<string, unknown>
|
@@ -510,6 +537,16 @@ export const globalProps = (props: GlobalProps, defaultProps: DefaultProps = {})
|
|
510
537
|
}).filter((value) => value?.length > 0).join(" ")
|
511
538
|
}
|
512
539
|
|
540
|
+
// New function for inline styles
|
541
|
+
export const globalInlineProps = (props: GlobalProps): React.CSSProperties => {
|
542
|
+
const styles = Object.keys(PROP_INLINE_CATEGORIES).reduce((acc, key) => {
|
543
|
+
const result = PROP_INLINE_CATEGORIES[key](props);
|
544
|
+
return { ...acc, ...(typeof result === 'object' ? result : {}) }; // Ensure result is an object before spreading
|
545
|
+
}, {});
|
546
|
+
|
547
|
+
return styles; // Return the styles object directly
|
548
|
+
}
|
549
|
+
|
513
550
|
|
514
551
|
export const deprecatedProps = (): void => {
|
515
552
|
// if (process.env.NODE_ENV === 'development') {
|