playbook_ui 11.1.0 → 11.1.1.pre.alpha1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3c49612b5ff10431ef8ef79803f630de5aafe8dfcdfea74dc234cfba6920af1
4
- data.tar.gz: e1199ebbc2ec5ecd70229ddef6500a1ebb9a0a31d0e25623d63a0e46034f36c9
3
+ metadata.gz: 187ac4ecc55b431fc4c30a316c1cf4b0e137b2c7a1956931636b66f79bfbce7e
4
+ data.tar.gz: ace3fd58252e59d2e97be20a23bc563b4fc243e6d9325cba616ada666d4b5942
5
5
  SHA512:
6
- metadata.gz: 5fe817795f69f7ab21303aa4f0f0f2a72378df01785421a49984bf4058e7253b2901747607c66ad49c8dcd20153fa746d717a67cfaf572fabd96e3910f2708ab
7
- data.tar.gz: e6598e368c84ef4c8473470bcb756ca2313fccad7d3d8fde22c5df5013773b9e4a4e449daf0f2a25f323f98107f6a46073cb6f0c9372ff644f1e77b409c0959d
6
+ metadata.gz: 61c1344a4ca56732440d0b00fc2cc3a8783f828f331b9561ab7b679e9d6e48c7019b24aadeea31cc808a14be3cd079fa98af43a9852c7f431548c032dfa62a76
7
+ data.tar.gz: 7a57d012285cb509b304fa482b6b8d0db59fd9fa57a29c8464312eb2bb03be40ab49979a2efd9546cd9d6894c5fc8db98c1d81e157705ac53e560a67be03502e
@@ -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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "11.0.1"
5
- VERSION = "11.1.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.1.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-07-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
@@ -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,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)