playbook_ui 12.37.0.pre.alpha.PLAY951collapsiblenav31073 → 12.37.0.pre.alpha.PLAYaddingdatapropselectkit1071

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +0 -6
  3. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +3 -3
  4. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +9 -10
  5. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
  6. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
  7. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +8 -4
  8. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
  9. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
  10. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +6 -7
  11. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +1 -2
  12. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +15 -264
  13. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +0 -6
  14. data/app/pb_kits/playbook/pb_nav/_item.tsx +22 -35
  15. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +7 -6
  16. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  17. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +58 -85
  18. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_emphasize.jsx → _collapsible_nav_custom_icons.jsx} +5 -14
  19. data/app/pb_kits/playbook/pb_nav/docs/example.yml +3 -5
  20. data/app/pb_kits/playbook/pb_nav/docs/index.js +1 -2
  21. data/app/pb_kits/playbook/pb_nav/item.html.erb +4 -5
  22. data/app/pb_kits/playbook/pb_nav/item.rb +3 -22
  23. data/app/pb_kits/playbook/pb_select/docs/_select_data_attributes.html.erb +24 -0
  24. data/app/pb_kits/playbook/pb_select/docs/_select_data_attributes.md +1 -0
  25. data/app/pb_kits/playbook/pb_select/docs/example.yml +1 -0
  26. data/app/pb_kits/playbook/pb_select/select.html.erb +1 -1
  27. data/dist/playbook-rails.js +1 -1
  28. data/lib/playbook/version.rb +1 -1
  29. metadata +4 -10
  30. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -75
  31. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +0 -3
  32. data/app/pb_kits/playbook/pb_nav/_mixins.scss +0 -5
  33. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +0 -1
  34. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +0 -58
  35. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +0 -1
  36. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +0 -23
  37. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a614a1ec23f8a5684100225c2de79beb702f61989d5d0507cf334247e5dee619
4
- data.tar.gz: 2426810438f198dd19fbbe01fbb08a8701b85d9abd987ae8a0b31e588f9e0764
3
+ metadata.gz: 1c4ed389de4d3d4fb6707f7b6d320cb5fab04f242dd3a85dd13d36fd27bed1bb
4
+ data.tar.gz: 730de6094c4243b515b6c07950896fff797c699b65214d691ba5cfe116137e59
5
5
  SHA512:
6
- metadata.gz: 92ce569a84e8e191695ff8bb75735d698ee0ba5b1915a8a174951cca08f70b7f1236532ec565f37e63f5cf1b3a7b57945804a5b1d3dc4bec018d41fe0d5208c1
7
- data.tar.gz: e8c89499abd48d531b224ebba171145fbc302ff66f513ee11fe2c52af599925dea9ecbb889a5798e0a3cb4196d1770710b5aaeb88e785a99b519615d0a802213
6
+ metadata.gz: 999f9f2a0a7b74a1db4a819b61dceef4a283fb3c2965185475cca1c73c0fdc071013bde30b9dd0b6df7a1cee7824b1085a822969ada3d299a8a130b8317d545c
7
+ data.tar.gz: 318dbf4af0bea085d7ca027bb6c5da323d73655f33d2704f3479c92a5694a61723bfabc57262bb68b4fb4ae0975a5d492ceee6d63c9f9151862dd1ab2e0c7de4
@@ -20,12 +20,6 @@
20
20
  .icon_wrapper:hover {
21
21
  color: $primary
22
22
  }
23
-
24
- .dark {
25
- .pb_icon_kit {
26
- color: $white;
27
- }
28
- }
29
23
  }
30
24
 
31
25
  [class^=pb_collapsible_main_kit] {
@@ -20,7 +20,7 @@ type CollapsibleProps = {
20
20
  icon?: string | string[],
21
21
  iconColor?: 'default' | 'light' | 'lighter' | 'link' | 'error' | 'success',
22
22
  iconSize?: IconSizes,
23
- onIconClick?: ()=> void,
23
+ iconClick?: ()=> void,
24
24
  onClick?: ()=> void,
25
25
  id?: string,
26
26
  }
@@ -36,7 +36,7 @@ const Collapsible = ({
36
36
  icon,
37
37
  iconColor = 'default',
38
38
  iconSize,
39
- onIconClick,
39
+ iconClick,
40
40
  onClick,
41
41
  id,
42
42
  ...props
@@ -66,7 +66,7 @@ const Collapsible = ({
66
66
  className
67
67
  )
68
68
  return (
69
- <CollapsibleContext.Provider value={{ collapsed: isCollapsed, toggle, icon, iconSize, iconColor, onIconClick, onClick }}>
69
+ <CollapsibleContext.Provider value={{ collapsed: isCollapsed, toggle, icon, iconSize, iconColor, iconClick, onClick }}>
70
70
  <div
71
71
  {...ariaProps}
72
72
  {...dataProps}
@@ -33,7 +33,6 @@ type CollapsibleMainProps = {
33
33
  children: React.ReactNode[] | React.ReactNode,
34
34
  className?: string,
35
35
  cursor?: string,
36
- dark?: boolean,
37
36
  onClick?: ()=> void
38
37
  }
39
38
  type IconColors = "default" | "light" | "lighter" | "link" | "error" | "success"
@@ -43,10 +42,10 @@ type IconProps = {
43
42
  icon?: string[] | string
44
43
  iconColor?: IconColors
45
44
  iconSize?: IconSizes
46
- onIconClick?: ()=> void
45
+ iconClick?: ()=> void
47
46
  }
48
47
 
49
- const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, onIconClick }: IconProps) => {
48
+ const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, iconClick }: IconProps) => {
50
49
  const color = colorMap[iconColor]
51
50
 
52
51
  const showIcon = (icon: string |string[]) => {
@@ -57,9 +56,9 @@ const ToggleIcon = ({ collapsed, icon, iconSize, iconColor, onIconClick }: IconP
57
56
  }
58
57
 
59
58
  const handleIconClick = (e:any) => {
60
- if (onIconClick) {
59
+ if (iconClick) {
61
60
  e.stopPropagation();
62
- onIconClick()
61
+ iconClick()
63
62
  }
64
63
  }
65
64
 
@@ -94,18 +93,18 @@ const CollapsibleMain = ({
94
93
  cursor = 'pointer',
95
94
  ...props
96
95
  }: CollapsibleMainProps): React.ReactElement=> {
97
- const {collapsed, toggle, icon, iconSize, iconColor, onIconClick, onClick}: any = useContext(CollapsibleContext)
96
+ const {collapsed, toggle, icon, iconSize, iconColor, iconClick, onClick}: any = useContext(CollapsibleContext)
98
97
  const mainCSS = buildCss('pb_collapsible_main_kit')
99
98
  const mainSpacing = globalProps(props, { cursor })
100
99
 
101
- const handleCollapsibleClick = () => {
100
+ const handleCollapsibleClick = (e:any) => {
102
101
  toggle();
103
- onClick && onClick()
102
+ onClick && onClick(e)
104
103
  }
105
104
 
106
105
  return (
107
106
  <div className={classnames(mainCSS, className, mainSpacing)}>
108
- <div onClick={handleCollapsibleClick}>
107
+ <div onClick={(e)=>handleCollapsibleClick(e)}>
109
108
  <Flex
110
109
  spacing="between"
111
110
  vertical="center"
@@ -117,7 +116,7 @@ const CollapsibleMain = ({
117
116
  iconColor={iconColor as IconColors}
118
117
  iconSize={iconSize as IconSizes}
119
118
  icon={icon as string[] | string}
120
- onIconClick={onIconClick}
119
+ iconClick={iconClick}
121
120
  />
122
121
  </FlexItem>
123
122
  </Flex>
@@ -1,13 +1,13 @@
1
1
  import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleColor = (props) => (
4
+ const CollapsibleColor = () => (
5
5
  <div>
6
6
  <Collapsible
7
7
  iconColor='default'
8
8
  marginBottom="xs"
9
9
  >
10
- <Collapsible.Main {...props}>
10
+ <Collapsible.Main>
11
11
  <div>{'Default Section'}</div>
12
12
  </Collapsible.Main>
13
13
  <Collapsible.Content>
@@ -1,9 +1,9 @@
1
1
  import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleDefault = (props) => (
4
+ const CollapsibleDefault = () => (
5
5
  <Collapsible >
6
- <Collapsible.Main {...props}>
6
+ <Collapsible.Main>
7
7
  <div>{'Main Section'}</div>
8
8
  </Collapsible.Main>
9
9
  <Collapsible.Content>
@@ -1,14 +1,18 @@
1
1
  import React from 'react'
2
- import { Collapsible } from '../..'
2
+ import { Collapsible, useCollapsible, Button } from '../..'
3
3
 
4
- const CollapsibleIcons = (props) => {
4
+ const CollapsibleIcons = () => {
5
+ const [isCollapsed, setIsCollapsed] = useCollapsible(true)
5
6
 
6
7
  return (
7
8
  <>
8
- <Collapsible
9
+ <Button onClick={()=> setIsCollapsed(!isCollapsed)}>
10
+ {isCollapsed ? "Expand" : "Collapse"}
11
+ </Button>
12
+ <Collapsible collapsed={isCollapsed}
9
13
  icon={['plus','minus']}
10
14
  >
11
- <Collapsible.Main {...props}>
15
+ <Collapsible.Main>
12
16
  <div>{'Main Section'}</div>
13
17
  </Collapsible.Main>
14
18
  <Collapsible.Content>
@@ -1,2 +1,2 @@
1
1
  ##### Prop
2
- The `icon` prop allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when collapsed (chevron-down), and the second value will replace the default icon when expanded (chevron-up). `icon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the collapsible state.
2
+ This kit uses 'chevron-up' and 'chevron-down' icons as default for the toggle icons. To customize these icons, use the `icon` prop to pass in an array of two icons, the first will render when the collapisble is closed and the second will render when the collapsible is open. In this example, we are using `icon: ['plus','minus']`
@@ -1,13 +1,13 @@
1
1
  import React from 'react'
2
2
  import { Collapsible } from '../..'
3
3
 
4
- const CollapsibleSize = (props) => (
4
+ const CollapsibleSize = () => (
5
5
  <div>
6
6
  <Collapsible
7
7
  iconSize="xs"
8
8
  marginBottom="xs"
9
9
  >
10
- <Collapsible.Main {...props}>
10
+ <Collapsible.Main>
11
11
  <div>{'Extra Small Section'}</div>
12
12
  </Collapsible.Main>
13
13
  <Collapsible.Content>
@@ -22,7 +22,7 @@ const CollapsibleSize = (props) => (
22
22
  iconSize="sm"
23
23
  marginBottom="xs"
24
24
  >
25
- <Collapsible.Main {...props}>
25
+ <Collapsible.Main>
26
26
  <div>{'Small Section'}</div>
27
27
  </Collapsible.Main>
28
28
  <Collapsible.Content>
@@ -36,7 +36,7 @@ const CollapsibleSize = (props) => (
36
36
  <Collapsible
37
37
  marginBottom="xs"
38
38
  >
39
- <Collapsible.Main {...props}>
39
+ <Collapsible.Main>
40
40
  <div>{'Default Section'}</div>
41
41
  </Collapsible.Main>
42
42
  <Collapsible.Content>
@@ -51,7 +51,7 @@ const CollapsibleSize = (props) => (
51
51
  iconSize="lg"
52
52
  marginBottom="xs"
53
53
  >
54
- <Collapsible.Main {...props}>
54
+ <Collapsible.Main>
55
55
  <div>{'Large Section'}</div>
56
56
  </Collapsible.Main>
57
57
  <Collapsible.Content>
@@ -2,13 +2,12 @@ examples:
2
2
 
3
3
  rails:
4
4
  - collapsible_default: Default
5
- - collapsible_size: Icon Size
6
- - collapsible_color: Icon Color
7
- - collapsible_icons: Custom Icons
5
+ - collapsible_size: Size
6
+ - collapsible_color: Color
7
+ # - collapsible_icons: Custom Icons
8
8
 
9
9
  react:
10
10
  - collapsible_default: Default
11
- - collapsible_size: Icon Size
12
- - collapsible_color: Icon Color
13
- - collapsible_icons: Custom Icons
14
- - collapsible_state: useCollapsible Hook
11
+ - collapsible_size: Size
12
+ - collapsible_color: Color
13
+ # - collapsible_icons: Custom Icons
@@ -1,5 +1,4 @@
1
1
  export { default as CollapsibleDefault } from './_collapsible_default.jsx'
2
2
  export { default as CollapsibleSize } from './_collapsible_size.jsx'
3
3
  export { default as CollapsibleColor } from './_collapsible_color.jsx'
4
- export { default as CollapsibleIcons } from './_collapsible_icons.jsx'
5
- export {default as CollapsibleState } from './_collapsible_state.jsx'
4
+ export { default as CollapsibleIcons } from './_collapsible_icons.jsx'
@@ -1,276 +1,27 @@
1
1
  @import "../tokens/spacing";
2
2
  @import "../tokens/colors";
3
3
  @import "../tokens/border_radius";
4
- @import "../tokens/titles";
5
- @import "../tokens/typography";
6
- @import "./mixins";
7
4
 
8
5
  [class^="pb_nav_list"] {
9
- .font_size_small {
10
- .pb_nav_list_item_text,
11
- .pb_nav_list_item_text_collapsible {
12
- font-size: $font_small !important;
13
- }
14
- }
15
-
16
- .font_bold {
17
- .pb_nav_list_item_text {
18
- @include pb_title_4;
19
- }
20
- .pb_collapsible_main_kit {
21
- .pb_nav_list_item_text_collapsible {
22
- @include pb_title_4;
23
- font-weight: $bolder !important;
24
- }
25
- }
26
- }
27
-
28
- .font_regular {
29
- .pb_nav_list_item_text {
30
- font-weight: $regular;
31
- }
32
- .pb_collapsible_main_kit {
33
- .pb_nav_list_item_text_collapsible {
34
- font-weight: $regular !important;
35
- }
36
- }
6
+ .pb_collapsible_nav_item {
7
+ .pb_collapsible_main_kit,
8
+ .pb_collapsible_content_kit,
9
+ .pb_collapsible_kit {
10
+ padding: 0 !important;
37
11
  }
38
12
 
39
-
40
- //styling for default variant with collapsible
41
- &[class*="_normal"] {
42
- [class*="pb_collapsible_nav_item"] {
43
- .pb_collapsible_content_kit {
44
- margin-left: $space_lg + 3;
45
- }
46
- .pb_collapsible_main_kit {
47
- border-radius: unset;
48
- }
49
- &[class*="_active"] {
50
- .pb_collapsible_main_kit {
51
- background-color: $active_light;
52
- }
53
- .pb_nav_list_item_link {
54
- border-color: transparent !important;
55
- .pb_nav_list_item_text {
56
- color: unset !important;
57
- font-weight: $regular !important;
58
- }
59
- }
60
- }
61
-
62
- &.dark {
63
- border-color: $border_dark;
64
- .pb_collapsible_main_kit:hover {
65
- .pb_nav_list_item_text_collapsible {
66
- color: $white !important;
67
- }
68
- }
69
- &[class*="_active"] {
70
- .pb_collapsible_main_kit {
71
- background-color: mix($white, $card_dark, 20%);
72
- .pb_nav_list_item_text_collapsible,
73
- svg {
74
- color: $white !important;
75
- }
76
- }
77
- }
78
- }
79
- }
80
- }
81
-
82
- //styling bold variant to work with collapsible
83
- &[class*="_bold"] {
84
- [class*="pb_collapsible_nav_item"] {
85
- &[class*="_active"] {
86
- .pb_collapsible_main_kit {
87
- background-color: $primary !important;
88
- border-radius: $border_rad_heavier;
89
- .pb_nav_list_item_text_collapsible,
90
- .pb_nav_list_item_icon_collapsible,
91
- .icon_wrapper,
92
- .pb_icon_kit {
93
- color: $white !important;
94
- }
95
- }
96
- .pb_nav_list_item_link {
97
- background-color: unset !important;
98
- box-shadow: unset !important;
99
- &:hover {
100
- background-color: rgba($primary, 0.03) !important;
101
- .pb_nav_list_item_text {
102
- color: $primary !important;
103
- }
104
- }
105
- .pb_nav_list_item_text {
106
- font-weight: $regular !important;
107
- }
108
- }
109
- }
110
- }
111
- }
112
-
113
- //styling for subtle variant with collapsible
114
- &[class*="_subtle"] {
115
- [class*="pb_collapsible_nav_item"] {
116
- &[class*="_active"] {
117
- .pb_collapsible_main_kit {
118
- background-color: $primary !important;
119
- border-radius: $border_rad_heavier;
120
- .pb_nav_list_item_text_collapsible,
121
- .pb_nav_list_item_icon_collapsible,
122
- .icon_wrapper,
123
- .pb_icon_kit {
124
- color: $white !important;
125
- }
126
- }
127
-
128
- &:hover {
129
- background-color: unset;
130
- }
131
- .pb_collapsible_main_kit:hover {
132
- .pb_nav_list_item_text_collapsible {
133
- color: $white !important;
134
- }
135
- }
136
-
137
- .icon_wrapper {
138
- &:hover {
139
- background-color: mix($primary, $card_light, 40%);
140
- .pb_icon_kit {
141
- color: $primary !important;
142
- }
143
- }
144
- }
145
- }
146
- }
147
- }
148
-
149
- [class*="pb_collapsible_nav_item"] {
150
- &[class*="_active"] {
151
- background-color: unset !important;
152
- .pb_nav_list_item_link {
153
- color: unset !important;
154
- }
155
- }
156
-
157
- .pb_nav_list_item_link_collapsible {
158
- &:focus-visible {
159
- outline: none;
160
- }
161
- }
162
-
163
- .pb_collapsible_main_kit {
164
- &:focus-visible {
165
- box-shadow: 0px 0px 0px 2px $primary_action;
166
- border-radius: $border_rad_heavier;
167
- }
168
- }
169
-
170
- //Make sure link is entire width of navitem when in collapsible
171
- .pb_collapsible_main_kit {
172
- .pb_flex_item_kit:first-child {
173
- width: 100%;
174
- }
175
- }
176
-
13
+ .icon_wrapper {
14
+ border-radius: $border_radius_rounded;
15
+ width: 19px;
16
+ height: 19px;
17
+ display:flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ margin-right: $space_xs;
177
21
  &:hover {
178
- .pb_nav_list_item_link_collapsible {
179
- background-color: unset !important;
180
- }
181
- }
182
-
183
- // vertical line on left of collapsible content
184
- .pb_collapsible_content_kit {
185
- margin-left: $space_sm + 2;
186
- border-left: 1px solid transparent;
187
- }
188
-
189
- .pb_collapsible_main_kit {
190
- transition-property: color, border-color, background-color;
191
- transition-duration: 0.15s;
192
- transition-timing-function: $bezier;
193
- border-radius: $border_rad_heavier;
194
- &:hover {
195
- background-color: mix($primary, $card_light, 10%);
196
- .pb_nav_list_item_text_collapsible,
197
- svg {
198
- color: $primary !important;
199
- }
200
- }
201
- }
202
-
203
- .pb_collapsible_main_kit,
204
- .pb_collapsible_content_kit,
205
- .pb_collapsible_kit {
206
- padding: 0 !important;
207
- }
22
+ background-color: rgba($primary_action, $opacity_3);
208
23
 
209
- &[class*="_collapsible_trail"] {
210
- @include collapsible_trail_class;
211
- }
212
-
213
- .icon_wrapper {
214
- border-radius: $border_radius_rounded;
215
- width: $space_sm + 3;
216
- height: $space_sm + 3;
217
- display: flex;
218
- align-items: center;
219
- justify-content: center;
220
- margin-right: $space_xs;
221
- &:hover {
222
- background-color: mix($primary, $card_light, 40%);
223
- }
224
- }
225
-
226
- &.dark {
227
- .pb_nav_list_kit_item {
228
- border-color: $border_dark;
229
- .pb_nav_list_item_text {
230
- color: $text_dk_light !important;
231
- }
232
- }
233
- &[class*="pb_nav_list_kit_item"] [class*="_link"]:hover {
234
- .pb_nav_list_item_text {
235
- color: $white !important;
236
- }
237
- }
238
-
239
- .pb_nav_list_item_text_collapsible {
240
- color: $white !important;
241
- }
242
- .pb_nav_list_item_text {
243
- color: $text_dk_light;
244
- }
245
- .pb_nav_list_kit_item:hover {
246
- background-color: #ffffff33;
247
- color: $white;
248
- }
249
- .pb_icon_kit {
250
- color: $text_dk_light;
251
- }
252
-
253
- .pb_collapsible_main_kit:hover {
254
- background-color: mix($white, $card_dark, 20%);
255
- .pb_nav_list_item_text_collapsible,
256
- svg {
257
- color: $white !important;
258
- }
259
- }
260
- .icon_wrapper:hover {
261
- background-color: mix($white, $card_dark, 40%);
262
- }
263
- &[class*="_active"] {
264
- .icon_wrapper:hover {
265
- background-color: mix($primary, $card_light, 40%);
266
- }
267
- }
268
-
269
- &[class*="pb_collapsible_nav_item"][class*="_collapsible_trail"] {
270
- .pb_collapsible_content_kit {
271
- border-color: $border_dark;
272
- }
273
- }
274
24
  }
275
25
  }
276
26
  }
27
+ }
@@ -81,9 +81,6 @@ $selector: ".pb_nav_list";
81
81
  // Horizontal Overrides
82
82
  [class*=pb_nav_list_kit_item] {
83
83
  margin: 0;
84
- [class*=_item_text]{
85
- font-weight: $regular;
86
- }
87
84
  }
88
85
  [class*=_active] {
89
86
  background-color: $active_light;
@@ -104,9 +101,6 @@ $selector: ".pb_nav_list";
104
101
  // Horizontal Overrides
105
102
  [class*=pb_nav_list_kit_item] {
106
103
  margin: 0;
107
- [class*=_item_text]{
108
- font-weight: $regular;
109
- }
110
104
  }
111
105
  [class*=_active] {
112
106
  [class*=_text] {