playbook_ui 10.25.0 → 10.26.0.pre.alpha3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5787076b1b4c285e67e4c71a89d98b6c78768fb2ed6fb92500a53a9b336eff2b
4
- data.tar.gz: 9f83e659e948d30274f39cb02b6806c620a7cfa44aaab529481e8a1bd29c1f8f
3
+ metadata.gz: eec4050a38ffdbc91288fa4d1ebe864edc0485bf814f1569b50a4df569e6c666
4
+ data.tar.gz: 5967691eccad475c60406d60b9aca79ee520a2736bfde034b48e6db8c1de3316
5
5
  SHA512:
6
- metadata.gz: a8d3751c1bf0bd5fd88870161c5f92ed1437007b3931d422e86206bb46e437aa285d18289817e7304d0ad7cd23b8889c8cbb9b4e51be3e63f316ea817f67bb8e
7
- data.tar.gz: d64982803deee6c1a08c949ca493d7fc74b4e8b56047190df2d1fc98c1db9922f8a95066cd63897430150da2784ccdddd597af50662a9e0ab818ac83318dce8a
6
+ metadata.gz: 8ea97fd90f89882ee7e54d80b46e468fa5beffa6ee2e9dc64475e14ebfe4cdcfef43dcf6b3dd0ab06db030da9fb04f4e35fae1e35dcba93a8009a80200d24fd5
7
+ data.tar.gz: edbf22cf4988bf3ddc4f7872dce6fe51041dd8a8a657bd8b118196fe42c8a0c06428fbc5a1efcec55525d6ae4b769279a3438b12ad174d2e52497b7610e2260d
@@ -2,7 +2,7 @@ import React, { useState } from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
- import { globalProps } from '../utilities/globalProps'
5
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Image from '../pb_image/_image'
8
8
  import OnlineStatus from '../pb_online_status/_online_status'
@@ -18,14 +18,14 @@ type AvatarProps = {
18
18
  name: string,
19
19
  size?: "md" | "lg" | "sm" | "xl" | "xs" | "xxs",
20
20
  status: "away" | "offline" | "online",
21
- }
21
+ } & GlobalProps
22
22
 
23
23
  const firstTwoInitials = (name: string) =>
24
24
  name.split(/\s/).map((name) => name[0])
25
25
  .join('')
26
26
  .substring(0, 2)
27
27
 
28
- const Avatar = (props: AvatarProps) => {
28
+ const Avatar = (props: AvatarProps): React.ReactElement => {
29
29
  const {
30
30
  aria = {},
31
31
  className,
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
- import { globalProps } from '../utilities/globalProps'
5
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Highlight from '../pb_highlight/_highlight'
8
8
 
@@ -20,7 +20,7 @@ type BodyProps = {
20
20
  tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
21
21
  text?: string,
22
22
  variant: null | 'link',
23
- }
23
+ } & GlobalProps
24
24
 
25
25
  const Body = (props: BodyProps): React.ReactElement => {
26
26
  const {
@@ -56,12 +56,12 @@ const Body = (props: BodyProps): React.ReactElement => {
56
56
  id={id}
57
57
  >
58
58
  { highlighting && (
59
- <Highlight
60
- highlightedText={highlightedText}
61
- text={text}
62
- >
63
- {children}
64
- </Highlight>
59
+ <Highlight
60
+ highlightedText={highlightedText}
61
+ text={text}
62
+ >
63
+ {children}
64
+ </Highlight>
65
65
  ) }
66
66
  { !highlighting && (
67
67
  text || children
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/no-multi-comp */
1
2
  /* @flow */
2
3
 
3
4
  import React from 'react'
@@ -29,7 +30,7 @@ type CardHeaderProps = {
29
30
  headerColor?: BackgroundColors | ProductColors | CategoryColors | "none",
30
31
  children: array<React.ReactNode> | React.ReactNode,
31
32
  className?: string,
32
- padding?: string,
33
+ padding?: string
33
34
  }
34
35
 
35
36
  type CardBodyProps = {
@@ -56,6 +57,7 @@ const Header = (props: CardHeaderProps) => {
56
57
  const Body = (props: CardBodyProps) => {
57
58
  const { children, padding = 'md', className } = props
58
59
  const bodyCSS = buildCss('pb_card_body_kit')
60
+
59
61
  const bodySpacing = globalProps(props, { padding })
60
62
 
61
63
  return (
@@ -4,6 +4,7 @@
4
4
  @import "../tokens/colors";
5
5
  @import "../tokens/transition";
6
6
  @import "../tokens/animation-curves";
7
+ @import "../tokens/display";
7
8
 
8
9
  $pb_card_border_width: 1px;
9
10
  $pb_card_border_radius: $border_rad_heavier;
@@ -16,7 +16,7 @@ type ImageType = {
16
16
  url?: string,
17
17
  } & GlobalProps
18
18
 
19
- const Image = (props: ImageType) => {
19
+ const Image = (props: ImageType): React.ReactElement => {
20
20
  const {
21
21
  alt = '',
22
22
  aria = {},
@@ -1,8 +1,9 @@
1
1
  /* @flow */
2
2
  /*eslint-disable flowtype/space-before-type-colon */
3
3
 
4
- import moment from 'moment-timezone'
4
+ import moment from 'moment'
5
5
  import 'moment-strftime'
6
+ import 'moment-timezone'
6
7
 
7
8
  type DateTimeType = {
8
9
  value: String | Date,
@@ -20,6 +20,7 @@ type TableProps = {
20
20
  responsive: "collapse" | "scroll" | "none",
21
21
  singleLine: boolean,
22
22
  size: "sm" | "md" | "lg",
23
+ sticky?: boolean,
23
24
  }
24
25
 
25
26
  const Table = (props: TableProps) => {
@@ -37,6 +38,7 @@ const Table = (props: TableProps) => {
37
38
  responsive = 'collapse',
38
39
  singleLine = false,
39
40
  size = 'sm',
41
+ sticky = false,
40
42
  } = props
41
43
 
42
44
  const ariaProps = buildAriaProps(aria)
@@ -60,6 +62,7 @@ const Table = (props: TableProps) => {
60
62
  'data_table': dataTable,
61
63
  'single-line': singleLine,
62
64
  'no-hover': disableHover,
65
+ 'sticky-header': sticky,
63
66
  },
64
67
  globalProps(props),
65
68
  tableCollapseCss,
@@ -0,0 +1,83 @@
1
+ <%= pb_rails("table", props: { sticky: true }) do %>
2
+ <thead>
3
+ <tr>
4
+ <th>Column 1</th>
5
+ <th>Column 2</th>
6
+ <th>Column 3</th>
7
+ <th>Column 4</th>
8
+ <th>Column 5</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <tr>
13
+ <td>Value 1</td>
14
+ <td>Value 2</td>
15
+ <td>Value 3</td>
16
+ <td>Value 4</td>
17
+ <td>Value 5</td>
18
+ </tr>
19
+ <tr>
20
+ <td>Value 1</td>
21
+ <td>Value 2</td>
22
+ <td>Value 3</td>
23
+ <td>Value 4</td>
24
+ <td>Value 5</td>
25
+ </tr>
26
+ <tr>
27
+ <td>Value 1</td>
28
+ <td>Value 2</td>
29
+ <td>Value 3</td>
30
+ <td>Value 4</td>
31
+ <td>Value 5</td>
32
+ </tr>
33
+ <tr>
34
+ <td>Value 1</td>
35
+ <td>Value 2</td>
36
+ <td>Value 3</td>
37
+ <td>Value 4</td>
38
+ <td>Value 5</td>
39
+ </tr>
40
+ <tr>
41
+ <td>Value 1</td>
42
+ <td>Value 2</td>
43
+ <td>Value 3</td>
44
+ <td>Value 4</td>
45
+ <td>Value 5</td>
46
+ </tr>
47
+ <tr>
48
+ <td>Value 1</td>
49
+ <td>Value 2</td>
50
+ <td>Value 3</td>
51
+ <td>Value 4</td>
52
+ <td>Value 5</td>
53
+ </tr>
54
+ <tr>
55
+ <td>Value 1</td>
56
+ <td>Value 2</td>
57
+ <td>Value 3</td>
58
+ <td>Value 4</td>
59
+ <td>Value 5</td>
60
+ </tr>
61
+ <tr>
62
+ <td>Value 1</td>
63
+ <td>Value 2</td>
64
+ <td>Value 3</td>
65
+ <td>Value 4</td>
66
+ <td>Value 5</td>
67
+ </tr>
68
+ <tr>
69
+ <td>Value 1</td>
70
+ <td>Value 2</td>
71
+ <td>Value 3</td>
72
+ <td>Value 4</td>
73
+ <td>Value 5</td>
74
+ </tr>
75
+ <tr>
76
+ <td>Value 1</td>
77
+ <td>Value 2</td>
78
+ <td>Value 3</td>
79
+ <td>Value 4</td>
80
+ <td>Value 5</td>
81
+ </tr>
82
+ </tbody>
83
+ <% end %>
@@ -0,0 +1,94 @@
1
+ import React from "react"
2
+
3
+ import Table from "../_table"
4
+
5
+ const TableSticky = (props) => (
6
+ <Table
7
+ sticky
8
+ {...props}
9
+ >
10
+ <thead>
11
+ <tr>
12
+ <th>{'Column 1'}</th>
13
+ <th>{'Column 2'}</th>
14
+ <th>{'Column 3'}</th>
15
+ <th>{'Column 4'}</th>
16
+ <th>{'Column 5'}</th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <tr>
21
+ <td>{'Value 1'}</td>
22
+ <td>{'Value 2'}</td>
23
+ <td>{'Value 3'}</td>
24
+ <td>{'Value 4'}</td>
25
+ <td>{'Value 5'}</td>
26
+ </tr>
27
+ <tr>
28
+ <td>{'Value 1'}</td>
29
+ <td>{'Value 2'}</td>
30
+ <td>{'Value 3'}</td>
31
+ <td>{'Value 4'}</td>
32
+ <td>{'Value 5'}</td>
33
+ </tr>
34
+ <tr>
35
+ <td>{'Value 1'}</td>
36
+ <td>{'Value 2'}</td>
37
+ <td>{'Value 3'}</td>
38
+ <td>{'Value 4'}</td>
39
+ <td>{'Value 5'}</td>
40
+ </tr>
41
+ <tr>
42
+ <td>{'Value 1'}</td>
43
+ <td>{'Value 2'}</td>
44
+ <td>{'Value 3'}</td>
45
+ <td>{'Value 4'}</td>
46
+ <td>{'Value 5'}</td>
47
+ </tr>
48
+ <tr>
49
+ <td>{'Value 1'}</td>
50
+ <td>{'Value 2'}</td>
51
+ <td>{'Value 3'}</td>
52
+ <td>{'Value 4'}</td>
53
+ <td>{'Value 5'}</td>
54
+ </tr>
55
+ <tr>
56
+ <td>{'Value 1'}</td>
57
+ <td>{'Value 2'}</td>
58
+ <td>{'Value 3'}</td>
59
+ <td>{'Value 4'}</td>
60
+ <td>{'Value 5'}</td>
61
+ </tr>
62
+ <tr>
63
+ <td>{'Value 1'}</td>
64
+ <td>{'Value 2'}</td>
65
+ <td>{'Value 3'}</td>
66
+ <td>{'Value 4'}</td>
67
+ <td>{'Value 5'}</td>
68
+ </tr>
69
+ <tr>
70
+ <td>{'Value 1'}</td>
71
+ <td>{'Value 2'}</td>
72
+ <td>{'Value 3'}</td>
73
+ <td>{'Value 4'}</td>
74
+ <td>{'Value 5'}</td>
75
+ </tr>
76
+ <tr>
77
+ <td>{'Value 1'}</td>
78
+ <td>{'Value 2'}</td>
79
+ <td>{'Value 3'}</td>
80
+ <td>{'Value 4'}</td>
81
+ <td>{'Value 5'}</td>
82
+ </tr>
83
+ <tr>
84
+ <td>{'Value 1'}</td>
85
+ <td>{'Value 2'}</td>
86
+ <td>{'Value 3'}</td>
87
+ <td>{'Value 4'}</td>
88
+ <td>{'Value 5'}</td>
89
+ </tr>
90
+ </tbody>
91
+ </Table>
92
+ )
93
+
94
+ export default TableSticky
@@ -0,0 +1,3 @@
1
+ React: Use `sticky` on a table to allow the table header to be fixed in place when the user scrolls up and down on the page.
2
+
3
+ Rails: Pass `sticky: true` to props.
@@ -3,6 +3,7 @@ examples:
3
3
  - table_sm: Small
4
4
  - table_md: Medium
5
5
  - table_lg: Large
6
+ - table_sticky: Sticky Header
6
7
  - table_alignment_row: Row Alignment
7
8
  - table_alignment_column: Column Alignment
8
9
  - table_alignment_shift_row: Shift Row
@@ -25,6 +26,7 @@ examples:
25
26
  - table_sm: Small
26
27
  - table_md: Medium
27
28
  - table_lg: Large
29
+ - table_sticky: Sticky Header
28
30
  - table_alignment_row: Row Alignment
29
31
  - table_alignment_column: Column Alignment
30
32
  - table_alignment_shift_row: Shift Row
@@ -1,6 +1,7 @@
1
1
  export { default as TableSm } from './_table_sm.jsx'
2
2
  export { default as TableMd } from './_table_md.jsx'
3
3
  export { default as TableLg } from './_table_lg.jsx'
4
+ export { default as TableSticky } from './_table_sticky.jsx'
4
5
  export { default as TableSideHighlight } from './_table_side_highlight.jsx'
5
6
  export { default as TableContainer } from './_table_container.jsx'
6
7
  export { default as TableDataTable } from './_table_data_table.jsx'
@@ -16,3 +16,4 @@
16
16
  @import "mobile_collapse";
17
17
  @import "tablet_collapse";
18
18
  @import "desktop_collapse";
19
+ @import "sticky_header";
@@ -0,0 +1,21 @@
1
+ @import "../../tokens/colors";
2
+
3
+ [class^="pb_table"] {
4
+ &.sticky-header {
5
+ thead {
6
+ position: sticky;
7
+ background: $white;
8
+ top: -40px;
9
+ }
10
+ }
11
+
12
+ &.dark {
13
+ &.sticky-header {
14
+ thead {
15
+ position: sticky;
16
+ background: #0a0527;
17
+ top: -40px;
18
+ }
19
+ }
20
+ }
21
+ }
@@ -21,11 +21,13 @@ module Playbook
21
21
  values: %w[sm md lg],
22
22
  default: "sm"
23
23
  prop :text
24
+ prop :sticky, type: Playbook::Props::Boolean,
25
+ default: false
24
26
 
25
27
  def classname
26
28
  generate_classname(
27
29
  "pb_table", "table-#{size}", single_line_class, dark_class,
28
- disable_hover_class, container_class, data_table_class, collapse_class,
30
+ disable_hover_class, container_class, data_table_class, sticky_class, collapse_class,
29
31
  "table-responsive-#{responsive}", separator: " "
30
32
  )
31
33
  end
@@ -55,6 +57,10 @@ module Playbook
55
57
  def collapse_class
56
58
  responsive != "none" ? "table-collapse-#{collapse}" : ""
57
59
  end
60
+
61
+ def sticky_class
62
+ sticky ? "sticky-header" : nil
63
+ end
58
64
  end
59
65
  end
60
66
  end
@@ -0,0 +1,17 @@
1
+ import { ensureAccessible, renderKit } from "../utilities/test-utils"
2
+
3
+ import Table from "./_table"
4
+
5
+ const props = {
6
+ data: { testid: "table" },
7
+ sticky: false
8
+ }
9
+
10
+ it("should be accessible", async () => {
11
+ ensureAccessible(Table, props)
12
+ })
13
+
14
+ test("when sticky is true", () => {
15
+ const kit = renderKit(Table, props, { sticky: true })
16
+ expect(kit).toHaveClass("pb_table table-sm table-responsive-collapse table-card sticky-header table-collapse-sm")
17
+ })
@@ -0,0 +1,13 @@
1
+ $display_inline: inline;
2
+ $display_block: block;
3
+ $display_inline_block: inline-block;
4
+ $display_flex: flex;
5
+ $display_hidden: hidden;
6
+ $display_inline_flex: inline-flex;
7
+ $displays: (
8
+ display_hidden: $display_hidden,
9
+ display_flex: $display_flex,
10
+ display_inline: $display_inline,
11
+ display_inline_block: $display_inline_block,
12
+ display_block: $display_block
13
+ );
@@ -10,11 +10,11 @@ $screen-xl-min: 1200px;
10
10
  $screen-xl-max: $screen-xl-min - 1;
11
11
 
12
12
  $breakpoints: (
13
- xs: $screen-xs-min,
14
- sm: $screen-sm-min,
15
- md: $screen-md-min,
16
- lg: $screen-lg-min,
17
- xl: $screen-xl-min
13
+ xs: $screen-xs-min, // $screen-xs-min
14
+ sm: $screen-sm-min, // $screen-xs-min + 1 thru $screen-md-min
15
+ md: $screen-md-min, // $screen-md-min + 1 thru $screen-md-lg
16
+ lg: $screen-lg-min, // $screen-lg-min + 1 thru $screen-md-xl
17
+ xl: $screen-xl-min // $screen-xl-min + 1
18
18
  );
19
19
 
20
20
 
@@ -28,3 +28,19 @@ $breakpoints: (
28
28
  @content;
29
29
  }
30
30
  }
31
+
32
+ @mixin break_on($min: null, $max: null) {
33
+ @if not $max {
34
+ @media screen and (min-width: $min) {
35
+ @content;
36
+ }
37
+ } @else if not $min {
38
+ @media screen and (max-width: $max) {
39
+ @content;
40
+ }
41
+ } @else {
42
+ @media screen and (min-width: $min) and (max-width: $max) {
43
+ @content;
44
+ }
45
+ }
46
+ }
@@ -1,3 +1,5 @@
1
+ @import "../tokens/display";
2
+
1
3
  .display_block {
2
4
  display: block;
3
5
  }
@@ -20,4 +22,59 @@
20
22
 
21
23
  .display_hidden {
22
24
  display: none;
23
- }
25
+ }
26
+
27
+ $screen-xs-min: 575px;
28
+ $screen-xs-max: $screen-xs-min - 1;
29
+ $screen-sm-min: 576px;
30
+ $screen-sm-max: $screen-sm-min - 1;
31
+ $screen-md-min: 768px;
32
+ $screen-md-max: $screen-md-min - 1;
33
+ $screen-lg-min: 992px;
34
+ $screen-lg-max: $screen-lg-min - 1;
35
+ $screen-xl-min: 1200px;
36
+ $screen-xl-max: $screen-xl-min - 1;
37
+
38
+ $breakpoints: (
39
+ xs: (
40
+ // min: 0,
41
+ max: $screen-xs-min // 575
42
+ ),
43
+ sm: (
44
+ min: $screen-sm-min, // 576
45
+ max: $screen-md-max // 767
46
+ ),
47
+ md: (
48
+ min: $screen-md-min, // 768
49
+ max: $screen-lg-max // 991
50
+ ),
51
+ lg: (
52
+ min: $screen-lg-min, // 992
53
+ max: $screen-xl-max // 1199
54
+ ),
55
+ xl: (
56
+ min: $screen-xl-min, //1200
57
+ // max: 0
58
+ )
59
+ );
60
+
61
+
62
+ $display_values: (
63
+ hidden: $display_hidden,
64
+ flex: $display_flex,
65
+ inline: $display_inline,
66
+ inline_block: $display_inline_block,
67
+ block: $display_block
68
+ );
69
+
70
+ @each $size, $size_value in $breakpoints {
71
+ @each $display, $display_value in $display_values {
72
+ $min_size: map-get($size_value, "min");
73
+ $max_size: map-get($size_value, "max");
74
+ @include break_on($min_size, $max_size) {
75
+ .display_#{$size}_#{$display} {
76
+ display: #{$display_value} !important;
77
+ }
78
+ }
79
+ }
80
+ }
@@ -1,7 +1,12 @@
1
1
  import { omit } from 'lodash'
2
2
 
3
- type Sizes = "xs" | "sm" | "md" | "lg" | "xl"
4
- type None = "none"
3
+ import {
4
+ Binary,
5
+ Display,
6
+ DisplaySizes,
7
+ None,
8
+ Sizes,
9
+ } from '../types'
5
10
 
6
11
  type AllSizes = None & Sizes
7
12
 
@@ -42,27 +47,23 @@ type ZIndex = {
42
47
  }
43
48
 
44
49
  type Shadow = {
45
- shadow?: "none" | "deep" | "deeper" | "deepest",
50
+ shadow?: None | "deep" | "deeper" | "deepest",
46
51
  }
47
52
 
48
53
  type LineHeight = {
49
54
  lineHeight?: "loosest" | "looser" | "loose" | "normal" | "tight" | "tighter" | "tightest",
50
55
  }
51
56
 
52
- type Display = {
53
- display?: "block" | "flex" | "hidden" | "inline_block" | "inline" | "inline_flex",
54
- }
55
-
56
57
  type Cursor = {
57
58
  cursor?: "pointer",
58
59
  }
59
60
 
60
61
  type BorderRadius = {
61
- borderRadius?: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "rounded",
62
+ borderRadius?: None | "xs" | "sm" | "md" | "lg" | "xl" | "rounded",
62
63
  }
63
64
 
64
65
  type Flex = {
65
- flex?: "none" | "initial" | "auto" | 1
66
+ flex?: None | "initial" | "auto" | 1
66
67
  }
67
68
 
68
69
  type FlexDirection = {
@@ -70,11 +71,11 @@ type FlexDirection = {
70
71
  }
71
72
 
72
73
  type FlexGrow = {
73
- flexGrow?: 0 | 1
74
+ flexGrow?: Binary
74
75
  }
75
76
 
76
77
  type FlexShrink = {
77
- flexShrink?: 0 | 1
78
+ flexShrink?: Binary
78
79
  }
79
80
 
80
81
  type FlexWrap = {
@@ -106,11 +107,11 @@ type AlignSelf = {
106
107
  }
107
108
 
108
109
  type Order = {
109
- order?: "none" | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
110
+ order?: None | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
110
111
  }
111
112
 
112
113
  export type GlobalProps = AlignContent & AlignItems & AlignSelf &
113
- BorderRadius & Cursor & Dark & Display & Flex & FlexDirection &
114
+ BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
114
115
  FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
115
116
  LineHeight & Margin & MaxWidth & NumberSpacing & Order & Padding &
116
117
  Shadow & ZIndex
@@ -180,9 +181,21 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
180
181
  css += lineHeight ? `line_height_${lineHeight} ` : ''
181
182
  return css
182
183
  },
183
- displayProps: ({ display }: Display) => {
184
+ displayProps: (display: Display ) => {
184
185
  let css = ''
185
- css += display ? `display_${display} ` : ''
186
+ Object.entries(display).forEach((displayEntry) => {
187
+ if (displayEntry[0] == "display") {
188
+ if (typeof displayEntry[1] == "string") {
189
+ css += `display_${displayEntry[1]}`
190
+ } else if (typeof displayEntry[1] == "object") {
191
+ Object.entries(displayEntry[1]).forEach((displayObj) => {
192
+ css += `display_${displayObj[0]}_${displayObj[1]}`
193
+ })
194
+ } else {
195
+ ' '
196
+ }
197
+ }
198
+ })
186
199
  return css
187
200
  },
188
201
  cursorProps: ({ cursor }: Cursor) => {
@@ -259,7 +272,9 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
259
272
  }
260
273
  }
261
274
 
262
- export const globalProps = (props: GlobalProps, defaultProps: {[key: string]: string} | {} = {}): string => {
275
+ type DefaultProps = {[key: string]: string} | Record<string, unknown>
276
+
277
+ export const globalProps = (props: GlobalProps, defaultProps: DefaultProps = {}): string => {
263
278
  const allProps = { ...props, ...defaultProps }
264
279
  return Object.keys(PROP_CATEGORIES).map((key) => {
265
280
  return PROP_CATEGORIES[key](allProps)
@@ -8,12 +8,22 @@ module Playbook
8
8
 
9
9
  def display_props
10
10
  selected_props = display_options.keys.select { |sk| try(sk) }
11
- return nil unless selected_props.present?
12
-
13
- selected_props.map do |k|
14
- display_value = send(k)
15
- "display_#{display_value}" if display_values.include? display_value
16
- end.compact.join(" ")
11
+ responsive = selected_props.present? && try(:display).is_a?(::Hash)
12
+ css = ""
13
+ if responsive
14
+ display_value = send(:display)
15
+ display_value.each do |key, value|
16
+ css += "display_#{key}_#{value} " if display_size_values.include?(key.to_s) && display_values.include?(value.to_s)
17
+ end
18
+ elsif display_value.is_a?(String)
19
+ selected_props.each do |k|
20
+ display_value = send(k)
21
+ css += "display_#{display_value}" if display_values.include? display_value
22
+ end
23
+ else
24
+ ""
25
+ end
26
+ css unless css.blank?
17
27
  end
18
28
 
19
29
  def display_options
@@ -22,6 +32,10 @@ module Playbook
22
32
  }
23
33
  end
24
34
 
35
+ def display_size_values
36
+ %w[xs sm md lg xl]
37
+ end
38
+
25
39
  def display_values
26
40
  %w[block inline_block inline flex inline_flex hidden]
27
41
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "10.24.0"
5
- VERSION = "10.25.0"
4
+ PREVIOUS_VERSION = "10.25.0"
5
+ VERSION = "10.26.0.pre.alpha3"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.25.0
4
+ version: 10.26.0.pre.alpha3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-04-22 00:00:00.000000000 Z
12
+ date: 2022-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -1734,6 +1734,9 @@ files:
1734
1734
  - app/pb_kits/playbook/pb_table/docs/_table_sm.html.erb
1735
1735
  - app/pb_kits/playbook/pb_table/docs/_table_sm.jsx
1736
1736
  - app/pb_kits/playbook/pb_table/docs/_table_sm.md
1737
+ - app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb
1738
+ - app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx
1739
+ - app/pb_kits/playbook/pb_table/docs/_table_sticky.md
1737
1740
  - app/pb_kits/playbook/pb_table/docs/_table_two_actions.html.erb
1738
1741
  - app/pb_kits/playbook/pb_table/docs/_table_two_actions.jsx
1739
1742
  - app/pb_kits/playbook/pb_table/docs/_table_two_actions.md
@@ -1755,6 +1758,7 @@ files:
1755
1758
  - app/pb_kits/playbook/pb_table/styles/_reset.scss
1756
1759
  - app/pb_kits/playbook/pb_table/styles/_side_highlight.scss
1757
1760
  - app/pb_kits/playbook/pb_table/styles/_single-line.scss
1761
+ - app/pb_kits/playbook/pb_table/styles/_sticky_header.scss
1758
1762
  - app/pb_kits/playbook/pb_table/styles/_structure.scss
1759
1763
  - app/pb_kits/playbook/pb_table/styles/_table-card.scss
1760
1764
  - app/pb_kits/playbook/pb_table/styles/_table-dark.scss
@@ -1762,6 +1766,7 @@ files:
1762
1766
  - app/pb_kits/playbook/pb_table/styles/_variables.scss
1763
1767
  - app/pb_kits/playbook/pb_table/table.html.erb
1764
1768
  - app/pb_kits/playbook/pb_table/table.rb
1769
+ - app/pb_kits/playbook/pb_table/table.test.js
1765
1770
  - app/pb_kits/playbook/pb_table/table_row.html.erb
1766
1771
  - app/pb_kits/playbook/pb_table/table_row.rb
1767
1772
  - app/pb_kits/playbook/pb_text_input/_text_input.jsx
@@ -2050,6 +2055,7 @@ files:
2050
2055
  - app/pb_kits/playbook/tokens/_animation-curves.scss
2051
2056
  - app/pb_kits/playbook/tokens/_border_radius.scss
2052
2057
  - app/pb_kits/playbook/tokens/_colors.scss
2058
+ - app/pb_kits/playbook/tokens/_display.scss
2053
2059
  - app/pb_kits/playbook/tokens/_line_height.scss
2054
2060
  - app/pb_kits/playbook/tokens/_opacity.scss
2055
2061
  - app/pb_kits/playbook/tokens/_positioning.scss
@@ -2155,7 +2161,7 @@ files:
2155
2161
  - lib/playbook_ui.rb
2156
2162
  homepage: http://playbook.powerapp.cloud
2157
2163
  licenses:
2158
- - MIT
2164
+ - ISC
2159
2165
  metadata: {}
2160
2166
  post_install_message:
2161
2167
  rdoc_options: []
@@ -2168,9 +2174,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
2168
2174
  version: '0'
2169
2175
  required_rubygems_version: !ruby/object:Gem::Requirement
2170
2176
  requirements:
2171
- - - ">="
2177
+ - - ">"
2172
2178
  - !ruby/object:Gem::Version
2173
- version: '0'
2179
+ version: 1.3.1
2174
2180
  requirements: []
2175
2181
  rubygems_version: 3.1.6
2176
2182
  signing_key: