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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_card/_card.tsx +5 -1
  3. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
  4. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +84 -3
  5. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +8 -1
  6. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +9 -0
  7. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +33 -0
  8. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +10 -0
  9. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +34 -0
  10. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -0
  11. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +4 -0
  12. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -0
  13. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +10 -1
  14. data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.tsx +2 -0
  15. data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -0
  16. data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx +4 -1
  17. data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.html.erb +41 -0
  18. data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.jsx +71 -0
  19. data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_rails.md +1 -0
  20. data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_react.md +1 -0
  21. data/app/pb_kits/playbook/pb_filter/docs/example.yml +3 -0
  22. data/app/pb_kits/playbook/pb_filter/docs/index.js +1 -0
  23. data/app/pb_kits/playbook/pb_filter/filter.html.erb +2 -2
  24. data/app/pb_kits/playbook/pb_filter/filter.rb +2 -0
  25. data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
  26. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
  27. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
  28. data/app/pb_kits/playbook/pb_flex/flex_item.rb +7 -2
  29. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -2
  30. data/app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb +1 -1
  31. data/app/pb_kits/playbook/pb_popover/popover.rb +3 -1
  32. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +3 -0
  33. data/app/pb_kits/playbook/utilities/globalProps.ts +39 -2
  34. data/dist/chunks/_typeahead-BhLGfuVc.js +22 -0
  35. data/dist/chunks/_weekday_stacked-Cu6ay-kh.js +45 -0
  36. data/dist/chunks/vendor.js +1 -1
  37. data/dist/playbook-doc.js +1 -1
  38. data/dist/playbook-rails-react-bindings.js +1 -1
  39. data/dist/playbook-rails.js +1 -1
  40. data/dist/playbook.css +1 -1
  41. data/lib/playbook/kit_base.rb +21 -1
  42. data/lib/playbook/version.rb +1 -1
  43. metadata +13 -4
  44. data/dist/chunks/_typeahead-CcgTar9x.js +0 -22
  45. 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={fixedStyle}
51
+ style={combinedStyles}
46
52
  >
47
53
  {children}
48
54
  </div>
@@ -1,8 +1,5 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname,
5
- style: object.style_value,
6
- **combined_html_options) do %>
1
+ <%= pb_content_tag(:div,
2
+ style: object.inline_styles
3
+ ) do %>
7
4
  <%= content.presence %>
8
5
  <% end %>
@@ -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 style_value
24
- "flex-basis: #{fixed_size};" if fixed_size.present?
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
  >
@@ -14,7 +14,7 @@
14
14
  trigger_element_id: "regular-popover-1",
15
15
  tooltip_id: "tooltip-1",
16
16
  offset: true,
17
- position: "top"
17
+ position: "top",
18
18
  }) do %>
19
19
  I'm a popover. I can show content of any size.
20
20
  <% end %>
@@ -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
@@ -1,4 +1,7 @@
1
1
  export default [
2
+ "minHeight",
3
+ "maxHeight",
4
+ "height",
2
5
  "left",
3
6
  "bottom",
4
7
  "right",
@@ -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') {