playbook_ui 14.6.0.pre.rc.21 → 14.6.0.pre.rc.23
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 +84 -3
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +8 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +33 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +10 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +34 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +10 -1
- data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.tsx +2 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx +4 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.html.erb +41 -0
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.jsx +71 -0
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_rails.md +1 -0
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_react.md +1 -0
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_filter/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +2 -2
- data/app/pb_kits/playbook/pb_filter/filter.rb +2 -0
- 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 +6 -2
- data/app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_popover/popover.rb +3 -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-BhLGfuVc.js +22 -0
- data/dist/chunks/_weekday_stacked-Cu6ay-kh.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/dist/playbook.css +1 -1
- data/lib/playbook/kit_base.rb +21 -1
- data/lib/playbook/version.rb +1 -1
- metadata +13 -4
- data/dist/chunks/_typeahead-CcgTar9x.js +0 -22
- data/dist/chunks/_weekday_stacked-X5cprPLr.js +0 -45
@@ -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 };
|
@@ -79,6 +79,7 @@ const Popover = (props: PbPopoverProps) => {
|
|
79
79
|
maxWidth,
|
80
80
|
minHeight,
|
81
81
|
minWidth,
|
82
|
+
width,
|
82
83
|
targetId,
|
83
84
|
} = props;
|
84
85
|
|
@@ -97,7 +98,8 @@ const Popover = (props: PbPopoverProps) => {
|
|
97
98
|
maxHeight ? { maxHeight: maxHeight } : {},
|
98
99
|
maxWidth ? { maxWidth: maxWidth } : {},
|
99
100
|
minHeight ? { minHeight: minHeight } : {},
|
100
|
-
minWidth ? { minWidth: minWidth } : {}
|
101
|
+
minWidth ? { minWidth: minWidth } : {},
|
102
|
+
width ? { width: width } : {}
|
101
103
|
);
|
102
104
|
};
|
103
105
|
const ariaProps = buildAriaProps(aria);
|
@@ -167,6 +169,7 @@ const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
|
|
167
169
|
maxWidth,
|
168
170
|
minHeight,
|
169
171
|
minWidth,
|
172
|
+
width,
|
170
173
|
} = props;
|
171
174
|
|
172
175
|
useEffect(() => {
|
@@ -216,6 +219,7 @@ const PbReactPopover = (props: PbPopoverProps): React.ReactElement => {
|
|
216
219
|
placement={placement}
|
217
220
|
referenceElement={referenceElement}
|
218
221
|
targetId={targetId}
|
222
|
+
width={width}
|
219
223
|
zIndex={zIndex}
|
220
224
|
{...props}
|
221
225
|
>
|
@@ -12,6 +12,7 @@ module Playbook
|
|
12
12
|
prop :max_width
|
13
13
|
prop :min_width
|
14
14
|
prop :min_height
|
15
|
+
prop :width
|
15
16
|
prop :z_index, type: Playbook::Props::String
|
16
17
|
prop :offset, type: Playbook::Props::Boolean, default: false
|
17
18
|
prop :close_on_click, type: Playbook::Props::Enum,
|
@@ -36,11 +37,12 @@ module Playbook
|
|
36
37
|
out += "max-width: #{max_width}; " if max_width.present?
|
37
38
|
out += "min-height: #{min_height}; " if min_height.present?
|
38
39
|
out += "min-width: #{min_width};" if min_width.present?
|
40
|
+
out += "width: #{width};" if width.present?
|
39
41
|
out
|
40
42
|
end
|
41
43
|
|
42
44
|
def width_height_class_helper
|
43
|
-
"overflow_handling" if max_height || max_width
|
45
|
+
"overflow_handling" if max_height || max_width || width
|
44
46
|
end
|
45
47
|
|
46
48
|
def data
|
@@ -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') {
|