playbook_ui 7.3.0 → 7.4.0.pre.alpha6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -3
  3. data/app/pb_kits/playbook/data/menu.yml +2 -2
  4. data/app/pb_kits/playbook/index.js +2 -2
  5. data/app/pb_kits/playbook/pb_checkbox/_checkbox.html.erb +3 -2
  6. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +2 -1
  7. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +4 -1
  8. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_default.html.erb +5 -2
  9. data/app/pb_kits/playbook/pb_date/_date.html.erb +8 -64
  10. data/app/pb_kits/playbook/pb_date/_date.jsx +66 -115
  11. data/app/pb_kits/playbook/pb_date/_date.scss +0 -30
  12. data/app/pb_kits/playbook/pb_date/date.rb +9 -20
  13. data/app/pb_kits/playbook/pb_date/docs/_date_default.html.erb +6 -21
  14. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +12 -43
  15. data/app/pb_kits/playbook/pb_date/docs/example.yml +0 -4
  16. data/app/pb_kits/playbook/pb_date/docs/index.js +0 -2
  17. data/app/pb_kits/playbook/pb_date_picker/_date_picker.html.erb +14 -19
  18. data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -1
  19. data/app/pb_kits/playbook/pb_flex/_flex.scss +0 -4
  20. data/app/pb_kits/playbook/pb_flex/flex.rb +1 -1
  21. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -52
  22. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  23. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form.html.erb +1 -1
  24. data/app/pb_kits/playbook/pb_form/docs/_form_simple_form_validate.html.erb +1 -1
  25. data/app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb +1 -19
  26. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +1 -1
  27. data/app/pb_kits/playbook/pb_list/_list.jsx +9 -2
  28. data/app/pb_kits/playbook/pb_progress_step/progress_step.rb +2 -2
  29. data/app/pb_kits/playbook/pb_radio/_radio.jsx +0 -3
  30. data/app/pb_kits/playbook/pb_selectable_list/_item.jsx +90 -0
  31. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.html.erb +11 -0
  32. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.jsx +47 -0
  33. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss +17 -0
  34. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list_item.html.erb +18 -0
  35. data/app/pb_kits/playbook/pb_selectable_list/docs/_description.md +3 -0
  36. data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_checkbox.html.erb +30 -0
  37. data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_checkbox.jsx +32 -0
  38. data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_radio.html.erb +30 -0
  39. data/app/pb_kits/playbook/pb_selectable_list/docs/_selectable_list_radio.jsx +32 -0
  40. data/app/pb_kits/playbook/pb_selectable_list/docs/example.yml +12 -0
  41. data/app/pb_kits/playbook/pb_selectable_list/docs/index.js +2 -0
  42. data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +24 -0
  43. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +28 -0
  44. data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +19 -46
  45. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default.html.erb +10 -46
  46. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_white.html.erb +4 -4
  47. data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -3
  48. data/lib/playbook/version.rb +1 -1
  49. metadata +18 -38
  50. data/app/pb_kits/playbook/pb_background/_background.html.erb +0 -14
  51. data/app/pb_kits/playbook/pb_background/_background.jsx +0 -63
  52. data/app/pb_kits/playbook/pb_background/_background.scss +0 -35
  53. data/app/pb_kits/playbook/pb_background/background.rb +0 -35
  54. data/app/pb_kits/playbook/pb_background/docs/_background_dark.html.erb +0 -3
  55. data/app/pb_kits/playbook/pb_background/docs/_background_dark.jsx +0 -13
  56. data/app/pb_kits/playbook/pb_background/docs/_background_gradient.html.erb +0 -3
  57. data/app/pb_kits/playbook/pb_background/docs/_background_gradient.jsx +0 -13
  58. data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +0 -13
  59. data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +0 -30
  60. data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +0 -3
  61. data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +0 -13
  62. data/app/pb_kits/playbook/pb_background/docs/_background_white.html.erb +0 -3
  63. data/app/pb_kits/playbook/pb_background/docs/_background_white.jsx +0 -14
  64. data/app/pb_kits/playbook/pb_background/docs/_description.md +0 -1
  65. data/app/pb_kits/playbook/pb_background/docs/example.yml +0 -15
  66. data/app/pb_kits/playbook/pb_background/docs/index.js +0 -6
  67. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.html.erb +0 -24
  68. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +0 -35
  69. data/app/pb_kits/playbook/pb_date/docs/_date_variants.html.erb +0 -27
  70. data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +0 -43
  71. data/app/pb_kits/playbook/pb_date_time/_date_time.html.erb +0 -31
  72. data/app/pb_kits/playbook/pb_date_time/_date_time.jsx +0 -73
  73. data/app/pb_kits/playbook/pb_date_time/_date_time.scss +0 -26
  74. data/app/pb_kits/playbook/pb_date_time/date_time.rb +0 -29
  75. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_align.html.erb +0 -17
  76. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_align.jsx +0 -35
  77. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_default.html.erb +0 -20
  78. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_default.jsx +0 -38
  79. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_size.html.erb +0 -26
  80. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_size.jsx +0 -75
  81. data/app/pb_kits/playbook/pb_date_time/docs/_description.md +0 -1
  82. data/app/pb_kits/playbook/pb_date_time/docs/example.yml +0 -11
  83. data/app/pb_kits/playbook/pb_date_time/docs/index.js +0 -3
@@ -19,7 +19,6 @@ type RadioProps = {
19
19
  label: String,
20
20
  name: String,
21
21
  value: String,
22
- text: String,
23
22
  onChange: (Boolean)=>void,
24
23
  }
25
24
 
@@ -33,7 +32,6 @@ const Radio = ({
33
32
  id,
34
33
  label,
35
34
  name = 'radio_name',
36
- text = 'Radio Text',
37
35
  value = 'radio_text',
38
36
  onChange = () => {},
39
37
  ...props
@@ -57,7 +55,6 @@ const Radio = ({
57
55
  id={id}
58
56
  name={name}
59
57
  onChange={onChange}
60
- text={text}
61
58
  type="radio"
62
59
  value={value}
63
60
  />
@@ -0,0 +1,90 @@
1
+ /* @flow */
2
+ import React, { Node } from 'react'
3
+ import classnames from 'classnames'
4
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
+ import { globalProps } from '../utilities/globalProps.js'
6
+ import { Checkbox, ListItem, Radio } from '..'
7
+
8
+ type SelectableListItemProps = {
9
+ aria?: object,
10
+ children: array<Node> | Node,
11
+ checked?: boolean,
12
+ className?: string,
13
+ data?: object,
14
+ defaultChecked?: boolean,
15
+ id?: string,
16
+ label?: string,
17
+ text?: string,
18
+ name?: string,
19
+ value?: string,
20
+ variant?: string,
21
+ onChange: (boolean)=>void,
22
+ }
23
+
24
+ const SelectableListItem = ({
25
+ aria = {},
26
+ checked = false,
27
+ children,
28
+ className,
29
+ data = {},
30
+ defaultChecked,
31
+ id,
32
+ label,
33
+ text = '',
34
+ name = '',
35
+ value = '',
36
+ variant = 'checkbox',
37
+ onChange = () => {},
38
+ ...props
39
+ }: SelectableListItemProps) => {
40
+ const ariaProps = buildAriaProps(aria)
41
+ const dataProps = buildDataProps(data)
42
+ const classes = classnames(
43
+ buildCss('pb_selectable_list_item_kit'),
44
+ globalProps(props),
45
+ className
46
+ )
47
+
48
+ return (
49
+ <ListItem {...props}>
50
+ <div
51
+ {...ariaProps}
52
+ {...dataProps}
53
+ className={classes}
54
+ >
55
+ <Choose>
56
+ <When condition={variant == 'checkbox'}>
57
+ <Checkbox
58
+ checked={checked}
59
+ id={id}
60
+ name={name}
61
+ onChange={onChange}
62
+ // eslint suppressor, text is needed to display on screen
63
+ text={label || (text && false)}
64
+ type="checkbox"
65
+ value={value}
66
+ {...props}
67
+ />
68
+ {children}
69
+ </When>
70
+ <When condition={variant == 'radio'}>
71
+ <Radio
72
+ defaultChecked={defaultChecked}
73
+ id={id}
74
+ label={label}
75
+ name={name}
76
+ onChange={onChange}
77
+ type="radio"
78
+ value={value}
79
+ {...props}
80
+ />
81
+ {children}
82
+ </When>
83
+ <Otherwise>{children}</Otherwise>
84
+ </Choose>
85
+ </div>
86
+ </ListItem>
87
+ )
88
+ }
89
+
90
+ export default SelectableListItem
@@ -0,0 +1,11 @@
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id) do %>
6
+ <%= pb_rails("list") do %>
7
+ <% object.items.each do |item| %>
8
+ <%= pb_rails("selectable_list/selectable_list_item", props: item.merge(variant: object.variant) )%>
9
+ <% end %>
10
+ <% end %>
11
+ <% end %>
@@ -0,0 +1,47 @@
1
+ /* @flow */
2
+ import React from 'react'
3
+ import classnames from 'classnames'
4
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
5
+ import { globalProps } from '../utilities/globalProps.js'
6
+ import { List } from '..'
7
+ import SelectableListItem from './_item.jsx'
8
+
9
+ type SelectableListProps = {
10
+ aria?: object,
11
+ children?: Node,
12
+ className?: string,
13
+ data?: object,
14
+ id?: string,
15
+ variant?: 'checkbox' | 'radio',
16
+ }
17
+
18
+ const SelectableList = (props: SelectableListProps) => {
19
+ const {
20
+ aria = {},
21
+ children,
22
+ className,
23
+ data = {},
24
+ id,
25
+ } = props
26
+
27
+ const ariaProps = buildAriaProps(aria)
28
+ const classes = classnames(buildCss('pb_selectable_list_kit'), globalProps(props), className)
29
+ const dataProps = buildDataProps(data)
30
+
31
+ return (
32
+ <div
33
+ {...ariaProps}
34
+ {...dataProps}
35
+ className={classes}
36
+ id={id}
37
+ >
38
+ <List {...props}>
39
+ {children}
40
+ </List>
41
+ </div>
42
+ )
43
+ }
44
+
45
+ SelectableList.Item = SelectableListItem
46
+
47
+ export default SelectableList
@@ -0,0 +1,17 @@
1
+ @import "../tokens/colors";
2
+ @import "../tokens/spacing";
3
+
4
+ [class^=pb_selectable_list]{
5
+ margin-bottom: 0px;
6
+ [class^=pb_item_kit] {
7
+ &:hover {
8
+ background-color: $bg_light;
9
+ }
10
+ }
11
+ [class^=pb_radio_kit] {
12
+ margin-left: $space_xs;
13
+ }
14
+ [class^=pb_checkbox_kit] {
15
+ margin-left: $space_xs;
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ <%= content_tag(:li,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id) do %>
6
+ <% puts object.variant %>
7
+ <% if object.variant == "radio"%>
8
+ <%= pb_rails("radio", props: { text: object.text, checked: object.checked, input_options: object.input_options } ) %>
9
+ <% if object.children.present? %>
10
+ <%= capture(&object.children) %>
11
+ <% end %>
12
+ <% else %>
13
+ <%= pb_rails("checkbox", props: { text: object.text, checked: object.checked, input_options: object.input_options } ) %>
14
+ <% if object.children.present? %>
15
+ <%= capture(&object.children) %>
16
+ <% end %>
17
+ <% end %>
18
+ <% end %>
@@ -0,0 +1,3 @@
1
+ Selectable List Kit can take variants checkbox and radio. Regardless of which variant type, each selectable list item needs a `value`, `name`, and `id` (these props are `<input>` attributes).
2
+
3
+ The Selectable List Item`id` prop will provide the `for` attribute to `<label>` in the kit, so no additional attributes are needed for the association between `<label>` and `<input>`.
@@ -0,0 +1,30 @@
1
+ <%= pb_rails("selectable_list",
2
+ props: {
3
+ variant: "checkbox",
4
+ items: [
5
+ { text: "Mild",
6
+ input_options: {
7
+ value: "1",
8
+ name: "checkbox-name-1",
9
+ id: "checkbox-id-1",
10
+ }
11
+ },
12
+ { text: "Medium",
13
+ checked: true,
14
+ input_options: {
15
+ value: "2",
16
+ name: "checkbox-name-2",
17
+ id: "checkbox-id-2",
18
+ }
19
+ },
20
+ { text: "Hot",
21
+ input_options: {
22
+ value: "3",
23
+ name: "checkbox-name-3",
24
+ id: "checkbox-id-3",
25
+ }
26
+ }
27
+ ]
28
+ }
29
+ )
30
+ %>
@@ -0,0 +1,32 @@
1
+ import React from 'react'
2
+ import { SelectableList } from '../..'
3
+
4
+ const SelectableListDefault = () => {
5
+ return (
6
+ <div>
7
+ <SelectableList variant="checkbox">
8
+ <SelectableList.Item
9
+ id="checkbox-id-1"
10
+ label="Mild"
11
+ name="checkbox-name-1"
12
+ value="1"
13
+ />
14
+ <SelectableList.Item
15
+ checked
16
+ id="checkbox-id-2"
17
+ label="Medium"
18
+ name="checkbox-name-2"
19
+ value="2"
20
+ />
21
+ <SelectableList.Item
22
+ id="checkbox-id-3"
23
+ label="Hot"
24
+ name="checkbox-name-3"
25
+ value="3"
26
+ />
27
+ </SelectableList>
28
+ </div>
29
+ )
30
+ }
31
+
32
+ export default SelectableListDefault
@@ -0,0 +1,30 @@
1
+ <%= pb_rails("selectable_list",
2
+ props: {
3
+ variant: "radio",
4
+ items: [
5
+ { text: "Small",
6
+ input_options: {
7
+ value: "1",
8
+ name: "radio-name",
9
+ id: "radio-id-1",
10
+ }
11
+ },
12
+ { text: "Medium",
13
+ checked: true,
14
+ input_options: {
15
+ value: "2",
16
+ name: "radio-name",
17
+ id: "radio-id-2",
18
+ }
19
+ },
20
+ { text: "Large",
21
+ input_options: {
22
+ value: "3",
23
+ name: "radio-name",
24
+ id: "radio-id-3",
25
+ }
26
+ }
27
+ ]
28
+ }
29
+ )
30
+ %>
@@ -0,0 +1,32 @@
1
+ import React from 'react'
2
+ import { SelectableList } from '../..'
3
+
4
+ const SelectableListDefault = () => {
5
+ return (
6
+ <div>
7
+ <SelectableList variant="radio">
8
+ <SelectableList.Item
9
+ id="radio-id-1"
10
+ label="Small"
11
+ name="radio"
12
+ value="1"
13
+ />
14
+ <SelectableList.Item
15
+ defaultChecked
16
+ id="radio-id-2"
17
+ label="Medium"
18
+ name="radio"
19
+ value="2"
20
+ />
21
+ <SelectableList.Item
22
+ id="radio-id-3"
23
+ label="Large"
24
+ name="radio"
25
+ value="3"
26
+ />
27
+ </SelectableList>
28
+ </div>
29
+ )
30
+ }
31
+
32
+ export default SelectableListDefault
@@ -0,0 +1,12 @@
1
+ examples:
2
+
3
+ rails:
4
+ - selectable_list_checkbox: Default
5
+ - selectable_list_radio: Radio variant
6
+
7
+
8
+ react:
9
+ - selectable_list_checkbox: Default
10
+ - selectable_list_radio: Radio variant
11
+
12
+
@@ -0,0 +1,2 @@
1
+ export { default as SelectableListCheckbox } from './_selectable_list_checkbox.jsx'
2
+ export { default as SelectableListRadio } from './_selectable_list_radio.jsx'
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbSelectableList
5
+ class SelectableList
6
+ include Playbook::Props
7
+
8
+ partial "pb_selectable_list/selectable_list"
9
+
10
+ prop :variant, type: Playbook::Props::Enum,
11
+ values: %w[radio checkbox],
12
+ default: "checkbox"
13
+
14
+ prop :text, type: Playbook::Props::String
15
+
16
+ prop :items, type: Playbook::Props::Array,
17
+ default: []
18
+
19
+ def classname
20
+ generate_classname("pb_selectable_list_kit")
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbSelectableList
5
+ class SelectableListItem
6
+ include Playbook::Props
7
+
8
+ prop :tabindex
9
+
10
+ prop :checked, type: Playbook::Props::Boolean,
11
+ default: false
12
+ prop :name, type: Playbook::Props::String
13
+ prop :text, type: Playbook::Props::String
14
+ prop :value, type: Playbook::Props::String
15
+ prop :variant, type: Playbook::Props::Enum,
16
+ values: %w[radio checkbox],
17
+ default: "radio"
18
+ prop :input_options, type: Playbook::Props::Hash,
19
+ default: {}
20
+
21
+ partial "pb_selectable_list/selectable_list_item"
22
+
23
+ def classname
24
+ generate_classname("pb_selectable_list_item_kit")
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,8 +1,6 @@
1
1
  @import "../tokens/positioning";
2
2
  @import "../tokens/colors";
3
3
 
4
- $tooltip_shadow: rgba(60, 106, 172, 0.18);
5
-
6
4
  @keyframes fadeIn {
7
5
  from {
8
6
  opacity: 0;
@@ -35,8 +33,19 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
35
33
  &.flipped {
36
34
  margin-top: 15px;
37
35
  .arrow {
36
+ top: -35%;
38
37
  border-color: transparent transparent $white transparent;
39
- transform: rotate(180deg);
38
+ }
39
+ }
40
+
41
+ &.react {
42
+ .arrow {
43
+ top: 78%;
44
+ }
45
+ &.flipped {
46
+ .arrow {
47
+ top: -8%;
48
+ }
40
49
  }
41
50
  }
42
51
 
@@ -57,7 +66,7 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
57
66
  z-index: $z_9;
58
67
  margin-bottom: $space_sm;
59
68
  background-color: $white;
60
- padding: $space_xs $space_sm;
69
+ padding: $space_xs $space_sm $space_xs $space_sm;
61
70
  box-shadow: $shadow_deeper;
62
71
  border-radius: $border_rad_light;
63
72
 
@@ -73,6 +82,10 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
73
82
  .tooltip_tooltip{
74
83
  color: $white;
75
84
  background-color: rgba($black, $opacity_9);
85
+
86
+
87
+ &.show {
88
+ }
76
89
  .arrow {
77
90
  border-color: $black transparent transparent transparent;
78
91
  opacity: $opacity_9;
@@ -87,46 +100,6 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
87
100
  }
88
101
  }
89
102
 
90
- // Right
91
- [class^="pb_tooltip_kit"] .tooltip_tooltip {
92
-
93
- &[x-placement="right"] {
94
- box-shadow: -8px 0 28px 0 $tooltip_shadow;
95
- margin: 0 0 0 $space_sm;
96
- .arrow {
97
- left: -#{$space_xs};
98
- margin-bottom: 0;
99
- transform: rotate(90deg);
100
- }
101
- &.flipped .arrow {
102
- transform: rotate(270deg);
103
- }
104
- }
105
-
106
- &[x-placement="bottom"] {
107
- box-shadow: 0 -12px 28px 0 $tooltip_shadow;
108
- margin: $space_sm 0 0 0;
109
- .arrow {
110
- top: -18px;
111
- margin-bottom: 0;
112
- transform: rotate(180deg);
113
- }
114
- &.flipped .arrow {
115
- transform: rotate(0deg);
116
- }
117
- }
118
-
119
- &[x-placement="left"] {
120
- box-shadow: 8px 0 28px 0 $tooltip_shadow;
121
- margin: 0 $space_sm 0 0;
122
- .arrow {
123
- margin-bottom: 0;
124
- right: -18px;
125
- left: auto;
126
- transform: rotate(270deg);
127
- }
128
- &.flipped .arrow {
129
- transform: rotate(90deg);
130
- }
131
- }
103
+ .tooltip_tooltip.top {
104
+ padding: ($space_xs - 3px) 0;
132
105
  }