playbook_ui 11.0.0 → 11.1.1.pre.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_currency/_currency.jsx +7 -2
  3. data/app/pb_kits/playbook/pb_currency/currency.rb +8 -0
  4. data/app/pb_kits/playbook/pb_currency/currency.test.js +28 -0
  5. data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals.html.erb +24 -0
  6. data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals.jsx +38 -0
  7. data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
  8. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  9. data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +14 -60
  10. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +1 -1
  11. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -2
  12. data/app/pb_kits/playbook/pb_dialog/docs/index.js +0 -2
  13. data/app/pb_kits/playbook/pb_home_address_street/{_city_emphasis.html.erb → city_emphasis.html.erb} +0 -0
  14. data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.rb +16 -0
  15. data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +0 -2
  16. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +3 -2
  17. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +23 -2
  18. data/app/pb_kits/playbook/pb_home_address_street/{_street_emphasis.html.erb → street_emphasis.html.erb} +0 -0
  19. data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.rb +15 -0
  20. data/app/pb_kits/playbook/pb_radio/_radio.jsx +78 -0
  21. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.md +1 -1
  22. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_precision.html.erb +3 -0
  23. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_precision.md +2 -0
  24. data/app/pb_kits/playbook/pb_stat_value/docs/example.yml +1 -0
  25. data/app/pb_kits/playbook/pb_stat_value/stat_value.rb +6 -1
  26. data/lib/playbook/props.rb +1 -1
  27. data/lib/playbook/version.rb +2 -2
  28. metadata +13 -11
  29. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.jsx +0 -153
  30. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.md +0 -1
  31. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.jsx +0 -130
  32. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.md +0 -1
  33. data/app/pb_kits/playbook/pb_radio/_radio.tsx +0 -86
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3801f19c66a84d1760c5731a046e20df793ba1a7f5f2d5df91f51422b521c065
4
- data.tar.gz: 80abfc9506e8ea1de5d864356f946091a55073419aee8b900de11d2fbec5f7ac
3
+ metadata.gz: 187ac4ecc55b431fc4c30a316c1cf4b0e137b2c7a1956931636b66f79bfbce7e
4
+ data.tar.gz: ace3fd58252e59d2e97be20a23bc563b4fc243e6d9325cba616ada666d4b5942
5
5
  SHA512:
6
- metadata.gz: 1a7cd6defa69aaaa7f3b4b7352f719e9dc7941ec1ae8a0dd272b69e6de3769d8f53bcfbf9b6f56bb40b69c713332b1c0f1336c769994f846c4a7b395c7feffae
7
- data.tar.gz: 55e41eecece21925e7378faa6c7834369cccef09d0737eb0f8c7165e7db6fd3f5ed96fdd4721b218cdb54c44bb4b12ff2ebd908887108581f1843050590671fe
6
+ metadata.gz: 61c1344a4ca56732440d0b00fc2cc3a8783f828f331b9561ab7b679e9d6e48c7019b24aadeea31cc808a14be3cd079fa98af43a9852c7f431548c032dfa62a76
7
+ data.tar.gz: 7a57d012285cb509b304fa482b6b8d0db59fd9fa57a29c8464312eb2bb03be40ab49979a2efd9546cd9d6894c5fc8db98c1d81e157705ac53e560a67be03502e
@@ -18,6 +18,7 @@ type CurrencyProps = {
18
18
  className?: string,
19
19
  dark?: boolean,
20
20
  data?: object,
21
+ decimals?: 'default' | 'matching',
21
22
  emphasized?: boolean,
22
23
  id?: string,
23
24
  label?: string,
@@ -40,6 +41,7 @@ const Currency = (props: CurrencyProps) => {
40
41
  aria = {},
41
42
  amount,
42
43
  data = {},
44
+ decimals = 'default',
43
45
  emphasized = true,
44
46
  id,
45
47
  unit,
@@ -85,9 +87,12 @@ const Currency = (props: CurrencyProps) => {
85
87
  return isAmount ? num.slice(0, -1) : isUnit ? num.slice(-1) : ''
86
88
  }
87
89
 
88
- const getAmount = abbreviate ? getAbbreviatedValue('amount') : whole,
90
+ const getMatchingDecimalAmount = decimals === "matching" ? amount : whole,
91
+ getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
92
+
93
+ const getAmount = abbreviate ? getAbbreviatedValue('amount') : getMatchingDecimalAmount,
89
94
  getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null,
90
- getDecimalValue = abbreviate ? '' : `.${decimal}`
95
+ getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
91
96
 
92
97
  return (
93
98
  <div
@@ -36,6 +36,10 @@ module Playbook
36
36
  prop :abbreviate, type: Playbook::Props::Boolean,
37
37
  default: false
38
38
 
39
+ prop :decimals, type: Playbook::Props::Enum,
40
+ values: %w[default matching],
41
+ default: "default"
42
+
39
43
  def classname
40
44
  generate_classname("pb_currency_kit", align, size, dark_class)
41
45
  end
@@ -84,6 +88,8 @@ module Playbook
84
88
  private
85
89
 
86
90
  def whole_value
91
+ return amount if decimals == "matching"
92
+
87
93
  amount.split(".").first.to_s
88
94
  end
89
95
 
@@ -94,6 +100,8 @@ module Playbook
94
100
  end
95
101
 
96
102
  def units_element
103
+ return "" if decimals == "matching" && !abbreviate && !unit
104
+
97
105
  _, decimal_part = amount.split(".")
98
106
  if unit.nil? && abbreviate == false
99
107
  decimal_part.nil? ? ".00" : ".#{decimal_part}"
@@ -33,3 +33,31 @@ test('abbreviate prop returns proper abbreviated amount', () => {
33
33
  expect(screen.getByTestId('test-billions')).toHaveTextContent('$3.2B')
34
34
  expect(screen.getByTestId('test-trillions')).toHaveTextContent('$3.2T')
35
35
  })
36
+
37
+ test('decimals matching prop returns decimals as title text', () => {
38
+ render(
39
+ <Currency
40
+ amount="320.20"
41
+ data={{ testid: 'test-decimals-matching' }}
42
+ decimals='matching'
43
+ />
44
+ )
45
+
46
+ const currencyKit = screen.getByTestId('test-decimals-matching')
47
+ expect(currencyKit.querySelector('.pb_currency_value')).toHaveTextContent('320.20')
48
+ expect(currencyKit.querySelector('.unit')).toHaveTextContent('')
49
+ })
50
+
51
+ test('decimals default prop returns decimals as body text', () => {
52
+ render(
53
+ <Currency
54
+ amount="320.20"
55
+ data={{ testid: 'test-decimals-default' }}
56
+ decimals='default'
57
+ />
58
+ )
59
+
60
+ const currencyKit = screen.getByTestId('test-decimals-default')
61
+ expect(currencyKit.querySelector('.pb_currency_value')).toHaveTextContent('320')
62
+ expect(currencyKit.querySelector('.unit')).toHaveTextContent('.20')
63
+ })
@@ -0,0 +1,24 @@
1
+ <%= pb_rails("currency", props: {
2
+ amount: "372.12",
3
+ decimals: "matching",
4
+ label: "Small",
5
+ margin_bottom: "md",
6
+ size: "sm",
7
+ unit: "/day",
8
+ }) %>
9
+
10
+ <%= pb_rails("currency", props: {
11
+ amount: "30,327.43",
12
+ decimals: "matching",
13
+ label: "Medium",
14
+ margin_bottom: "md",
15
+ size: "md",
16
+ symbol: "€",
17
+ }) %>
18
+
19
+ <%= pb_rails("currency", props: {
20
+ amount: "621,953.99",
21
+ decimals: "matching",
22
+ label: "Large",
23
+ size: "lg",
24
+ }) %>
@@ -0,0 +1,38 @@
1
+ import React from 'react'
2
+
3
+ import Currency from '../_currency'
4
+
5
+ const CurrencyMatchingDecimals = (props) => {
6
+ return (
7
+ <>
8
+ <Currency
9
+ amount="372.12"
10
+ decimals="matching"
11
+ label="Small"
12
+ marginBottom="md"
13
+ size="sm"
14
+ unit="/day"
15
+ {...props}
16
+ />
17
+ <Currency
18
+ amount="30,327.43"
19
+ decimals="matching"
20
+ label="Medium"
21
+ marginBottom="md"
22
+ size="md"
23
+ symbol="€"
24
+ {...props}
25
+ />
26
+ <Currency
27
+ amount="621,953.99"
28
+ decimals="matching"
29
+ label="Large"
30
+ size="lg"
31
+ {...props}
32
+ />
33
+ </>
34
+ )
35
+ }
36
+
37
+ export default CurrencyMatchingDecimals
38
+
@@ -6,6 +6,7 @@ examples:
6
6
  - currency_alignment: Alignment
7
7
  - currency_no_symbol: No Symbol
8
8
  - currency_abbreviated: Abbreviate Larger Amounts
9
+ - currency_matching_decimals: Matching Decimals
9
10
 
10
11
  react:
11
12
  - currency_variants: Variants
@@ -13,3 +14,4 @@ examples:
13
14
  - currency_alignment: Alignment
14
15
  - currency_no_symbol: No Symbol
15
16
  - currency_abbreviated: Abbreviate Larger Amounts
17
+ - currency_matching_decimals: Matching Decimals
@@ -3,3 +3,4 @@ export { default as CurrencySize } from './_currency_size.jsx'
3
3
  export { default as CurrencyAlignment } from './_currency_alignment.jsx'
4
4
  export { default as CurrencyNoSymbol } from './_currency_no_symbol.jsx'
5
5
  export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
6
+ export { default as CurrencyMatchingDecimals } from './_currency_matching_decimals.jsx'
@@ -1,5 +1,3 @@
1
- /* eslint-disable react/jsx-handler-names */
2
- /* eslint-disable react/no-multi-comp */
3
1
  /* @flow */
4
2
 
5
3
  import React, { useState } from 'react'
@@ -9,18 +7,13 @@ import Modal from 'react-modal'
9
7
  import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
10
8
  import { globalProps } from '../utilities/globalProps'
11
9
 
12
- import Body from '../pb_body/_body'
13
10
  import Button from '../pb_button/_button'
14
11
  import DialogHeader from './child_kits/_dialog_header'
15
12
  import DialogFooter from './child_kits/_dialog_footer'
16
13
  import DialogBody from './child_kits/_dialog_body'
17
- import Flex from '../pb_flex/_flex'
18
- import IconCircle from '../pb_icon_circle/_icon_circle'
19
- import Title from '../pb_title/_title'
20
14
  import { DialogContext } from './_dialog_context'
21
15
 
22
16
  type DialogProps = {
23
- alertStyle?: "link" | "single" | "stacked" | "default",
24
17
  aria?: object,
25
18
  cancelButton?: string,
26
19
  children: array<React.ReactNode> | React.ReactNode | string,
@@ -38,7 +31,6 @@ type DialogProps = {
38
31
  portalClassName?: string,
39
32
  shouldCloseOnOverlayClick: boolean,
40
33
  size?: "sm" | "md" | "lg" | "content",
41
- status?: "info" | "caution" | "delete" | "error" | "success",
42
34
  text?: string,
43
35
  title?: string,
44
36
  trigger?: string
@@ -46,7 +38,6 @@ type DialogProps = {
46
38
 
47
39
  const Dialog = (props: DialogProps) => {
48
40
  const {
49
- alertStyle = "default",
50
41
  aria = {},
51
42
  cancelButton,
52
43
  confirmButton,
@@ -62,7 +53,6 @@ const Dialog = (props: DialogProps) => {
62
53
  onClose = () => {},
63
54
  portalClassName,
64
55
  shouldCloseOnOverlayClick = true,
65
- status,
66
56
  text,
67
57
  title,
68
58
  trigger,
@@ -88,15 +78,15 @@ const Dialog = (props: DialogProps) => {
88
78
  className
89
79
  )
90
80
 
91
- const [triggerOpened, setTriggerOpened] = useState(false),
92
- modalIsOpened = trigger ? triggerOpened : opened
93
-
94
81
  const api = {
95
82
  onClose: trigger ? function(){
96
83
  setTriggerOpened(false)
97
84
  } : onClose,
98
85
  }
99
86
 
87
+ const [triggerOpened, setTriggerOpened] = useState(false),
88
+ modalIsOpened = trigger ? triggerOpened : opened
89
+
100
90
  if (trigger) {
101
91
  const modalTrigger = document.querySelector(trigger)
102
92
  modalTrigger.addEventListener('click', () => {
@@ -107,29 +97,6 @@ const Dialog = (props: DialogProps) => {
107
97
  }, { once: true })
108
98
  }
109
99
 
110
- const sweetAlertStatus = {
111
- info: {
112
- icon: "exclamation-circle",
113
- variant: "default",
114
- },
115
- caution: {
116
- icon: "triangle-warning",
117
- variant: "yellow",
118
- },
119
- delete: {
120
- icon: "trash",
121
- variant: "red",
122
- },
123
- error: {
124
- icon: "times-circle",
125
- variant: "red",
126
- },
127
- success: {
128
- icon: "check-circle",
129
- variant: "green",
130
- },
131
- }
132
-
133
100
  return (
134
101
  <DialogContext.Provider value={api}>
135
102
  <div
@@ -138,7 +105,6 @@ const Dialog = (props: DialogProps) => {
138
105
  className={classes}
139
106
  >
140
107
  <Modal
141
- alertStyle={alertStyle}
142
108
  ariaHideApp={false}
143
109
  className={dialogClassNames}
144
110
  closeTimeoutMS={200}
@@ -149,28 +115,14 @@ const Dialog = (props: DialogProps) => {
149
115
  overlayClassName={overlayClassNames}
150
116
  portalClassName={portalClassName}
151
117
  shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
152
- status={status}
153
118
  >
154
- <Dialog.Body>
155
- <Flex align='center'
156
- orientation='column'
157
- >
158
- <If condition = {sweetAlertStatus[status]}>
159
- <IconCircle
160
- icon={sweetAlertStatus[status].icon}
161
- variant={sweetAlertStatus[status].variant}
162
- />
163
- </If>
164
- <Title marginY='sm'
165
- size={3}
166
- >
167
- {title}
168
- </Title>
169
- <Body marginY='xs'
170
- text={text}
171
- />
172
- </Flex>
173
- </Dialog.Body>
119
+ <If condition={title}>
120
+ <Dialog.Header>{title}</Dialog.Header>
121
+ </If>
122
+ <If condition={text}>
123
+ <Dialog.Body>{text}</Dialog.Body>
124
+ </If>
125
+
174
126
  <If condition={cancelButton && confirmButton}>
175
127
  <Dialog.Footer>
176
128
  <Button
@@ -179,14 +131,16 @@ const Dialog = (props: DialogProps) => {
179
131
  >
180
132
  {confirmButton}
181
133
  </Button>
182
- <Button id='cancel-button'
134
+ <Button
135
+ id="cancel-button"
183
136
  onClick={onCancel}
184
- variant='link'
137
+ variant="link"
185
138
  >
186
139
  {cancelButton}
187
140
  </Button>
188
141
  </Dialog.Footer>
189
142
  </If>
143
+
190
144
  {children}
191
145
  </Modal>
192
146
  </div>
@@ -11,7 +11,7 @@ const DialogDefault = () => {
11
11
  <>
12
12
  <Button onClick={open}>{'Open Dialog'}</Button>
13
13
  <Dialog
14
- cancelButton="Cancel Button"
14
+ cancelButton="Cancel"
15
15
  className="wrapper"
16
16
  confirmButton="Okay"
17
17
  loading={isLoading}
@@ -8,5 +8,3 @@ examples:
8
8
  - dialog_sizes: Sizes
9
9
  - dialog_scrollable: Scrollable
10
10
  - dialog_should_close_on_overlay: Overlay Click
11
- - dialog_status: Status Alert
12
- - dialog_stacked_alert: Stacked Button Alert
@@ -4,5 +4,3 @@ export { default as DialogSizes } from './_dialog_sizes.jsx'
4
4
  export { default as DialogScrollable } from './_dialog_scrollable.jsx'
5
5
  export { default as DialogSeparators } from './_dialog_separators.jsx'
6
6
  export { default as DialogShouldCloseOnOverlay } from './_dialog_should_close_on_overlay.jsx'
7
- export { default as DialogStatus } from './_dialog_status.jsx'
8
- export { default as DialogStackedAlert } from './_dialog_stacked_alert.jsx'
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbHomeAddressStreet
5
+ class CityEmphasis < Playbook::KitBase
6
+ prop :address_house_style
7
+ prop :address_house_style2
8
+ prop :city_state
9
+ prop :home_id, type: Playbook::Props::Number
10
+ prop :home_url
11
+ prop :territory
12
+ prop :zip
13
+ prop :dark, type: Playbook::Props::Boolean, default: false
14
+ end
15
+ end
16
+ end
@@ -5,8 +5,6 @@ examples:
5
5
  - home_address_street_emphasis: Emphasis
6
6
  - home_address_street_modified: Modified
7
7
 
8
-
9
-
10
8
  react:
11
9
  - home_address_street_default: Default
12
10
  - home_address_street_emphasis: Emphasis
@@ -2,5 +2,6 @@
2
2
  id: object.id,
3
3
  data: object.data,
4
4
  class: object.classname) do %>
5
- <%= render file: object.emphasis_partial, locals: { object: object } %>
6
- <% end %>
5
+ <%= pb_rails("home_address_street/#{emphasis}_emphasis", props: object.send("#{emphasis}_emphasis_props")) %>
6
+ <% end %>
7
+
@@ -45,8 +45,29 @@ module Playbook
45
45
  house_style ? " \u00b7 " : ""
46
46
  end
47
47
 
48
- def emphasis_partial
49
- File.join(File.dirname(self.class.source_location), "_#{emphasis}_emphasis")
48
+ def city_emphasis_props
49
+ {
50
+ address_house_style: address_house_style,
51
+ address_house_style2: address_house_style2,
52
+ city_state: city_state,
53
+ dark: dark,
54
+ home_id: home_id,
55
+ home_url: home_url,
56
+ territory: territory,
57
+ zip: zip,
58
+ }
59
+ end
60
+
61
+ def street_emphasis_props
62
+ {
63
+ address_house_style: address_house_style,
64
+ address_house_style2: address_house_style2,
65
+ city_state_zip: city_state_zip,
66
+ dark: dark,
67
+ home_id: home_id,
68
+ home_url: home_url,
69
+ territory: territory,
70
+ }
50
71
  end
51
72
 
52
73
  private
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbHomeAddressStreet
5
+ class StreetEmphasis < Playbook::KitBase
6
+ prop :address_house_style
7
+ prop :address_house_style2
8
+ prop :city_state_zip
9
+ prop :home_id, type: Playbook::Props::Number
10
+ prop :home_url
11
+ prop :territory
12
+ prop :dark, type: Playbook::Props::Boolean, default: false
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,78 @@
1
+ /* @flow */
2
+ /*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
3
+
4
+ import React, { forwardRef } from 'react'
5
+ import Body from '../pb_body/_body'
6
+ import classnames from 'classnames'
7
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
+ import { globalProps } from '../utilities/globalProps'
9
+
10
+ type RadioProps = {
11
+ aria?: object,
12
+ alignment?: String,
13
+ checked?: Boolean,
14
+ children?: Node,
15
+ className?: String,
16
+ dark?: boolean,
17
+ data?: object,
18
+ error?: Boolean,
19
+ id?: String,
20
+ label: String,
21
+ name: String,
22
+ value: String,
23
+ text: String,
24
+ onChange: (Boolean)=>void,
25
+ }
26
+
27
+ const Radio = ({
28
+ aria = {},
29
+ alignment = '',
30
+ children,
31
+ className,
32
+ dark = false,
33
+ data = {},
34
+ error = false,
35
+ id,
36
+ label,
37
+ name = 'radio_name',
38
+ text = 'Radio Text',
39
+ value = 'radio_text',
40
+ onChange = () => {},
41
+ ...props
42
+ }: RadioProps, ref) => {
43
+ const ariaProps = buildAriaProps(aria)
44
+ const dataProps = buildDataProps(data)
45
+ const classes = classnames(buildCss('pb_radio_kit'), { error }, { dark }, globalProps(props), alignment, className)
46
+
47
+ return (
48
+ <label
49
+ {...ariaProps}
50
+ {...dataProps}
51
+ className={classes}
52
+ htmlFor={id}
53
+ >
54
+ <If condition={children}>
55
+ {children}
56
+ <Else />
57
+ <input
58
+ {...props}
59
+ id={id}
60
+ name={name}
61
+ onChange={onChange}
62
+ ref={ref}
63
+ text={text}
64
+ type="radio"
65
+ value={value}
66
+ />
67
+ </If>
68
+ <span className="pb_radio_button" />
69
+ <Body
70
+ dark={dark}
71
+ status={error ? 'negative' : null}
72
+ text={label}
73
+ />
74
+ </label>
75
+ )
76
+ }
77
+
78
+ export default forwardRef(Radio)
@@ -1 +1 @@
1
- Use this as value for displaying number data at a high level. It’s primary function is to create hierarchy of data within a view.
1
+ Use this as value for displaying number data at a high level. It’s primary function is to create hierarchy of data within a view.
@@ -0,0 +1,3 @@
1
+ <%= pb_rails("stat_value", props: { value: 1529.00000, precision: 2 }) %>
2
+
3
+ <%= pb_rails("stat_value", props: { value: 1529.13, precision: 4 }) %>
@@ -0,0 +1,2 @@
1
+ Use this to specify how many decimal places you want to show.
2
+ In react, you can pass in a string or number, but for this rails kit, we only accept numeric values and rails will not show trailing zero's unless specified.
@@ -3,6 +3,7 @@ examples:
3
3
  rails:
4
4
  - stat_value_default: Default
5
5
  - stat_value_unit: Unit Value
6
+ - stat_value_precision: Precision Value
6
7
 
7
8
 
8
9
  react:
@@ -5,9 +5,14 @@ module Playbook
5
5
  class StatValue < Playbook::KitBase
6
6
  prop :unit
7
7
  prop :value, type: Playbook::Props::Numeric
8
+ prop :precision, type: Playbook::Props::Numeric
8
9
 
9
10
  def formatted_value
10
- number_with_delimiter(value, delimiter: ",", separator: ".")
11
+ if precision.nil?
12
+ number_with_delimiter(value, delimiter: ",", separator: ".")
13
+ else
14
+ number_with_precision(value, precision: precision, delimiter: ",", separator: ".")
15
+ end
11
16
  end
12
17
 
13
18
  def classname
@@ -24,7 +24,7 @@ module Playbook
24
24
  extend ActiveSupport::Concern
25
25
 
26
26
  attr_accessor :values
27
- private :values, :values=
27
+ private :values=
28
28
 
29
29
  def initialize(prop_values = {}, &block)
30
30
  self.values = { children: block }.merge(Hash(prop_values))
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "10.26.0"
5
- VERSION = "11.0.0"
4
+ PREVIOUS_VERSION = "11.1.0"
5
+ VERSION = "11.1.1.pre.alpha1"
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: 11.0.0
4
+ version: 11.1.1.pre.alpha1
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-06-08 00:00:00.000000000 Z
12
+ date: 2022-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -604,6 +604,8 @@ files:
604
604
  - app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.jsx
605
605
  - app/pb_kits/playbook/pb_currency/docs/_currency_alignment.html.erb
606
606
  - app/pb_kits/playbook/pb_currency/docs/_currency_alignment.jsx
607
+ - app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals.html.erb
608
+ - app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals.jsx
607
609
  - app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol.html.erb
608
610
  - app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol.jsx
609
611
  - app/pb_kits/playbook/pb_currency/docs/_currency_size.html.erb
@@ -800,10 +802,6 @@ files:
800
802
  - app/pb_kits/playbook/pb_dialog/docs/_dialog_should_close_on_overlay.jsx
801
803
  - app/pb_kits/playbook/pb_dialog/docs/_dialog_should_close_on_overlay.md
802
804
  - app/pb_kits/playbook/pb_dialog/docs/_dialog_sizes.jsx
803
- - app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.jsx
804
- - app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.md
805
- - app/pb_kits/playbook/pb_dialog/docs/_dialog_status.jsx
806
- - app/pb_kits/playbook/pb_dialog/docs/_dialog_status.md
807
805
  - app/pb_kits/playbook/pb_dialog/docs/example.yml
808
806
  - app/pb_kits/playbook/pb_dialog/docs/index.js
809
807
  - app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx
@@ -1021,10 +1019,10 @@ files:
1021
1019
  - app/pb_kits/playbook/pb_highlight/docs/index.js
1022
1020
  - app/pb_kits/playbook/pb_highlight/highlight.html.erb
1023
1021
  - app/pb_kits/playbook/pb_highlight/highlight.rb
1024
- - app/pb_kits/playbook/pb_home_address_street/_city_emphasis.html.erb
1025
1022
  - app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx
1026
1023
  - app/pb_kits/playbook/pb_home_address_street/_home_address_street.scss
1027
- - app/pb_kits/playbook/pb_home_address_street/_street_emphasis.html.erb
1024
+ - app/pb_kits/playbook/pb_home_address_street/city_emphasis.html.erb
1025
+ - app/pb_kits/playbook/pb_home_address_street/city_emphasis.rb
1028
1026
  - app/pb_kits/playbook/pb_home_address_street/docs/_description.md
1029
1027
  - app/pb_kits/playbook/pb_home_address_street/docs/_footer.md
1030
1028
  - app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb
@@ -1039,6 +1037,8 @@ files:
1039
1037
  - app/pb_kits/playbook/pb_home_address_street/docs/index.js
1040
1038
  - app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb
1041
1039
  - app/pb_kits/playbook/pb_home_address_street/home_address_street.rb
1040
+ - app/pb_kits/playbook/pb_home_address_street/street_emphasis.html.erb
1041
+ - app/pb_kits/playbook/pb_home_address_street/street_emphasis.rb
1042
1042
  - app/pb_kits/playbook/pb_icon/_icon.scss
1043
1043
  - app/pb_kits/playbook/pb_icon/_icon.tsx
1044
1044
  - app/pb_kits/playbook/pb_icon/docs/_description.md
@@ -1491,8 +1491,8 @@ files:
1491
1491
  - app/pb_kits/playbook/pb_progress_step/progress_step.rb
1492
1492
  - app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb
1493
1493
  - app/pb_kits/playbook/pb_progress_step/progress_step_item.rb
1494
+ - app/pb_kits/playbook/pb_radio/_radio.jsx
1494
1495
  - app/pb_kits/playbook/pb_radio/_radio.scss
1495
- - app/pb_kits/playbook/pb_radio/_radio.tsx
1496
1496
  - app/pb_kits/playbook/pb_radio/docs/_description.md
1497
1497
  - app/pb_kits/playbook/pb_radio/docs/_footer.md
1498
1498
  - app/pb_kits/playbook/pb_radio/docs/_radio_alignment.html.erb
@@ -1694,6 +1694,8 @@ files:
1694
1694
  - app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.html.erb
1695
1695
  - app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.jsx
1696
1696
  - app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.md
1697
+ - app/pb_kits/playbook/pb_stat_value/docs/_stat_value_precision.html.erb
1698
+ - app/pb_kits/playbook/pb_stat_value/docs/_stat_value_precision.md
1697
1699
  - app/pb_kits/playbook/pb_stat_value/docs/_stat_value_unit.html.erb
1698
1700
  - app/pb_kits/playbook/pb_stat_value/docs/_stat_value_unit.jsx
1699
1701
  - app/pb_kits/playbook/pb_stat_value/docs/example.yml
@@ -2222,9 +2224,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
2222
2224
  version: '0'
2223
2225
  required_rubygems_version: !ruby/object:Gem::Requirement
2224
2226
  requirements:
2225
- - - ">="
2227
+ - - ">"
2226
2228
  - !ruby/object:Gem::Version
2227
- version: '0'
2229
+ version: 1.3.1
2228
2230
  requirements: []
2229
2231
  rubygems_version: 3.3.7
2230
2232
  signing_key:
@@ -1,153 +0,0 @@
1
- /* eslint-disable react/jsx-handler-names */
2
-
3
- import React, { useState } from "react"
4
- import { Button, Dialog, Flex, FlexItem, SectionSeparator } from "../.."
5
-
6
- const useDialog = (visible = false) => {
7
- const [opened, setOpened] = useState(visible)
8
- const toggle = () => setOpened(!opened)
9
- return [opened, toggle]
10
- }
11
-
12
- const DialogStackedAlert = () => {
13
- const [singleButtonOpen, toggleSingleButtonOpen] = useDialog()
14
- const [stackedButtonOpen, toggleStackedButtonOpen] = useDialog()
15
- const [singleLinkButtonOpen, toggleSingleLinkButtonOpen] = useDialog()
16
- const [twoLinkButtonOpen, toggleTwoLinkButtonOpen] = useDialog()
17
-
18
-
19
- const dialogs = [
20
- {
21
- status: "info",
22
- text: "Text explaining why there is an alert",
23
- title: "Are you sure?",
24
- toggle: toggleSingleButtonOpen,
25
- visible: singleButtonOpen,
26
- confirmedButton:"Ok, Thanks",
27
- },
28
- {
29
- status: "error",
30
- text: "Text explaining the error",
31
- title: "Error Message",
32
- confirmedButton:"Yes, Action",
33
- cancelledButton: "Ok, Cancel",
34
- toggle: toggleStackedButtonOpen,
35
- visible: stackedButtonOpen,
36
- },
37
- {
38
- status: "caution",
39
- text: "This is the action you will be taking",
40
- title: "Are you sure?",
41
- toggle: toggleSingleLinkButtonOpen,
42
- visible: singleLinkButtonOpen,
43
- linkConfirmedButton:"Ok, Thanks!"
44
- },
45
- {
46
- status: "success",
47
- text: "Text explaining what is successful",
48
- title: "Success",
49
- toggle: toggleTwoLinkButtonOpen,
50
- visible: twoLinkButtonOpen,
51
- linkConfirmedButton:"Ok",
52
- linkCancelledButton: "Cancel"
53
- }
54
- ]
55
-
56
- return (
57
- <div>
58
- <Flex>
59
- <Button
60
- marginX="md"
61
- onClick={toggleSingleButtonOpen}
62
- >
63
- {"1 Button Information Status"}
64
- </Button>
65
- <Button
66
- marginX="md"
67
- onClick={toggleStackedButtonOpen}
68
- >
69
- {"2 Button Error Status"}
70
- </Button>
71
- <Button
72
- marginX="md"
73
- onClick={toggleSingleLinkButtonOpen}
74
- >
75
- {"1 Link Button Caution"}
76
- </Button>
77
- <Button
78
- marginX="md"
79
- onClick={toggleTwoLinkButtonOpen}
80
- >
81
- {"2 Link Button Success"}
82
- </Button>
83
- </Flex>
84
- <Flex>
85
- {dialogs.map((dialog) => (
86
- <Dialog
87
- alertStyle={dialog.alertStyle}
88
- key={dialog.status}
89
- onClose={dialog.toggle}
90
- opened={dialog.visible}
91
- size="sm"
92
- status={dialog.status}
93
- text={dialog.text}
94
- title={dialog.title}
95
- >
96
- <If condition={dialog.cancelledButton || dialog.confirmedButton}>
97
- <Dialog.Footer>
98
- <Button
99
- fullWidth
100
- onClick={dialog.toggle}
101
- >
102
- {dialog.confirmedButton}
103
- </Button>
104
- </Dialog.Footer>
105
- <If condition={dialog.cancelledButton}>
106
- <Dialog.Footer paddingTop="none">
107
- <Button
108
- fullWidth
109
- onClick={dialog.toggle}
110
- variant="secondary"
111
- >
112
- {dialog.cancelledButton}
113
- </Button>
114
- </Dialog.Footer>
115
- </If>
116
- </If>
117
- <If condition={dialog.linkCancelledButton || dialog.linkConfirmedButton} >
118
- <SectionSeparator />
119
- <Flex
120
- inline="flex-container"
121
- vertical="stretch"
122
- >
123
- <FlexItem flex={1} >
124
- <Button
125
- fullWidth
126
- onClick={dialog.toggle}
127
- variant="link"
128
- >
129
- {dialog.linkConfirmedButton}
130
- </Button>
131
- </FlexItem>
132
- <If condition={dialog.linkCancelledButton}>
133
- <SectionSeparator orientation="vertical"/>
134
- <FlexItem flex={1}>
135
- <Button
136
- fullWidth
137
- onClick={dialog.toggle}
138
- variant="link"
139
- >
140
- {dialog.linkCancelledButton}
141
- </Button>
142
- </FlexItem>
143
- </If>
144
- </Flex>
145
- </If>
146
- </Dialog>
147
- ))}
148
- </Flex>
149
- </div>
150
- )
151
- }
152
-
153
- export default DialogStackedAlert
@@ -1 +0,0 @@
1
- This is designed to show you how the buttons can stack with different alert styles. It also has a link style for the buttons for the mobile views.
@@ -1,130 +0,0 @@
1
- /* eslint-disable react/jsx-handler-names */
2
- /* @flow */
3
-
4
- import React, { useState } from "react"
5
- import { Button, Dialog, Flex } from "../.."
6
-
7
- const useDialog = (visible = false) => {
8
- const [opened, setOpened] = useState(visible)
9
- const toggle = () => setOpened(!opened)
10
- return [opened, toggle]
11
-
12
- }
13
-
14
- const DialogStatus = () => {
15
- const [infoAlertOpened, toggleInfoAlert] = useDialog()
16
- const [cautionAlertOpened, toggleCautionAlert] = useDialog()
17
- const [successAlertOpened, toggleSuccessAlert] = useDialog()
18
- const [errorAlertOpened, toggleErrorAlert] = useDialog()
19
- const [deleteAlertOpened, toggleDeleteAlert] = useDialog()
20
-
21
- const dialogs = [
22
- {
23
- status: "info",
24
- text: "Text explaining why there is an alert",
25
- title: "Are you Sure?",
26
- toggle: toggleInfoAlert,
27
- visible: infoAlertOpened,
28
- buttonOneText:"No, Cancel",
29
- buttonTwoText: "Yes, Action"
30
- },
31
- {
32
- status: "caution",
33
- text: "This is the action you will be taking",
34
- title: "Are you Sure?",
35
- toggle: toggleCautionAlert,
36
- visible: cautionAlertOpened,
37
- buttonOneText:"No, Cancel",
38
- buttonTwoText: "Yes, Action"
39
- },
40
- {
41
- status: "delete",
42
- text: "You are about to delete ...",
43
- title: "Delete",
44
- toggle: toggleDeleteAlert,
45
- visible: deleteAlertOpened,
46
- buttonOneText:"No, Cancel",
47
- buttonTwoText: "Yes, Delete"
48
- },
49
- {
50
- status: "error",
51
- text: "Text explaining the error",
52
- title: "Error Message",
53
- toggle: toggleErrorAlert,
54
- visible: errorAlertOpened,
55
- buttonOneText:"No, Cancel",
56
- buttonTwoText: "Ok, Thanks"
57
- },
58
- {
59
- status: "success",
60
- text: "Text explaining what is successful",
61
- title: "Success!",
62
- toggle: toggleSuccessAlert,
63
- visible: successAlertOpened,
64
- buttonOneText:"No, Cancel",
65
- buttonTwoText: "Ok, Thanks"
66
- },
67
- ]
68
-
69
- return (
70
- <div>
71
- <Flex>
72
- <Button
73
- marginX="md"
74
- onClick={toggleInfoAlert}
75
- >
76
- {"Information Status"}
77
- </Button>
78
- <Button
79
- marginX="md"
80
- onClick={toggleCautionAlert}
81
- >
82
- {"Caution Status"}
83
- </Button>
84
- <Button
85
- marginX="md"
86
- onClick={toggleSuccessAlert}
87
- >
88
- {"Success Status"}
89
- </Button>
90
- <Button onClick={toggleErrorAlert}>
91
- {"Error Status"}
92
- </Button>
93
- <Button
94
- marginX="md"
95
- onClick={toggleDeleteAlert}
96
- >
97
- {"Delete Status"}
98
- </Button>
99
- </Flex>
100
- <Flex>
101
- {dialogs.map((dialog) => (
102
- <Dialog
103
- key={dialog.status}
104
- onClose={dialog.toggle}
105
- opened={dialog.visible}
106
- status={dialog.status}
107
- text={dialog.text}
108
- title={dialog.title}
109
- >
110
- <Dialog.Footer>
111
- <Button
112
- onClick={dialog.toggle}
113
- variant="secondary"
114
- >
115
- {dialog.buttonOneText}
116
- </Button>
117
- <Button
118
- onClick={dialog.toggle}
119
- >
120
- {dialog.buttonTwoText}
121
- </Button>
122
- </Dialog.Footer>
123
- </Dialog>
124
- ))}
125
- </Flex>
126
- </div>
127
- )
128
- }
129
-
130
- export default DialogStatus
@@ -1 +0,0 @@
1
- This shows the different alert statuses that can be used for dialog boxes. These all have two buttons which is a default
@@ -1,86 +0,0 @@
1
- /*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
2
-
3
- import React, { forwardRef } from 'react'
4
- import Body from '../pb_body/_body'
5
- import classnames from 'classnames'
6
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
- import { globalProps, GlobalProps } from '../utilities/globalProps'
8
-
9
- type RadioProps = {
10
- aria?: {[key: string]: string},
11
- alignment?: string,
12
- checked?: boolean,
13
- children?: Node,
14
- className?: string,
15
- dark?: boolean,
16
- data?: {[key: string]: string},
17
- error?: boolean,
18
- id?: string,
19
- label: string,
20
- name: string,
21
- value: string,
22
- text: string,
23
- onChange: (event: React.FormEvent<HTMLInputElement>)=>void,
24
- } & GlobalProps
25
-
26
- const Radio = ({
27
- aria = {},
28
- alignment,
29
- children,
30
- className,
31
- dark = false,
32
- data = {},
33
- error = false,
34
- id,
35
- label,
36
- name = 'radio_name',
37
- text = 'Radio Text',
38
- value = 'radio_text',
39
- onChange = () => {},
40
- ...props
41
- }: RadioProps, ref: any) => {
42
- const ariaProps = buildAriaProps(aria)
43
- const dataProps = buildDataProps(data)
44
- const classes = classnames(
45
- buildCss('pb_radio_kit', alignment ),
46
- dark ? 'dark': null, error ? 'error': null,
47
- globalProps(props),
48
- className)
49
-
50
- const displayRadio = (props: RadioProps) => {
51
- if (children)
52
- return (children)
53
- else
54
- return (
55
- <input
56
- id={id}
57
- name={name}
58
- onChange={onChange}
59
- ref={ref}
60
- text={text}
61
- type="radio"
62
- value={value}
63
- {...props}
64
- />
65
- )}
66
-
67
- return (
68
- <label
69
- {...ariaProps}
70
- {...dataProps}
71
- className={classes}
72
- htmlFor={id}
73
- >
74
- <>{displayRadio(null)}</>
75
- <span className="pb_radio_button" />
76
- <Body
77
- dark={dark}
78
- status={error ? 'negative' : null}
79
- text={label}
80
- variant={null}
81
- />
82
- </label>
83
- )
84
- }
85
-
86
- export default forwardRef(Radio)