playbook_ui 3.2.0 → 3.3.0

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/index.js +1 -0
  4. data/app/pb_kits/playbook/kits/pb_radio.js +4 -0
  5. data/app/pb_kits/playbook/packs/examples.js +2 -0
  6. data/app/pb_kits/playbook/packs/kits.js +1 -0
  7. data/app/pb_kits/playbook/pb_caption/_caption.jsx +2 -2
  8. data/app/pb_kits/playbook/pb_card/_card.jsx +17 -24
  9. data/app/pb_kits/playbook/pb_card/_card.scss +2 -2
  10. data/app/pb_kits/playbook/pb_checkbox/_checkbox.html.erb +12 -8
  11. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +16 -8
  12. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +8 -0
  13. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom.html.erb +3 -0
  14. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom.jsx +18 -0
  15. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -0
  16. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  17. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.jsx +19 -11
  18. data/app/pb_kits/playbook/pb_radio/_radio.html.erb +16 -0
  19. data/app/pb_kits/playbook/pb_radio/_radio.jsx +63 -0
  20. data/app/pb_kits/playbook/pb_radio/_radio.scss +40 -0
  21. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom.html.erb +27 -0
  22. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom.jsx +43 -0
  23. data/app/pb_kits/playbook/pb_radio/docs/_radio_dark.html.erb +25 -0
  24. data/app/pb_kits/playbook/pb_radio/docs/_radio_dark.jsx +30 -0
  25. data/app/pb_kits/playbook/pb_radio/docs/_radio_default.html.erb +22 -0
  26. data/app/pb_kits/playbook/pb_radio/docs/_radio_default.jsx +27 -0
  27. data/app/pb_kits/playbook/pb_radio/docs/example.yml +14 -0
  28. data/app/pb_kits/playbook/pb_radio/docs/index.js +3 -0
  29. data/app/pb_kits/playbook/pb_radio/radio.rb +46 -0
  30. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +15 -9
  31. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_custom.html.erb +3 -0
  32. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_custom.jsx +20 -0
  33. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb +1 -1
  34. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +2 -0
  35. data/app/pb_kits/playbook/pb_text_input/docs/index.js +1 -0
  36. data/lib/playbook/version.rb +1 -1
  37. metadata +21 -5
  38. data/app/pb_kits/playbook/pb_select/docs/nitro_theme.gemspec +0 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '091fb82d4b72e38e904355eedf2f54d2f61a9dab454b1f8351fb8a393f7c0e34'
4
- data.tar.gz: 1bf6b5a09020e9af107074ca3cdfef7f9703e7775e02b9299f98a0482a5d62b2
3
+ metadata.gz: '0624588df3f0146bc99a772eea3c4c8efc06b3a5299aea28ec1cdf3ad4320071'
4
+ data.tar.gz: 76e97087be0d0b643a645e48d0ba6c020f5dbfb3c153ca7ff8f5004c45372e7e
5
5
  SHA512:
6
- metadata.gz: e895bb02b0fb481de91c732593fe5d76e3fa9d05cca4a323a3c91a87599a8ad9ac1111602caa3bd87eae1220ebdb1af874179281ced73daaa525254c7f222a98
7
- data.tar.gz: 05f3ede8352b44a1abd8804a550e7372b87f29a8363e28f25481bc9ff329dde2d56737ce05042b5c36ade529967da431bd8e30054460e19313e2add378252183
6
+ metadata.gz: 343f4902e4562ca958b73ac21a3c2b8fb5549a9133d6d9ae134b0ad0194eb2f1be9df329563454af7be4dd792a35d956a30cb9a19d441bc6bbfb449ac2f2451a
7
+ data.tar.gz: bbd5040560708a09b452103e13ddbbaa9ca6d4e669f06d3fdb129978034bdb5c68ce605c6d9897c3ba07311ca4957ec0d55315bfb78ff0042d610be57ebe2548
@@ -40,6 +40,7 @@
40
40
  @import 'pb_pill/pill';
41
41
  @import 'pb_progress_pills/progress_pills';
42
42
  @import 'pb_progress_simple/progress_simple';
43
+ @import 'pb_radio/radio';
43
44
  @import 'pb_section_separator/section_separator';
44
45
  @import 'pb_select/select';
45
46
  @import 'pb_selectable_card/selectable_card';
@@ -41,6 +41,7 @@ export PersonContact from './pb_person_contact/_person_contact.jsx'
41
41
  export Pill from './pb_pill/_pill.jsx'
42
42
  export ProgressPills from './pb_progress_pills/_progress_pills.jsx'
43
43
  export ProgressSimple from './pb_progress_simple/_progress_simple.jsx'
44
+ export Radio from './pb_radio/_radio.jsx'
44
45
  export SectionSeparator from './pb_section_separator/_section_separator.jsx'
45
46
  export Select from './pb_select/_select.jsx'
46
47
  export SelectableCard from './pb_selectable_card/_selectable_card.jsx'
@@ -0,0 +1,4 @@
1
+ import Radio from '../pb_radio/_radio.jsx'
2
+
3
+ import WebpackerReact from 'webpacker-react'
4
+ WebpackerReact.setup({ Radio })
@@ -52,6 +52,7 @@ import * as PersonContact from 'pb_person_contact/docs'
52
52
  import * as Pill from 'pb_pill/docs'
53
53
  import * as ProgressPills from 'pb_progress_pills/docs'
54
54
  import * as ProgressSimple from 'pb_progress_simple/docs'
55
+ import * as Radio from 'pb_radio/docs'
55
56
  import * as SectionSeparator from 'pb_section_separator/docs'
56
57
  import * as Select from 'pb_select/docs'
57
58
  import * as SelectableCard from 'pb_selectable_card/docs'
@@ -111,6 +112,7 @@ WebpackerReact.setup(PersonContact)
111
112
  WebpackerReact.setup(Pill)
112
113
  WebpackerReact.setup(ProgressPills)
113
114
  WebpackerReact.setup(ProgressSimple)
115
+ WebpackerReact.setup(Radio)
114
116
  WebpackerReact.setup(SectionSeparator)
115
117
  WebpackerReact.setup(Select)
116
118
  WebpackerReact.setup(SelectableCard)
@@ -37,6 +37,7 @@ import '../kits/pb_person_contact.js'
37
37
  import '../kits/pb_pill.js'
38
38
  import '../kits/pb_progress_pills.js'
39
39
  import '../kits/pb_progress_simple.js'
40
+ import '../kits/pb_radio.js'
40
41
  import '../kits/pb_section_separator.js'
41
42
  import '../kits/pb_select.js'
42
43
  import '../kits/pb_selectable_card.js'
@@ -23,9 +23,9 @@ const Caption = ({
23
23
  }: CaptionProps) => {
24
24
  const Tag = `${tag}`
25
25
 
26
- const css = classnames(className, buildCss('pb_caption_kit', size, {
26
+ const css = classnames(buildCss('pb_caption_kit', size, {
27
27
  'dark': dark,
28
- }))
28
+ }), className)
29
29
 
30
30
  return (
31
31
  <Tag className={css}>
@@ -3,11 +3,13 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
+ import { buildCss } from '../utilities/props'
7
+
6
8
  type CardPropTypes = {
7
9
  children: Array<React.ReactNode> | React.ReactNode,
8
10
  className?: String,
9
11
  highlight?: {
10
- position?: String,
12
+ position?: 'side' | 'top',
11
13
  color?: String
12
14
  },
13
15
  padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
@@ -15,35 +17,26 @@ type CardPropTypes = {
15
17
  shadow?: 'none' | 'shallow' | 'default' | 'deep' | 'deeper' | 'deepest',
16
18
  }
17
19
 
18
- const cardCSS = ({
20
+ const Card = ({
21
+ children,
22
+ className,
19
23
  highlight = {},
24
+ padding = 'md',
20
25
  selected = false,
21
26
  shadow = 'none',
22
27
  }: CardPropTypes) => {
23
- let css = 'pb_card_kit'
24
- css += highlight.position ? `_highlight_${highlight.position}` : ''
25
- css += highlight.color ? `_highlight_${highlight.color}` : ''
26
- css += selected ? '_selected' : '_deselected'
27
- css += `_shadow_${shadow}`
28
- return css
29
- }
30
-
31
- const bodyCSS = ({ padding = 'md' }: CardPropTypes) => {
32
- let css = 'pb_card_body_kit'
33
- css += `_${padding}`
34
- return css
35
- }
36
-
37
- const Card = (props: CardPropTypes) => {
38
- const {
39
- children,
40
- className,
41
- } = props
28
+ const bodyCSS = buildCss('pb_card_body_kit', padding)
29
+ const cardCss = buildCss('pb_card_kit', `shadow_${shadow}`, {
30
+ selected,
31
+ deselected: !selected,
32
+ [`highlight_${highlight.position}`]: highlight.position,
33
+ [`highlight_${highlight.color}`]: highlight.color,
34
+ })
42
35
 
43
36
  return (
44
- <div className={classnames(cardCSS(props), className)}>
45
- <div className={bodyCSS(props)}>
46
- { children }
37
+ <div className={classnames(cardCss, className)}>
38
+ <div className={bodyCSS}>
39
+ {children}
47
40
  </div>
48
41
  </div>
49
42
  )
@@ -80,7 +80,7 @@ $pb_card_highlight_size: 4px;
80
80
  overflow: hidden;
81
81
  }
82
82
 
83
- &[class*=_highlight_side] {
83
+ &[class*=_highlight_top] {
84
84
  @each $color_name, $color_value in $pb_card_highlight_colors {
85
85
  &[class*=_highlight_#{$color_name}]::before {
86
86
  @include pb_card_highlight(100%, $pb_card_highlight_size, $color_value);
@@ -88,7 +88,7 @@ $pb_card_highlight_size: 4px;
88
88
  }
89
89
  }
90
90
 
91
- &[class*=_highlight_top] {
91
+ &[class*=_highlight_side] {
92
92
  @each $color_name, $color_value in $pb_card_highlight_colors {
93
93
  &[class*=_highlight_#{$color_name}]::before {
94
94
  @include pb_card_highlight($pb_card_highlight_size, 100%, $color_value);
@@ -1,11 +1,15 @@
1
1
  <%= content_tag(:label, id: object.id,
2
2
  data: object.data,
3
- class: object.classname) do %>
4
- <input type="checkbox" value="<%=object.value%>" name="<%=object.name%>" <%= object.checked_html %>>
5
- <span class="pb_checkbox_checkmark">
6
- <%= pb_rails("icon", props: { icon: "check", id: "check_icon", classname: "check_icon", fixed_width: true}) %>
7
- </span>
8
- <span class="pb_checkbox_label">
9
- <%= pb_rails("body", props: { text: object.text, dark: object.dark }) %>
10
- </span>
3
+ class: object.classname) do %>
4
+ <% if object.children %>
5
+ <%= capture(&object.children) %>
6
+ <% else %>
7
+ <%= object.input %>
8
+ <% end %>
9
+ <span class="pb_checkbox_checkmark">
10
+ <%= pb_rails("icon", props: { icon: "check", id: "check_icon", classname: "check_icon", fixed_width: true}) %>
11
+ </span>
12
+ <span class="pb_checkbox_label">
13
+ <%= pb_rails("body", props: { text: object.text, dark: object.dark }) %>
14
+ </span>
11
15
  <% end %>
@@ -10,7 +10,8 @@ type CheckboxProps = {
10
10
  name: String,
11
11
  text: String,
12
12
  value: String,
13
-
13
+ children: Node,
14
+ onChange: (Boolean) => void,
14
15
  }
15
16
 
16
17
  const Checkbox = ({
@@ -19,6 +20,8 @@ const Checkbox = ({
19
20
  name = '',
20
21
  text = '',
21
22
  value = '',
23
+ children = null,
24
+ onChange = () => {},
22
25
 
23
26
  }: CheckboxProps) => {
24
27
  const bodyClassName = {
@@ -33,13 +36,18 @@ const Checkbox = ({
33
36
  (dark === true ? '_dark' : '')
34
37
  }
35
38
  >
36
- {' '}
37
- <input
38
- defaultChecked={checked}
39
- name={name}
40
- type="checkbox"
41
- value={value}
42
- />
39
+ <If condition={children}>
40
+ {children}
41
+ <Else />
42
+ <input
43
+ defaultChecked={checked}
44
+ name={name}
45
+ onChange={onChange}
46
+ type="checkbox"
47
+ value={value}
48
+ />
49
+ </If>
50
+
43
51
  <span className="pb_checkbox_checkmark">
44
52
  <Icon
45
53
  className="check_icon"
@@ -4,6 +4,10 @@ module Playbook
4
4
  module PbCheckbox
5
5
  class Checkbox
6
6
  include Playbook::Props
7
+ include ActionView::Helpers::FormTagHelper
8
+ include ActionView::Context
9
+
10
+
7
11
 
8
12
  partial "pb_checkbox/checkbox"
9
13
 
@@ -21,6 +25,10 @@ module Playbook
21
25
  generate_classname("pb_checkbox_kit", dark_class, checked_class)
22
26
  end
23
27
 
28
+ def input
29
+ check_box_tag(name, value, checked)
30
+ end
31
+
24
32
  private
25
33
 
26
34
  def checked_class
@@ -0,0 +1,3 @@
1
+ <%= pb_rails("checkbox", props: {text: "Custom Checkbox"}) do%>
2
+ <input type="checkbox" name="custom-name" value="custom-value"/>
3
+ <% end %>
@@ -0,0 +1,18 @@
1
+ import React from 'react'
2
+ import { Checkbox } from '../../'
3
+
4
+ const CheckboxCustom = () => {
5
+ return (
6
+ <div>
7
+ <Checkbox text="Custom Checkbox">
8
+ <input
9
+ name="custom-name"
10
+ type="checkbox"
11
+ value="custom-value"
12
+ />
13
+ </Checkbox>
14
+ </div>
15
+ )
16
+ }
17
+
18
+ export default CheckboxCustom
@@ -3,7 +3,9 @@ examples:
3
3
  - checkbox_default: Default
4
4
  - checkbox_checked: Load as checked
5
5
  - checkbox_dark: Dark
6
+ - checkbox_custom: Custom Checkbox
6
7
 
7
8
  react:
8
9
  - checkbox_default: Default
9
10
  - checkbox_dark: Dark
11
+ - checkbox_custom: Custom Checkbox
@@ -1,2 +1,3 @@
1
1
  export { default as CheckboxDefault } from './_checkbox_default.jsx'
2
2
  export { default as CheckboxDark } from './_checkbox_dark.jsx'
3
+ export { default as CheckboxCustom } from './_checkbox_custom.jsx'
@@ -1,24 +1,32 @@
1
1
  /* @flow */
2
2
 
3
3
  import React from 'react'
4
+
5
+ import classnames from 'classnames'
6
+
4
7
  import { Icon } from '../'
8
+ import { buildCss } from '../utilities/props'
5
9
 
6
- const IconCircleProps = {
7
- className: String,
8
- icon: String,
9
- id: String,
10
- size: String,
11
- variant: String,
10
+ type IconCircleProps = {
11
+ className?: string,
12
+ icon: string,
13
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl',
14
+ variant?: 'default' | 'royal' | 'blue' | 'purple' | 'teal' | 'red' | 'yellow' | 'green',
12
15
  }
13
16
 
14
17
  const IconCircle = ({
18
+ className,
15
19
  icon,
16
20
  size = 'md',
17
21
  variant = 'default',
18
- }: IconCircleProps) => (
19
- <div className={`pb_icon_circle_kit_${size}_${variant}`}>
20
- <Icon icon={icon} />
21
- </div>
22
- )
22
+ }: IconCircleProps) => {
23
+ const css = buildCss('pb_icon_circle_kit', size, variant)
24
+
25
+ return (
26
+ <div className={classnames(className, css)}>
27
+ <Icon icon={icon} />
28
+ </div>
29
+ )
30
+ }
23
31
 
24
32
  export default IconCircle
@@ -0,0 +1,16 @@
1
+ <%= content_tag(:label,
2
+ id: object.id,
3
+ data: object.data,
4
+ value: object.value,
5
+ checked: object.checked,
6
+ class: object.classname) do %>
7
+
8
+ <% if object.children %>
9
+ <%= capture(&object.children) %>
10
+ <% else %>
11
+ <%= radio_button_tag object.name, object.value, object.selected %>
12
+ <% end %>
13
+
14
+ <span class="pb_radio_button"></span>
15
+ <%= pb_rails("body", props: { text: object.text, dark: object.dark}) %>
16
+ <% end %>
@@ -0,0 +1,63 @@
1
+ /* @flow */
2
+ /*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
3
+
4
+ import React from 'react'
5
+ import Body from '../pb_body/_body.jsx'
6
+
7
+ type RadioProps = {
8
+ className?: String,
9
+ data?: String,
10
+ id?: String,
11
+ label: String,
12
+ name: String,
13
+ value: String,
14
+ checked?: Boolean,
15
+ dark?: Boolean,
16
+ text: String,
17
+ children?: Node,
18
+ onChange: (Boolean)=>void,
19
+ }
20
+
21
+ const Radio = (props: RadioProps) => {
22
+ const {
23
+ checked = false,
24
+ children,
25
+ className,
26
+ dark = false,
27
+ data,
28
+ id,
29
+ label,
30
+ name,
31
+ value,
32
+ text,
33
+ onChange = () => {},
34
+ } = props
35
+
36
+ return (
37
+ <label
38
+ className={'pb_radio_kit' + (dark === true ? '_dark ' : ' ') + className}
39
+ htmlFor={id}
40
+ >
41
+ <If condition={children}>
42
+ {children}
43
+ <Else />
44
+ <input
45
+ data={data}
46
+ defaultChecked={checked}
47
+ name={name}
48
+ onChange={onChange}
49
+ text={text}
50
+ type="radio"
51
+ value={value}
52
+ />
53
+ </If>
54
+ <span className="pb_radio_button" />
55
+ <Body
56
+ dark={dark}
57
+ text={label}
58
+ />
59
+ </label>
60
+ )
61
+ }
62
+
63
+ export default Radio
@@ -0,0 +1,40 @@
1
+ @import "../tokens/colors";
2
+ @import "../tokens/spacing";
3
+ @import "../pb_body/body";
4
+ @import "../tokens/transition";
5
+
6
+ [class^=pb_radio_kit] {
7
+ display: inline-flex;
8
+
9
+ .pb_radio_button {
10
+ width: 22px;
11
+ height: 22px;
12
+ border-radius: 1000px;
13
+ border: 2px solid $border_light;
14
+ margin-right: $space_xs;
15
+ transition-property: border-color, border;
16
+ transition-duration: $transition_short;
17
+ transition-timing-function: $easeIn;
18
+ }
19
+
20
+ &:hover .pb_radio_button {
21
+ border-color: $primary_action;
22
+ }
23
+
24
+ input {
25
+ position: relative;
26
+ display: none;
27
+ &:checked ~ .pb_radio_button {
28
+ border: 6px solid $primary;
29
+ }
30
+ }
31
+ &[class*=_dark] {
32
+ input:checked ~ .pb_radio_button {
33
+ border: 6px solid $primary;
34
+ }
35
+
36
+ &:hover .pb_radio_button {
37
+ border-color: $primary_action;
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,27 @@
1
+ <%= pb_rails("radio", props: {
2
+ text: "Power",
3
+ name: "group 1",
4
+ value: "Power"
5
+ }) do %>
6
+ <input type="radio" text="power" name="group 1" value="power">
7
+ <% end %>
8
+
9
+ <br>
10
+
11
+ <%= pb_rails("radio", props: {
12
+ text: "Nitro",
13
+ name: "group 1",
14
+ value: "Power"
15
+ }) do %>
16
+ <input type="radio" text="nitro" name="group 1" value="nitro">
17
+ <% end %>
18
+
19
+ <br>
20
+
21
+ <%= pb_rails("radio", props: {
22
+ text: "Google",
23
+ name: "group 1",
24
+ value: "Google"
25
+ }) do %>
26
+ <input type="radio" text="google" name="group 1" value="google">
27
+ <% end %>
@@ -0,0 +1,43 @@
1
+ import React from 'react'
2
+ import { Radio } from '../../'
3
+
4
+ const RadioCustom = () => {
5
+ return (
6
+ <div>
7
+ <Radio
8
+ className="my_custom_class"
9
+ label="Custom Power"
10
+ >
11
+ <input
12
+ defaultChecked
13
+ name="custom"
14
+ type="radio"
15
+ value="power"
16
+ />
17
+ </Radio>
18
+ <br />
19
+ <Radio
20
+ className="my_custom_class"
21
+ label="Custom Nitro"
22
+ >
23
+ <input
24
+ name="custom"
25
+ type="radio"
26
+ value="nitro"
27
+ />
28
+ </Radio>
29
+ <br />
30
+ <Radio
31
+ className="my_custom_class"
32
+ label="Custom Google"
33
+ >
34
+ <input
35
+ name="custom"
36
+ type="radio"
37
+ value="google"
38
+ />
39
+ </Radio>
40
+ </div>
41
+ )
42
+ }
43
+ export default RadioCustom
@@ -0,0 +1,25 @@
1
+ <%= pb_rails("radio", props: {
2
+ text: "Power",
3
+ name: "group 2",
4
+ value: 'Power',
5
+ dark: true
6
+ }) %>
7
+
8
+ <br>
9
+
10
+ <%= pb_rails("radio", props: {
11
+ text: "Nitro",
12
+ name: "group 2",
13
+ value: "Nitro",
14
+ checked: true,
15
+ dark: true
16
+ }) %>
17
+
18
+ <br>
19
+
20
+ <%= pb_rails("radio", props: {
21
+ text: "Google",
22
+ name: "group 2",
23
+ value: "Google",
24
+ dark: true
25
+ }) %>
@@ -0,0 +1,30 @@
1
+ import React from 'react'
2
+ import { Radio } from '../../'
3
+
4
+ const RadioDark = () => {
5
+ return (
6
+ <div>
7
+ <Radio
8
+ dark
9
+ label="Power"
10
+ name="Group1"
11
+ value="Power"
12
+ />
13
+ <br />
14
+ <Radio
15
+ dark
16
+ label="Nitro"
17
+ name="Group1"
18
+ value="Nitro"
19
+ />
20
+ <br />
21
+ <Radio
22
+ dark
23
+ label="Google"
24
+ name="Group1"
25
+ value="Google"
26
+ />
27
+ </div>
28
+ )
29
+ }
30
+ export default RadioDark
@@ -0,0 +1,22 @@
1
+ <%= pb_rails("radio", props: {
2
+ text: "Power",
3
+ name: "group 1",
4
+ value: "Power"
5
+ }) %>
6
+
7
+ <br>
8
+
9
+ <%= pb_rails("radio", props: {
10
+ text: "Nitro",
11
+ name: "group 1",
12
+ value: "Nitro",
13
+ checked: true
14
+ }) %>
15
+
16
+ <br>
17
+
18
+ <%= pb_rails("radio", props: {
19
+ text: "Google",
20
+ name: "group 1",
21
+ value: "Google"
22
+ }) %>
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+ import { Radio } from '../../'
3
+
4
+ const RadioDefault = () => {
5
+ return (
6
+ <div>
7
+ <Radio
8
+ label="Power"
9
+ name="Group2"
10
+ value="Power"
11
+ />
12
+ <br />
13
+ <Radio
14
+ label="Nitro"
15
+ name="Group2"
16
+ value="Nitro"
17
+ />
18
+ <br />
19
+ <Radio
20
+ label="Google"
21
+ name="Group2"
22
+ value="Google"
23
+ />
24
+ </div>
25
+ )
26
+ }
27
+ export default RadioDefault
@@ -0,0 +1,14 @@
1
+ examples:
2
+
3
+ rails:
4
+ - radio_default: Default
5
+ - radio_dark: Dark
6
+ - radio_custom: Custom
7
+
8
+
9
+
10
+
11
+ react:
12
+ - radio_default: Default
13
+ - radio_dark: Dark
14
+ - radio_custom: Custom
@@ -0,0 +1,3 @@
1
+ export { default as RadioDefault } from './_radio_default.jsx'
2
+ export { default as RadioDark } from './_radio_dark.jsx'
3
+ export { default as RadioCustom } from './_radio_custom.jsx'
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "action_view"
4
+
5
+ module Playbook
6
+ module PbRadio
7
+ class Radio
8
+ include ActionView::Helpers::FormTagHelper
9
+ include ActionView::Context
10
+ include Playbook::Props
11
+
12
+ partial "pb_radio/radio"
13
+
14
+ prop :checked, type: Playbook::Props::Boolean,
15
+ default: false
16
+ prop :dark, type: Playbook::Props::Boolean,
17
+ default: false
18
+ prop :name, type: Playbook::Props::String,
19
+ default: "radio_name"
20
+ prop :text, type: Playbook::Props::String,
21
+ default: "Radio Text"
22
+ prop :value, type: Playbook::Props::String,
23
+ default: "radio_text"
24
+ prop :object
25
+ def classname
26
+ generate_classname("pb_radio_kit", dark_class)
27
+ end
28
+
29
+ def input
30
+ check_box_tag(name, value, checked)
31
+ end
32
+
33
+ def selected
34
+ if checked == true
35
+ "checked"
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ def dark_class
42
+ dark ? "dark" : nil
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,5 +1,4 @@
1
1
  /* @flow */
2
-
3
2
  import React from 'react'
4
3
  import classnames from 'classnames'
5
4
  import { Caption } from '../'
@@ -13,6 +12,7 @@ type TextInputProps = {
13
12
  placeholder: string,
14
13
  type: string,
15
14
  value: string | number,
15
+ children: Node,
16
16
  }
17
17
 
18
18
  const TextInput = ({
@@ -24,6 +24,7 @@ const TextInput = ({
24
24
  placeholder,
25
25
  type = 'text',
26
26
  value,
27
+ children = null,
27
28
  }: TextInputProps) => {
28
29
  const css = classnames([
29
30
  `pb_text_input_kit${dark === true ? '_dark' : ''}`,
@@ -33,18 +34,23 @@ const TextInput = ({
33
34
  return (
34
35
  <div className={css}>
35
36
  <Caption
37
+ className="pb_text_input_kit_label"
36
38
  dark={dark}
37
39
  text={label}
38
40
  />
39
41
  <div className="text_input_wrapper">
40
- <input
41
- className="text_input"
42
- name={name}
43
- onChange={onChange}
44
- placeholder={placeholder}
45
- type={type}
46
- value={value}
47
- />
42
+ <If condition={children}>
43
+ {children}
44
+ <Else />
45
+ <input
46
+ className="text_input"
47
+ name={name}
48
+ onChange={onChange}
49
+ placeholder={placeholder}
50
+ type={type}
51
+ value={value}
52
+ />
53
+ </If>
48
54
  </div>
49
55
  </div>
50
56
  )
@@ -0,0 +1,3 @@
1
+ <%= pb_rails("text_input", props: {label: "Custom Input"}) do %>
2
+ <input placeholder="Custom placeholder" name="custom-name"></input>
3
+ <% end %>
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+ import { TextInput } from '../../'
3
+
4
+ const TextInputCustom = () => {
5
+ return (
6
+ <div>
7
+ <TextInput
8
+ label="Custom Label"
9
+ >
10
+ <input
11
+ name="custom-name"
12
+ placeholder="custom-placeholder"
13
+ type="text"
14
+ />
15
+ </TextInput>
16
+ </div>
17
+ )
18
+ }
19
+
20
+ export default TextInputCustom
@@ -2,4 +2,4 @@
2
2
  <%= pb_rails("text_input", props: { label: "Last Name", placeholder: "Enter last name" }) %>
3
3
  <%= pb_rails("text_input", props: { label: "Phone Number", type: "phone", placeholder: "Enter phone number" }) %>
4
4
  <%= pb_rails("text_input", props: { label: "Email Address", type: "email", placeholder: "Enter email address" }) %>
5
- <%= pb_rails("text_input", props: { label: "Zip Code", type: "number", placeholder: "Enter zip code" }) %>
5
+ <%= pb_rails("text_input", props: { label: "Zip Code", type: "number", placeholder: "Enter zip code" }) %>
@@ -2,7 +2,9 @@ examples:
2
2
  rails:
3
3
  - text_input_default: Default
4
4
  - text_input_dark: Dark
5
+ - text_input_custom: Custom
5
6
  react:
6
7
  - text_input_default: Default
7
8
  - text_input_dark: Dark
9
+ - text_input_custom: Custom
8
10
 
@@ -1,2 +1,3 @@
1
1
  export { default as TextInputDefault } from './_text_input_default.jsx'
2
2
  export { default as TextInputDark } from './_text_input_dark.jsx'
3
+ export { default as TextInputCustom } from './_text_input_custom.jsx'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- VERSION = "3.2.0"
4
+ VERSION = "3.3.0"
5
5
  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: 3.2.0
4
+ version: 3.3.0
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: 2019-12-19 00:00:00.000000000 Z
12
+ date: 2020-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: 5.1.6
41
41
  - - "<"
42
42
  - !ruby/object:Gem::Version
43
- version: '6.0'
43
+ version: '7.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  version: 5.1.6
51
51
  - - "<"
52
52
  - !ruby/object:Gem::Version
53
- version: '6.0'
53
+ version: '7.0'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: activesupport
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -439,6 +439,7 @@ files:
439
439
  - app/pb_kits/playbook/kits/pb_pill.js
440
440
  - app/pb_kits/playbook/kits/pb_progress_pills.js
441
441
  - app/pb_kits/playbook/kits/pb_progress_simple.js
442
+ - app/pb_kits/playbook/kits/pb_radio.js
442
443
  - app/pb_kits/playbook/kits/pb_section_separator.js
443
444
  - app/pb_kits/playbook/kits/pb_select.js
444
445
  - app/pb_kits/playbook/kits/pb_selectable_card.js
@@ -579,6 +580,8 @@ files:
579
580
  - app/pb_kits/playbook/pb_checkbox/_checkbox.scss
580
581
  - app/pb_kits/playbook/pb_checkbox/checkbox.rb
581
582
  - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_checked.html.erb
583
+ - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom.html.erb
584
+ - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_custom.jsx
582
585
  - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_dark.html.erb
583
586
  - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_dark.jsx
584
587
  - app/pb_kits/playbook/pb_checkbox/docs/_checkbox_default.html.erb
@@ -966,6 +969,18 @@ files:
966
969
  - app/pb_kits/playbook/pb_progress_simple/docs/example.yml
967
970
  - app/pb_kits/playbook/pb_progress_simple/docs/index.js
968
971
  - app/pb_kits/playbook/pb_progress_simple/progress_simple.rb
972
+ - app/pb_kits/playbook/pb_radio/_radio.html.erb
973
+ - app/pb_kits/playbook/pb_radio/_radio.jsx
974
+ - app/pb_kits/playbook/pb_radio/_radio.scss
975
+ - app/pb_kits/playbook/pb_radio/docs/_radio_custom.html.erb
976
+ - app/pb_kits/playbook/pb_radio/docs/_radio_custom.jsx
977
+ - app/pb_kits/playbook/pb_radio/docs/_radio_dark.html.erb
978
+ - app/pb_kits/playbook/pb_radio/docs/_radio_dark.jsx
979
+ - app/pb_kits/playbook/pb_radio/docs/_radio_default.html.erb
980
+ - app/pb_kits/playbook/pb_radio/docs/_radio_default.jsx
981
+ - app/pb_kits/playbook/pb_radio/docs/example.yml
982
+ - app/pb_kits/playbook/pb_radio/docs/index.js
983
+ - app/pb_kits/playbook/pb_radio/radio.rb
969
984
  - app/pb_kits/playbook/pb_section_separator/_section_separator.html.erb
970
985
  - app/pb_kits/playbook/pb_section_separator/_section_separator.jsx
971
986
  - app/pb_kits/playbook/pb_section_separator/_section_separator.scss
@@ -999,7 +1014,6 @@ files:
999
1014
  - app/pb_kits/playbook/pb_select/docs/_select_value_text_same.jsx
1000
1015
  - app/pb_kits/playbook/pb_select/docs/example.yml
1001
1016
  - app/pb_kits/playbook/pb_select/docs/index.js
1002
- - app/pb_kits/playbook/pb_select/docs/nitro_theme.gemspec
1003
1017
  - app/pb_kits/playbook/pb_select/select.rb
1004
1018
  - app/pb_kits/playbook/pb_selectable_card/_selectable_card.html.erb
1005
1019
  - app/pb_kits/playbook/pb_selectable_card/_selectable_card.jsx
@@ -1094,6 +1108,8 @@ files:
1094
1108
  - app/pb_kits/playbook/pb_text_input/_text_input.html.erb
1095
1109
  - app/pb_kits/playbook/pb_text_input/_text_input.jsx
1096
1110
  - app/pb_kits/playbook/pb_text_input/_text_input.scss
1111
+ - app/pb_kits/playbook/pb_text_input/docs/_text_input_custom.html.erb
1112
+ - app/pb_kits/playbook/pb_text_input/docs/_text_input_custom.jsx
1097
1113
  - app/pb_kits/playbook/pb_text_input/docs/_text_input_dark.html.erb
1098
1114
  - app/pb_kits/playbook/pb_text_input/docs/_text_input_dark.jsx
1099
1115
  - app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb
@@ -1,41 +0,0 @@
1
- $LOAD_PATH.push File.expand_path("lib", __dir__)
2
-
3
- Gem::Specification.new do |s|
4
- s.name = "nitro_theme"
5
- s.version = "0.0.1"
6
- s.authors = ["Nitro Developers"]
7
- s.email = ["dev@powerhrg.com"]
8
- s.homepage = "http://nitro.powerhrg.com"
9
- s.summary = "Nitro's visual theme"
10
- s.description = "Nitro's visual theme, including page layout, styling and navigation"
11
-
12
- s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md"]
13
-
14
- s.add_dependency "bootstrap-sass", "3.3.5.1"
15
- s.add_dependency "coffee-rails", "4.2.2"
16
- s.add_dependency "jquery-rails", "4.3.1"
17
- s.add_dependency "lodash-rails", "3.10.1"
18
- s.add_dependency "naughty"
19
- s.add_dependency "nitro_auth"
20
- s.add_dependency "nitro_react"
21
- s.add_dependency "nitro_sg", "3.0.2"
22
- s.add_dependency "playbook_ui", "2.9.1"
23
- s.add_dependency "rails", "5.1.6.2"
24
- # should sassc version change, adjust umbrella Gemfile & Dockerfile accordingly
25
- s.add_dependency "sassc", "1.11.4"
26
- s.add_dependency "sassc-rails", "1.3.0"
27
- s.add_dependency "simple_form", "4.0.1"
28
- s.add_dependency "sprockets-rails", "2.3.3"
29
- s.add_dependency "turbolinks", "~> 5"
30
- s.add_dependency "will_paginate", "3.1.6"
31
- s.add_dependency "will_paginate-bootstrap", "1.0.1"
32
-
33
- s.add_development_dependency "nitro_linting"
34
- s.add_development_dependency "pry-byebug", "3.5.0"
35
- s.add_development_dependency "rainbow", "2.2.2"
36
- s.add_development_dependency "rspec-rails"
37
- s.add_development_dependency "simplecov", "0.15.1"
38
- s.add_development_dependency "test-unit", "3.1.5"
39
- s.add_development_dependency "timecop"
40
- s.add_development_dependency "yard", "0.9.20"
41
- end