playbook_ui 14.6.2.pre.alpha.PLAY1550lazysizesupgrade4295 → 14.6.2.pre.alpha.PLAY15814348

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_card/_card.tsx +12 -4
  3. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -2
  4. data/app/pb_kits/playbook/pb_card/docs/_card_light.jsx +17 -3
  5. data/app/pb_kits/playbook/pb_currency/_currency.tsx +16 -6
  6. data/app/pb_kits/playbook/pb_currency/currency.rb +38 -11
  7. data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
  8. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.html.erb +7 -0
  9. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.jsx +18 -0
  10. data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.md +3 -0
  11. data/app/pb_kits/playbook/pb_currency/docs/example.yml +3 -1
  12. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  13. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +5 -1
  14. data/app/pb_kits/playbook/pb_flex/_flex.tsx +3 -1
  15. data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +8 -2
  16. data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +3 -6
  17. data/app/pb_kits/playbook/pb_flex/flex_item.rb +7 -2
  18. data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
  19. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +67 -1
  20. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +1 -0
  21. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
  22. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +5 -1
  23. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +3 -0
  24. data/app/pb_kits/playbook/utilities/globalProps.ts +39 -2
  25. data/dist/chunks/_typeahead-BtdghxJo.js +22 -0
  26. data/dist/chunks/_weekday_stacked-D1RoR5CN.js +45 -0
  27. data/dist/chunks/vendor.js +1 -1
  28. data/dist/playbook-doc.js +1 -1
  29. data/dist/playbook-rails-react-bindings.js +1 -1
  30. data/dist/playbook-rails.js +1 -1
  31. data/dist/playbook.css +1 -1
  32. data/lib/playbook/kit_base.rb +21 -1
  33. data/lib/playbook/version.rb +1 -1
  34. metadata +7 -4
  35. data/dist/chunks/_typeahead-BV_n6U5W.js +0 -22
  36. data/dist/chunks/_weekday_stacked-Cken8pfG.js +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d188ead65884951c6c66789ff457b7bb6079794c0f7463b9b5f4f3fc96067555
4
- data.tar.gz: b1bab8a6b3a43ae229c7ff97db8a3a052e408480ce91d5613501048a7ce9d6c6
3
+ metadata.gz: 014bc2684f60ff1adb9fdcdf0d8602a2ca8a0d7b47389b12af8a5a5402fa5017
4
+ data.tar.gz: 949941602000ddd6530a70c74d8cb647ea7c95537895bd7abb2abc3e09d96926
5
5
  SHA512:
6
- metadata.gz: 5493d332b18d8ddfbd8efd127e8c50e09aea65784669374db75150947341f820187eaaa6a703b344f85750bb11815d1fda3d9a411a5cb3b2e712e515eae54887
7
- data.tar.gz: c119a5634a5e0d73cea247a1b8411e535467e0267cea9d3eafad2e521b535a01d1e1cad720d480faaa557d6b4409a0fbf3c519dd37ce32dca731f2150352b058
6
+ metadata.gz: ee89877910514e40e1203e7d920bdc9e778598740db0b38006d39a1441c2e1ab7c014061c533d8685038aa63ba4825f3c1fd9df504b881b13bf0314a242b1ecf
7
+ data.tar.gz: 201c7a4d5b40a73f97a1b17727d900aff6bf1e0dea35944c78c11953bfc97cff720a4f913aac7017ca19704cbdba8ebbcf6b6d584f15ec88d396ea212322fdcd
@@ -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;
113
+ const mergedStyles = { ...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
  {
@@ -130,11 +135,13 @@ const Card = (props: CardPropTypes): React.ReactElement => {
130
135
  <Draggable.Item dragId={dragId}
131
136
  key={dragId}
132
137
  >
138
+ <h1>{htmlProps}</h1>
133
139
  <Tag
134
140
  {...ariaProps}
135
141
  {...dataProps}
136
- {...htmlProps}
137
142
  className={classnames(cardCss, globalProps(props), className)}
143
+ {...restHtmlProps}
144
+ style={mergedStyles}
138
145
  >
139
146
  {subComponentTags('Header')}
140
147
  {
@@ -161,8 +168,9 @@ const Card = (props: CardPropTypes): React.ReactElement => {
161
168
  <Tag
162
169
  {...ariaProps}
163
170
  {...dataProps}
164
- {...htmlProps}
165
171
  className={classnames(cardCss, globalProps(props), className)}
172
+ {...restHtmlProps}
173
+ style={mergedStyles}
166
174
  >
167
175
  {subComponentTags('Header')}
168
176
  {nonHeaderChildren}
@@ -28,8 +28,7 @@ $pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors)
28
28
 
29
29
  @mixin pb_card_selected($border_color: $primary) {
30
30
  border-color: $border_color;
31
- border-width: $pb_card_border_width;
32
- outline: 1px solid $border_color;
31
+ border-width: $pb_card_border_width * 2;
33
32
  }
34
33
 
35
34
  @mixin pb_card_selected_dark {
@@ -1,12 +1,26 @@
1
- import React from 'react'
2
- import Card from '../_card'
1
+ import React from "react"
2
+ import Card from "../_card"
3
3
 
4
4
  const CardLight = (props) => {
5
5
  return (
6
6
  <div>
7
- <Card {...props}>{'Card content'}</Card>
7
+ <Card
8
+ height="100%"
9
+ htmlOptions={{
10
+ style: {
11
+ width: "100%",
12
+ backgroundColor: "blue",
13
+ },
14
+ tabIndex: 7
15
+ }}
16
+ minHeight="189px"
17
+ {...props}
18
+ >
19
+ {"HELLO WORLD!!!"}
20
+ </Card>
8
21
  </div>
9
22
  )
10
23
  }
11
24
 
12
25
  export default CardLight
26
+
@@ -26,6 +26,7 @@ type CurrencyProps = {
26
26
  variant?: 'default' | 'light' | 'bold',
27
27
  unit?: string,
28
28
  unstyled?: boolean,
29
+ commaSeparator?: boolean,
29
30
  }
30
31
 
31
32
  const sizes: {lg: 1, md: 3, sm: 4} = {
@@ -53,6 +54,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
53
54
  variant = 'default',
54
55
  dark = false,
55
56
  unstyled = false,
57
+ commaSeparator = false,
56
58
  } = props
57
59
 
58
60
  const emphasizedClass = emphasized ? '' : '_deemphasized'
@@ -74,7 +76,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
74
76
  className
75
77
  )
76
78
 
77
- const getFormattedNumber = (input: number | any ) => new Intl.NumberFormat('en-US', {
79
+ const getFormattedNumber = (input: number | any) => new Intl.NumberFormat('en-US', {
78
80
  notation: 'compact',
79
81
  maximumFractionDigits: 1,
80
82
  }).format(input)
@@ -88,12 +90,20 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
88
90
  return isAmount ? num.slice(0, -1) : isUnit ? num.slice(-1) : ''
89
91
  }
90
92
 
91
- const getMatchingDecimalAmount = decimals === "matching" ? amount : whole,
92
- getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
93
+ const getMatchingDecimalAmount = decimals === "matching" ? amount : whole
94
+ const getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
93
95
 
94
- const getAmount = abbreviate ? getAbbreviatedValue('amount') : getMatchingDecimalAmount,
95
- getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null,
96
- getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
96
+ const formatAmount = (amount: string) => {
97
+ if (!commaSeparator) return amount;
98
+
99
+ const [wholePart, decimalPart] = amount.split('.');
100
+ const formattedWhole = new Intl.NumberFormat('en-US').format(parseInt(wholePart));
101
+ return decimalPart ? `${formattedWhole}.${decimalPart}` : formattedWhole;
102
+ }
103
+
104
+ const getAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
105
+ const getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null
106
+ const getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
97
107
 
98
108
  return (
99
109
  <div
@@ -43,6 +43,9 @@ module Playbook
43
43
  prop :unstyled, type: Playbook::Props::Boolean,
44
44
  default: false
45
45
 
46
+ prop :comma_separator, type: Playbook::Props::Boolean,
47
+ default: false
48
+
46
49
  def classname
47
50
  generate_classname("pb_currency_kit", align, size, dark_class)
48
51
  end
@@ -65,7 +68,7 @@ module Playbook
65
68
  def title_props
66
69
  {
67
70
  size: size_value,
68
- text: abbreviate ? abbreviated_value : whole_value,
71
+ text: abbreviate ? abbreviated_value : formatted_amount,
69
72
  classname: "pb_currency_value",
70
73
  dark: dark,
71
74
  }
@@ -96,28 +99,38 @@ module Playbook
96
99
  private
97
100
 
98
101
  def whole_value
99
- return amount if decimals == "matching"
100
-
101
- amount.split(".").first.to_s
102
+ value = amount.split(".").first
103
+ if comma_separator
104
+ number_with_delimiter(value.gsub(",", ""))
105
+ else
106
+ value
107
+ end
102
108
  end
103
109
 
104
- def abbreviated_value(index = 0..-2)
105
- value = amount.split(".").first.split(",").join("")
106
- abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "").to_s
107
- abbreviated_num[index]
110
+ def decimal_value
111
+ amount.split(".")[1] || "00"
108
112
  end
109
113
 
110
114
  def units_element
111
115
  return "" if decimals == "matching" && !abbreviate && !unit
112
116
 
113
- _, decimal_part = amount.split(".")
114
- if unit.nil? && abbreviate == false
115
- decimal_part.nil? ? ".00" : ".#{decimal_part}"
117
+ if unit.nil? && !abbreviate
118
+ if decimals == "matching"
119
+ ""
120
+ else
121
+ ".#{decimal_value}"
122
+ end
116
123
  else
117
124
  abbreviate ? "#{abbreviated_value(-1)}#{unit}" : unit
118
125
  end
119
126
  end
120
127
 
128
+ def abbreviated_value(index = 0..-2)
129
+ value = amount.split(".").first.gsub(",", "").to_i
130
+ abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "")
131
+ abbreviated_num[index]
132
+ end
133
+
121
134
  def size_value
122
135
  case size
123
136
  when "lg"
@@ -132,6 +145,20 @@ module Playbook
132
145
  def dark_class
133
146
  dark ? "dark" : nil
134
147
  end
148
+
149
+ def formatted_amount
150
+ return abbreviated_value if abbreviate
151
+
152
+ if decimals == "matching"
153
+ if comma_separator
154
+ number_with_delimiter(amount.gsub(",", ""))
155
+ else
156
+ amount
157
+ end
158
+ else
159
+ whole_value
160
+ end
161
+ end
135
162
  end
136
163
  end
137
164
  end
@@ -61,3 +61,38 @@ test('decimals default prop returns decimals as body text', () => {
61
61
  expect(currencyKit.querySelector('.pb_currency_value')).toHaveTextContent('320')
62
62
  expect(currencyKit.querySelector('.unit')).toHaveTextContent('.20')
63
63
  })
64
+
65
+
66
+ test('commaSeparator prop returns comma separated amount', () => {
67
+ render(
68
+ <Currency
69
+ amount="1234567890"
70
+ commaSeparator
71
+ data={{ testid: 'comma-test' }}
72
+ />
73
+ )
74
+ expect(screen.getByTestId('comma-test')).toHaveTextContent('1,234,567,890')
75
+ })
76
+
77
+ test('commaSeparator prop returns comma separated amount with decimals', () => {
78
+ render(
79
+ <Currency
80
+ amount="1234567890.12"
81
+ commaSeparator
82
+ data={{ testid: 'comma-test-decimals' }}
83
+ />
84
+ )
85
+ expect(screen.getByTestId('comma-test-decimals')).toHaveTextContent('1,234,567,890.12')
86
+ })
87
+
88
+ test('commaSeparator prop returns comma separated amount with decimals="matching"', () => {
89
+ render(
90
+ <Currency
91
+ amount="1234567890.12"
92
+ commaSeparator
93
+ data={{ testid: 'comma-test-decimals-matching' }}
94
+ decimals="matching"
95
+ />
96
+ )
97
+ expect(screen.getByTestId('comma-test-decimals-matching')).toHaveTextContent('1,234,567,890.12')
98
+ })
@@ -0,0 +1,7 @@
1
+ <%= pb_rails("currency", props: {
2
+ amount: '1234567.89',
3
+ comma_separator: true,
4
+ size: 'lg',
5
+ emphasized: false,
6
+ decimals: 'matching',
7
+ }) %>
@@ -0,0 +1,18 @@
1
+ import React from "react"
2
+
3
+ import Currency from "../_currency"
4
+
5
+ const CurrencyCommaSeparator = (props) => {
6
+ return (
7
+ <Currency
8
+ amount='1234567.89'
9
+ commaSeparator
10
+ decimals="matching"
11
+ emphasized={false}
12
+ size="lg"
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ export default CurrencyCommaSeparator
@@ -0,0 +1,3 @@
1
+ The optional `commaSeparator` can be used to auto-format the use of commas as a thousands separator.
2
+
3
+ **NOTE:** If the value passed into the `amount` prop is already comma-dilineated, it will not add additional commas.
@@ -8,7 +8,8 @@ examples:
8
8
  - currency_abbreviated: Abbreviate Larger Amounts
9
9
  - currency_matching_decimals: Matching Decimals
10
10
  - currency_unstyled: Unstyled
11
-
11
+ - currency_comma_separator: Comma Separator
12
+
12
13
  react:
13
14
  - currency_variants: Variants
14
15
  - currency_size: Size
@@ -17,6 +18,7 @@ examples:
17
18
  - currency_abbreviated: Abbreviate Larger Amounts
18
19
  - currency_matching_decimals: Matching Decimals
19
20
  - currency_unstyled: Unstyled
21
+ - currency_comma_separator: Comma Separator
20
22
 
21
23
  swift:
22
24
  - currency_size_swift: Size
@@ -5,3 +5,4 @@ export { default as CurrencyNoSymbol } from './_currency_no_symbol.jsx'
5
5
  export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
6
6
  export { default as CurrencyMatchingDecimals } from './_currency_matching_decimals.jsx'
7
7
  export { default as CurrencyUnstyled } from './_currency_unstyled.jsx'
8
+ export { default as CurrencyCommaSeparator } from './_currency_comma_separator.jsx'
@@ -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={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 };
@@ -10,6 +10,24 @@
10
10
  $pb_selectable_card_indicator_size: 22px;
11
11
  $pb_selectable_card_border: 2px;
12
12
 
13
+ $pb_selectable_space_classes: (
14
+ xxs: $space_xxs,
15
+ xs: $space_xs,
16
+ sm: $space_sm,
17
+ md: $space_md,
18
+ lg: $space_lg,
19
+ xl: $space_xl,
20
+ );
21
+ $pb_selectable_paddings: (
22
+ p: "padding",
23
+ pr: "padding-right",
24
+ pl: "padding-left",
25
+ pt: "padding-top",
26
+ pb: "padding-bottom",
27
+ px: ("padding-left", "padding-right"),
28
+ py: ("padding-top", "padding-bottom")
29
+ );
30
+
13
31
  [class^=pb_selectable_card_kit] {
14
32
  display: block;
15
33
  margin-bottom: 0;
@@ -28,7 +46,6 @@ $pb_selectable_card_border: 2px;
28
46
  padding: $space_sm;
29
47
  margin-bottom: $space_sm;
30
48
  cursor: pointer;
31
- outline: 1px solid transparent;
32
49
 
33
50
  @media (hover:hover) {
34
51
  &:hover {
@@ -74,6 +91,7 @@ $pb_selectable_card_border: 2px;
74
91
 
75
92
  position: relative;
76
93
  @include pb_card_selected;
94
+ padding: calc(#{$space_sm} - 1px);
77
95
  transition-property: none;
78
96
  transition-duration: 0s;
79
97
 
@@ -88,6 +106,54 @@ $pb_selectable_card_border: 2px;
88
106
  background-color: $royal;
89
107
  }
90
108
  }
109
+
110
+ // Selected card has 1px more border
111
+ // Remove 1px so content does not "jump"
112
+ @each $position_name,
113
+ $position in $pb_selectable_paddings {
114
+ @each $space_name,
115
+ $space in $pb_selectable_space_classes {
116
+ ~ label.#{$position_name}_#{$space_name} {
117
+ @if type-of($position)=="list" {
118
+ @each $coordinate in $position {
119
+ #{$coordinate}: calc(#{$space} - 1px) !important;
120
+ }
121
+ }
122
+
123
+ @else {
124
+ #{$position}: calc(#{$space} - 1px) !important;
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+ &.display_input {
133
+ input[type="checkbox"],
134
+ input[type="radio"] {
135
+ &:checked {
136
+ ~label {
137
+ border-width: $pb_card_border_width;
138
+ outline: 1px solid $primary;
139
+ }
140
+
141
+ }
142
+ }
143
+
144
+ > label {
145
+ outline: 1px solid transparent;
146
+ padding: $space_sm;
147
+ }
148
+
149
+ &.dark {
150
+ input[type="checkbox"],
151
+ input[type="radio"] {
152
+ &:checked ~ label {
153
+ border-width: $pb_card_border_width;
154
+ outline: 1px solid $primary;
155
+ }
156
+ }
91
157
  }
92
158
  }
93
159
 
@@ -67,6 +67,7 @@ const SelectableCard = (props: SelectableCardProps) => {
67
67
  'disabled': disabled,
68
68
  'enabled': !disabled,
69
69
  }),
70
+ variant === 'displayInput' ? 'display_input' : '',
70
71
  { error },
71
72
  dark ? 'dark' : '',
72
73
  className
@@ -25,7 +25,7 @@
25
25
  <% end %>
26
26
  <div class="separator"></div>
27
27
  <div class="psuedo_separator"></div>
28
- <%= pb_rails("card", props: { padding: "sm", status: object.status, border_none: true }) do %>
28
+ <%= pb_rails("card", props: { padding: "sm", status: object.status, border_none: true, dark: object.dark }) do %>
29
29
  <% if content.nil? %>
30
30
  <%= pb_rails("body", props: { text: object.text }) %>
31
31
  <% else %>
@@ -25,7 +25,7 @@ module Playbook
25
25
 
26
26
  def classname
27
27
  [
28
- generate_classname_without_spacing("pb_selectable_card_kit", checked_class, enable_disabled_class),
28
+ generate_classname_without_spacing("pb_selectable_card_kit", checked_class, enable_disabled_class) + display_input_class,
29
29
  error_class,
30
30
  dark_props,
31
31
  ].compact.join(" ")
@@ -79,6 +79,10 @@ module Playbook
79
79
  def error_class
80
80
  error ? "error" : nil
81
81
  end
82
+
83
+ def display_input_class
84
+ variant == "display_input" ? " display_input" : ""
85
+ end
82
86
  end
83
87
  end
84
88
  end
@@ -1,4 +1,7 @@
1
1
  export default [
2
+ "minHeight",
3
+ "maxHeight",
4
+ "height",
2
5
  "left",
3
6
  "bottom",
4
7
  "right",