playbook_ui 14.7.0.pre.rc.18 → 14.7.0.pre.rc.19
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 +11 -4
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -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-DhLic2Fe.js +22 -0
- data/dist/chunks/_weekday_stacked-Mx8TYP5I.js +45 -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/lib/playbook/kit_base.rb +43 -5
- data/lib/playbook/version.rb +1 -1
- metadata +3 -3
- data/dist/chunks/_typeahead-5m7Pr_Rh.js +0 -22
- data/dist/chunks/_weekday_stacked-Bu2Zfe7P.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60f5cff6912e2865399cef73254a7b2dc0c44d6569424298bb634f68f32379cd
|
4
|
+
data.tar.gz: 83369d0166a9aa85827c3df19ed00880ad84d6b258c03dc2ff48f2de41c05c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d9fc03ccd849622b9f5cc1bc47deb85a9733c42fbc986ebe01c3bdcc7ce7446a70f2c21f9da2da2bb3335ba826da717f76b1ccc8a9f5ef8e7aecd2414cb4bf4
|
7
|
+
data.tar.gz: 3f2825d50037ea12633a8ad29a02769e85796681ed3fbaa63b846384e8c50a99fafdaa78eb7bdaea4c20a88379d165d9b94d3f251458f2ab2c8b48c18ce9a2f2
|
@@ -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,10 @@ 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);
|
112
|
+
const { style: htmlStyle = {}, ...restHtmlProps } = htmlProps as { style?: React.CSSProperties };
|
113
|
+
const mergedStyles: React.CSSProperties = { ...htmlStyle, ...dynamicInlineProps };
|
114
|
+
|
110
115
|
|
111
116
|
const subComponentTags = (tagName: string) => {
|
112
117
|
return cardChildren.filter((c: string) => (
|
@@ -122,7 +127,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
122
127
|
|
123
128
|
const tagOptions = ['div', 'section', 'footer', 'header', 'article', 'aside', 'main', 'nav']
|
124
129
|
const Tag = tagOptions.includes(tag) ? tag : 'div'
|
125
|
-
|
130
|
+
|
126
131
|
return (
|
127
132
|
<>
|
128
133
|
{
|
@@ -133,8 +138,9 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
133
138
|
<Tag
|
134
139
|
{...ariaProps}
|
135
140
|
{...dataProps}
|
136
|
-
{...htmlProps}
|
137
141
|
className={classnames(cardCss, globalProps(props), className)}
|
142
|
+
{...restHtmlProps}
|
143
|
+
style={mergedStyles}
|
138
144
|
>
|
139
145
|
{subComponentTags('Header')}
|
140
146
|
{
|
@@ -161,8 +167,9 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
161
167
|
<Tag
|
162
168
|
{...ariaProps}
|
163
169
|
{...dataProps}
|
164
|
-
{...htmlProps}
|
165
170
|
className={classnames(cardCss, globalProps(props), className)}
|
171
|
+
{...restHtmlProps}
|
172
|
+
style={mergedStyles}
|
166
173
|
>
|
167
174
|
{subComponentTags('Header')}
|
168
175
|
{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"
|
@@ -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 };
|
@@ -174,12 +174,24 @@ type ZIndex = {
|
|
174
174
|
zIndex?: ZIndexType,
|
175
175
|
} | ZIndexResponsiveType
|
176
176
|
|
177
|
+
type Height = {
|
178
|
+
height?: string
|
179
|
+
}
|
180
|
+
|
181
|
+
type MaxHeight = {
|
182
|
+
maxHeight?: string
|
183
|
+
}
|
184
|
+
|
185
|
+
type MinHeight = {
|
186
|
+
minHeight?: string
|
187
|
+
}
|
188
|
+
|
177
189
|
// keep this as the last type definition
|
178
190
|
export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
179
191
|
BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
|
180
192
|
FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
|
181
193
|
LineHeight & Margin & MinWidth & MaxWidth & NumberSpacing & Order & Overflow & Padding &
|
182
|
-
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex &
|
194
|
+
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left & Height & MaxHeight & MinHeight;
|
183
195
|
|
184
196
|
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
185
197
|
const keys: string[] = Object.keys(prop)
|
@@ -503,7 +515,22 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
503
515
|
} else {
|
504
516
|
return verticalAlign ? `vertical_align_${verticalAlign} ` : ''
|
505
517
|
}
|
506
|
-
}
|
518
|
+
},
|
519
|
+
|
520
|
+
}
|
521
|
+
|
522
|
+
const PROP_INLINE_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => {[key: string]: any}} = {
|
523
|
+
heightProps: ({ height }: Height) => {
|
524
|
+
return height ? { height } : {};
|
525
|
+
},
|
526
|
+
|
527
|
+
maxHeightProps: ({ maxHeight }: MaxHeight) => {
|
528
|
+
return maxHeight ? { maxHeight } : {};
|
529
|
+
},
|
530
|
+
|
531
|
+
minHeightProps: ({ minHeight }: MinHeight) => {
|
532
|
+
return minHeight ? { minHeight } : {};
|
533
|
+
},
|
507
534
|
}
|
508
535
|
|
509
536
|
type DefaultProps = {[key: string]: string} | Record<string, unknown>
|
@@ -515,6 +542,16 @@ export const globalProps = (props: GlobalProps, defaultProps: DefaultProps = {})
|
|
515
542
|
}).filter((value) => value?.length > 0).join(" ")
|
516
543
|
}
|
517
544
|
|
545
|
+
// New function for inline styles
|
546
|
+
export const globalInlineProps = (props: GlobalProps): React.CSSProperties => {
|
547
|
+
const styles = Object.keys(PROP_INLINE_CATEGORIES).reduce((acc, key) => {
|
548
|
+
const result = PROP_INLINE_CATEGORIES[key](props);
|
549
|
+
return { ...acc, ...(typeof result === 'object' ? result : {}) }; // Ensure result is an object before spreading
|
550
|
+
}, {});
|
551
|
+
|
552
|
+
return styles; // Return the styles object directly
|
553
|
+
}
|
554
|
+
|
518
555
|
|
519
556
|
export const deprecatedProps = (): void => {
|
520
557
|
// if (process.env.NODE_ENV === 'development') {
|