playbook_ui 14.6.0.pre.rc.22 → 14.6.0.pre.rc.24
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_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-zSOq3vHv.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 +21 -1
- data/lib/playbook/version.rb +1 -1
- metadata +7 -3
- data/dist/chunks/_typeahead-CcgTar9x.js +0 -22
- data/dist/chunks/_weekday_stacked-NAZZNhRD.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: 928cafa369cb0ff74b41eb78c269fdab06400c7d689d022114eb625f6f28d5b0
|
4
|
+
data.tar.gz: cbf6ce4ee5e787dcb3311eab7cc6d5337c2c666e7779c5345d67b143941d28a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62e92f8c3ef376657d4772f7f4cf0f2e417e50b8038f91f983cb7db4a6db0785539e4a48af96dc5256d942ab3524eebe9af447d16c6ad8ed5c2eb0c5e06021db
|
7
|
+
data.tar.gz: b6b5ecca925ea33641228523b3ec48dd4be5e1ad3b89de0ce3504e061ff7223d6c82d846bc0353af8c0e1dea401109ec28dc7639322db348bf13a38c377d0315
|
@@ -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"
|
@@ -34,6 +34,7 @@ const FilterDouble = ({
|
|
34
34
|
maxHeight,
|
35
35
|
minWidth,
|
36
36
|
placement,
|
37
|
+
popoverProps,
|
37
38
|
...bgProps
|
38
39
|
}: FilterDoubleProps): React.ReactElement => (
|
39
40
|
<FilterBackground
|
@@ -49,6 +50,7 @@ const FilterDouble = ({
|
|
49
50
|
maxHeight={maxHeight}
|
50
51
|
minWidth={minWidth}
|
51
52
|
placement={placement}
|
53
|
+
popoverProps={popoverProps}
|
52
54
|
>
|
53
55
|
{children}
|
54
56
|
</FiltersPopover>
|
@@ -33,6 +33,7 @@ const FilterSingle = ({
|
|
33
33
|
maxHeight,
|
34
34
|
minWidth,
|
35
35
|
placement,
|
36
|
+
popoverProps,
|
36
37
|
...bgProps
|
37
38
|
}: FilterSingleProps): React.ReactElement => {
|
38
39
|
return (
|
@@ -52,6 +53,7 @@ const FilterSingle = ({
|
|
52
53
|
maxHeight={maxHeight}
|
53
54
|
minWidth={minWidth}
|
54
55
|
placement={placement}
|
56
|
+
popoverProps={popoverProps}
|
55
57
|
>
|
56
58
|
{children}
|
57
59
|
</FiltersPopover>
|
@@ -2,6 +2,7 @@ import React, { ReactNode, useState } from 'react'
|
|
2
2
|
|
3
3
|
import CircleIconButton from '../../pb_circle_icon_button/_circle_icon_button'
|
4
4
|
import PbReactPopover from '../../pb_popover/_popover'
|
5
|
+
import { GenericObject } from '../../types'
|
5
6
|
|
6
7
|
type FiltersPopoverProps = {
|
7
8
|
children?: React.ReactChild[] | React.ReactChild | (({closePopover}: {closePopover: () => void}) => ReactNode),
|
@@ -9,8 +10,9 @@ type FiltersPopoverProps = {
|
|
9
10
|
maxHeight?: string,
|
10
11
|
minWidth?: string,
|
11
12
|
placement?: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end",
|
13
|
+
popoverProps?: GenericObject,
|
12
14
|
}
|
13
|
-
const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bottom-start" }: FiltersPopoverProps): React.ReactElement => {
|
15
|
+
const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bottom-start", popoverProps }: FiltersPopoverProps): React.ReactElement => {
|
14
16
|
const [hide, updateHide] = useState(true)
|
15
17
|
const toggle = () => updateHide(!hide)
|
16
18
|
|
@@ -33,6 +35,7 @@ const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bott
|
|
33
35
|
reference={filterButton}
|
34
36
|
shouldClosePopover={updateHide}
|
35
37
|
show={!hide}
|
38
|
+
{...popoverProps}
|
36
39
|
>
|
37
40
|
<div className="pb-form">
|
38
41
|
{typeof children === 'function'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<%=
|
2
|
+
pb_rails("filter", props: {
|
3
|
+
id: "filter_popover_props",
|
4
|
+
position: "top",
|
5
|
+
filters: [
|
6
|
+
{ name: "name", value: "John Wick" },
|
7
|
+
{ name: "city", value: "San Francisco"}
|
8
|
+
],
|
9
|
+
sort_menu: [
|
10
|
+
{ item: "Popularity", link: "?q[sorts]=managers_popularity+asc", active: true, direction: "desc" },
|
11
|
+
{ item: "Mananger's Title", link: "?q[sorts]=managers_title+asc", active: false },
|
12
|
+
{ item: "Manager's Name", link: "?q[sorts]=managers_name+asc", active: false },
|
13
|
+
],
|
14
|
+
template: "default",
|
15
|
+
results: 1,
|
16
|
+
popover_props: { width: "250px" },
|
17
|
+
}) do
|
18
|
+
%>
|
19
|
+
<%
|
20
|
+
example_collection = [
|
21
|
+
OpenStruct.new(name: "USA", value: 1),
|
22
|
+
OpenStruct.new(name: "Canada", value: 2),
|
23
|
+
OpenStruct.new(name: "Brazil", value: 3),
|
24
|
+
OpenStruct.new(name: "Philippines", value: 4),
|
25
|
+
OpenStruct.new(name: "A galaxy far far away, like really far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far away...", value: 5)
|
26
|
+
]
|
27
|
+
%>
|
28
|
+
<%= pb_rails("form", props: { form_system_options: { scope: :example, method: :get } }) do |form| %>
|
29
|
+
<%= form.text_field :example_text_field, props: { label: true } %>
|
30
|
+
<%= form.collection_select :example_collection_select, example_collection, :value, :name, props: {max_width: "sm", label: true } %>
|
31
|
+
|
32
|
+
<%= form.actions do |action| %>
|
33
|
+
<%= action.submit props: {
|
34
|
+
text: "Apply",
|
35
|
+
data: {
|
36
|
+
disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
|
37
|
+
},}%>
|
38
|
+
<%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
41
|
+
<% end %>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Button, Filter, Flex, Select, TextInput } from 'playbook-ui'
|
3
|
+
|
4
|
+
const FilterPopoverProps = (props) => {
|
5
|
+
const options = [
|
6
|
+
{ value: 'USA' },
|
7
|
+
{ value: 'Canada' },
|
8
|
+
{ value: 'Brazil' },
|
9
|
+
{ value: 'Philippines' },
|
10
|
+
{ value: 'A galaxy far far away, like really far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far away...' },
|
11
|
+
]
|
12
|
+
|
13
|
+
const popoverProps = {
|
14
|
+
width: "250px"
|
15
|
+
}
|
16
|
+
|
17
|
+
return (
|
18
|
+
<Filter
|
19
|
+
{...props}
|
20
|
+
double
|
21
|
+
filters={{
|
22
|
+
'Full Name': 'John Wick',
|
23
|
+
'City': 'San Francisco',
|
24
|
+
}}
|
25
|
+
popoverProps={popoverProps}
|
26
|
+
results={1}
|
27
|
+
sortOptions={{
|
28
|
+
popularity: 'Popularity',
|
29
|
+
// eslint-disable-next-line
|
30
|
+
manager_title: 'Manager\'s Title',
|
31
|
+
// eslint-disable-next-line
|
32
|
+
manager_name: 'Manager\'s Name',
|
33
|
+
}}
|
34
|
+
sortValue={[{ name: 'popularity', dir: 'desc' }]}
|
35
|
+
>
|
36
|
+
{({ closePopover }) => (
|
37
|
+
<form>
|
38
|
+
<TextInput
|
39
|
+
label="Example Text Field"
|
40
|
+
placeholder="Enter Text"
|
41
|
+
{...props}
|
42
|
+
/>
|
43
|
+
<Select
|
44
|
+
blankSelection="Select One..."
|
45
|
+
label="Example Collection Select"
|
46
|
+
name="Collection Select"
|
47
|
+
options={options}
|
48
|
+
{...props}
|
49
|
+
/>
|
50
|
+
<Flex
|
51
|
+
spacing="between"
|
52
|
+
{...props}
|
53
|
+
>
|
54
|
+
<Button
|
55
|
+
onClick={closePopover}
|
56
|
+
text="Apply"
|
57
|
+
{...props}
|
58
|
+
/>
|
59
|
+
<Button
|
60
|
+
text="Clear"
|
61
|
+
variant="secondary"
|
62
|
+
{...props}
|
63
|
+
/>
|
64
|
+
</Flex>
|
65
|
+
</form>
|
66
|
+
)}
|
67
|
+
</Filter>
|
68
|
+
)
|
69
|
+
}
|
70
|
+
|
71
|
+
export default FilterPopoverProps
|
@@ -0,0 +1 @@
|
|
1
|
+
This kit uses the [Popover kit](https://playbook.powerapp.cloud/kits/popover) under the hood for the Filter Popover which comes with its own set of props. If you want to apply certain Popover props to that underlying kit, you can do so by using the optional `popover_props` prop. This prop must be an object that contains valid Popover props. For a full list of Popover props, see [here](https://playbook.powerapp.cloud/kits/popover).
|
@@ -0,0 +1 @@
|
|
1
|
+
This kit uses the [Popover kit](https://playbook.powerapp.cloud/kits/popover/react) under the hood for the Filter Popover which comes with its own set of props. If you want to apply certain Popover props to that underlying kit, you can do so by using the optional `popoverProps` prop. This prop must be an object that contains valid Popover props. For a full list of Popover props, see [here](https://playbook.powerapp.cloud/kits/popover/react).
|
@@ -10,6 +10,7 @@ examples:
|
|
10
10
|
- filter_max_width: Max Width for Popover Inside of Filter
|
11
11
|
- filter_max_height: Max Height for Popover Inside of Filter
|
12
12
|
- filter_placement: Filter Placement
|
13
|
+
- filter_popover_props: Popover Props
|
13
14
|
|
14
15
|
react:
|
15
16
|
- filter_default: Default
|
@@ -21,3 +22,5 @@ examples:
|
|
21
22
|
- filter_max_width: Max Width for Popover Inside of Filter
|
22
23
|
- filter_max_height: Max Height for Popover Inside of Filter
|
23
24
|
- filter_placement: Filter Placement
|
25
|
+
- filter_popover_props: Popover Props
|
26
|
+
|
@@ -7,3 +7,4 @@ export { default as SortOnly } from './_sort_only.jsx'
|
|
7
7
|
export { default as FilterMaxWidth } from './_filter_max_width.jsx'
|
8
8
|
export { default as FilterMaxHeight } from './_filter_max_height.jsx'
|
9
9
|
export { default as FilterPlacement } from './_filter_placement.jsx'
|
10
|
+
export { default as FilterPopoverProps } from './_filter_popover_props.jsx'
|
@@ -71,13 +71,13 @@
|
|
71
71
|
<% end %>
|
72
72
|
|
73
73
|
<% if object.template != "sort_only"%>
|
74
|
-
<%= pb_rails("popover", props: {max_height: object.max_height, min_width: object.min_width, close_on_click: "outside", trigger_element_id: "filter#{object.id}", tooltip_id: "filter-form#{object.id}", position: object.placement }) do %>
|
74
|
+
<%= pb_rails("popover", props: {max_height: object.max_height, min_width: object.min_width, close_on_click: "outside", trigger_element_id: "filter#{object.id}", tooltip_id: "filter-form#{object.id}", position: object.placement }.merge(object.popover_props)) do %>
|
75
75
|
<%= content %>
|
76
76
|
<% end %>
|
77
77
|
<%end%>
|
78
78
|
|
79
79
|
<% if object.template != "filter_only"%>
|
80
|
-
<%= pb_rails("popover", props: {max_height: object.max_height, classname: "pb_filter_sort_menu", close_on_click: "outside", trigger_element_id: "sort-button#{object.id}", tooltip_id: "sort-filter-btn-tooltip#{object.id}", position: object.placement , padding: 'none'}) do %>
|
80
|
+
<%= pb_rails("popover", props: {max_height: object.max_height, classname: "pb_filter_sort_menu", close_on_click: "outside", trigger_element_id: "sort-button#{object.id}", tooltip_id: "sort-filter-btn-tooltip#{object.id}", position: object.placement , padding: 'none'}.merge(object.popover_props)) do %>
|
81
81
|
<%= pb_rails("list") do %>
|
82
82
|
<% object.sort_menu.each do |item| %>
|
83
83
|
<%= pb_rails("list/item") do%> <%= pb_rails("button", props: {variant: "link" ,classname: "p-0", text: item[:item], link: item[:link]}) %><% end %>
|
@@ -15,6 +15,8 @@ module Playbook
|
|
15
15
|
prop :placement, type: Playbook::Props::Enum,
|
16
16
|
values: %w[top bottom left right top-start top-end bottom-start bottom-end right-start right-end left-start left-end],
|
17
17
|
default: "bottom-start"
|
18
|
+
prop :popover_props, type: Playbook::Props::HashProp,
|
19
|
+
default: {}
|
18
20
|
|
19
21
|
def classname
|
20
22
|
generate_classname("pb_filter_kit").rstrip
|
@@ -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 };
|
@@ -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') {
|