playbook_ui 12.37.0 → 12.38.0.pre.alpha.PLAY966collapsiblenav41086

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +6 -0
  3. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +3 -3
  4. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +10 -9
  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 +4 -8
  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/_collapsible_state.jsx +75 -0
  11. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +3 -0
  12. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -6
  13. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +2 -1
  14. data/app/pb_kits/playbook/pb_date/_date.tsx +7 -8
  15. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +2 -2
  16. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +29 -5
  17. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
  18. data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
  19. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +45 -31
  20. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +5 -3
  21. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +24 -21
  22. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +1 -1
  23. data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +1 -1
  24. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +2 -2
  25. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +1 -1
  26. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +6 -8
  27. data/app/pb_kits/playbook/pb_kit/dateTime.ts +146 -63
  28. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +52 -31
  29. data/app/pb_kits/playbook/pb_message/_message.tsx +24 -24
  30. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +280 -17
  31. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +6 -0
  32. data/app/pb_kits/playbook/pb_nav/_item.tsx +101 -25
  33. data/app/pb_kits/playbook/pb_nav/_mixins.scss +5 -0
  34. data/app/pb_kits/playbook/pb_nav/_nav.tsx +22 -1
  35. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +6 -7
  36. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  37. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +85 -58
  38. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -0
  39. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +58 -0
  40. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +1 -0
  41. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +23 -0
  42. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_custom_icons.jsx → _collapsible_nav_emphasize.jsx} +14 -5
  43. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -0
  44. data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -3
  45. data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
  46. data/app/pb_kits/playbook/pb_nav/item.html.erb +5 -4
  47. data/app/pb_kits/playbook/pb_nav/item.rb +29 -3
  48. data/app/pb_kits/playbook/pb_time/_time.tsx +9 -11
  49. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +46 -49
  50. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +4 -6
  51. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +11 -11
  52. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +8 -11
  53. data/dist/playbook-rails.js +7 -7
  54. data/lib/playbook/version.rb +2 -2
  55. metadata +16 -9
  56. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +0 -120
@@ -1,27 +1,290 @@
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";
4
7
 
5
8
  [class^="pb_nav_list"] {
6
- .pb_collapsible_nav_item {
7
- .pb_collapsible_main_kit,
8
- .pb_collapsible_content_kit,
9
- .pb_collapsible_kit {
10
- padding: 0 !important;
11
- }
12
-
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;
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_bolder {
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_bold {
29
+ .pb_nav_list_item_text {
30
+ font-weight: $bold;
31
+ }
32
+ .pb_collapsible_main_kit {
33
+ .pb_nav_list_item_text_collapsible {
34
+ font-weight: $bold !important;
35
+ }
36
+ }
37
+ }
38
+
39
+ .font_regular {
40
+ .pb_nav_list_item_text {
41
+ font-weight: $regular;
42
+ }
43
+ .pb_collapsible_main_kit {
44
+ .pb_nav_list_item_text_collapsible {
45
+ font-weight: $regular !important;
46
+ }
47
+ }
48
+ }
49
+
50
+ //styling for default variant with collapsible
51
+ &[class*="_normal"] {
52
+ [class*="pb_collapsible_nav_item"] {
53
+ .pb_collapsible_content_kit {
54
+ margin-left: $space_lg + 3;
55
+ }
56
+ .pb_collapsible_main_kit {
57
+ border-radius: unset;
58
+ }
59
+ &[class*="_active"] {
60
+ .pb_collapsible_main_kit {
61
+ background-color: $active_light;
62
+ }
63
+ .pb_nav_list_item_link {
64
+ border-color: transparent !important;
65
+ .pb_nav_list_item_text {
66
+ color: unset !important;
67
+ font-weight: $regular !important;
68
+ }
69
+ }
70
+ }
71
+
72
+ &.dark {
73
+ border-color: $border_dark;
74
+ .pb_collapsible_main_kit:hover {
75
+ .pb_nav_list_item_text_collapsible {
76
+ color: $white !important;
77
+ }
78
+ }
79
+ &[class*="_active"] {
80
+ .pb_collapsible_main_kit {
81
+ background-color: mix($white, $card_dark, 20%);
82
+ .pb_nav_list_item_text_collapsible,
83
+ svg {
84
+ color: $white !important;
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ //styling bold variant to work with collapsible
93
+ &[class*="_bold"] {
94
+ [class*="pb_collapsible_nav_item"] {
95
+ &[class*="_active"] {
96
+ .pb_collapsible_main_kit {
97
+ background-color: $primary !important;
98
+ border-radius: $border_rad_heavier;
99
+ .pb_nav_list_item_text_collapsible,
100
+ .pb_nav_list_item_icon_collapsible,
101
+ .icon_wrapper,
102
+ .pb_icon_kit {
103
+ color: $white !important;
104
+ }
105
+ }
106
+ .pb_nav_list_item_link {
107
+ background-color: unset !important;
108
+ box-shadow: unset !important;
109
+ &:hover {
110
+ background-color: rgba($primary, 0.03) !important;
111
+ .pb_nav_list_item_text {
112
+ color: $primary !important;
113
+ }
114
+ }
115
+ .pb_nav_list_item_text {
116
+ font-weight: $regular !important;
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ //styling for subtle variant with collapsible
124
+ &[class*="_subtle"] {
125
+ [class*="pb_collapsible_nav_item"] {
126
+ &[class*="_active"] {
127
+ .pb_collapsible_main_kit {
128
+ background-color: $primary !important;
129
+ border-radius: $border_rad_heavier;
130
+ .pb_nav_list_item_text_collapsible,
131
+ .pb_nav_list_item_icon_collapsible,
132
+ .icon_wrapper,
133
+ .pb_icon_kit {
134
+ color: $white !important;
135
+ }
136
+ }
137
+
138
+ &:hover {
139
+ background-color: unset;
140
+ }
141
+ .pb_collapsible_main_kit:hover {
142
+ .pb_nav_list_item_text_collapsible {
143
+ color: $white !important;
144
+ }
145
+ }
146
+
147
+ .icon_wrapper {
148
+ &:hover {
149
+ background-color: mix($primary, $card_light, 40%);
150
+ .pb_icon_kit {
151
+ color: $primary !important;
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ }
158
+
159
+ [class*="pb_collapsible_nav_item"] {
160
+ .pb_nav_list_kit_item {
161
+ margin-right: 0px !important;
162
+ }
163
+
164
+ &[class*="_active"] {
165
+ background-color: unset !important;
166
+ .pb_nav_list_item_link {
167
+ color: unset !important;
168
+ }
169
+ }
170
+
171
+ .pb_nav_list_item_link_collapsible {
172
+ &:focus-visible {
173
+ outline: none;
174
+ }
175
+ }
176
+
177
+ .pb_collapsible_main_kit {
178
+ &:focus-visible {
179
+ box-shadow: 0px 0px 0px 2px $primary_action;
180
+ border-radius: $border_rad_heavier;
181
+ }
182
+ }
183
+
184
+ //Make sure link is entire width of navitem when in collapsible
185
+ .pb_collapsible_main_kit {
186
+ .pb_flex_item_kit:first-child {
187
+ width: 100%;
188
+ }
189
+ }
190
+
21
191
  &:hover {
22
- background-color: rgba($primary_action, $opacity_3);
192
+ .pb_nav_list_item_link_collapsible {
193
+ background-color: unset !important;
194
+ }
195
+ }
196
+
197
+ // vertical line on left of collapsible content
198
+ .pb_collapsible_content_kit {
199
+ margin-left: $space_sm + 2;
200
+ border-left: 1px solid transparent;
201
+ }
202
+
203
+ .pb_collapsible_main_kit {
204
+ transition-property: color, border-color, background-color;
205
+ transition-duration: 0.15s;
206
+ transition-timing-function: $bezier;
207
+ border-radius: $border_rad_heavier;
208
+ &:hover {
209
+ background-color: mix($primary, $card_light, 10%);
210
+ .pb_nav_list_item_text_collapsible,
211
+ svg {
212
+ color: $primary !important;
213
+ }
214
+ }
215
+ }
216
+
217
+ .pb_collapsible_main_kit,
218
+ .pb_collapsible_content_kit,
219
+ .pb_collapsible_kit {
220
+ padding: 0 !important;
221
+ }
222
+
223
+ &[class*="_collapsible_trail"] {
224
+ @include collapsible_trail_class;
225
+ }
23
226
 
227
+ .icon_wrapper {
228
+ border-radius: $border_radius_rounded;
229
+ width: $space_sm + 3;
230
+ height: $space_sm + 3;
231
+ display: flex;
232
+ align-items: center;
233
+ justify-content: center;
234
+ margin-right: $space_xs;
235
+ &:hover {
236
+ background-color: mix($primary, $card_light, 40%);
237
+ }
238
+ }
239
+
240
+ &.dark {
241
+ .pb_nav_list_kit_item {
242
+ border-color: $border_dark;
243
+ .pb_nav_list_item_text {
244
+ color: $text_dk_light !important;
245
+ }
246
+ }
247
+ &[class*="pb_nav_list_kit_item"] [class*="_link"]:hover {
248
+ .pb_nav_list_item_text {
249
+ color: $white !important;
250
+ }
251
+ }
252
+
253
+ .pb_nav_list_item_text_collapsible {
254
+ color: $white !important;
255
+ }
256
+ .pb_nav_list_item_text {
257
+ color: $text_dk_light;
258
+ }
259
+ .pb_nav_list_kit_item:hover {
260
+ background-color: #ffffff33;
261
+ color: $white;
262
+ }
263
+ .pb_icon_kit {
264
+ color: $text_dk_light;
265
+ }
266
+
267
+ .pb_collapsible_main_kit:hover {
268
+ background-color: mix($white, $card_dark, 20%);
269
+ .pb_nav_list_item_text_collapsible,
270
+ svg {
271
+ color: $white !important;
272
+ }
273
+ }
274
+ .icon_wrapper:hover {
275
+ background-color: mix($white, $card_dark, 40%);
276
+ }
277
+ &[class*="_active"] {
278
+ .icon_wrapper:hover {
279
+ background-color: mix($primary, $card_light, 40%);
280
+ }
281
+ }
282
+
283
+ &[class*="pb_collapsible_nav_item"][class*="_collapsible_trail"] {
284
+ .pb_collapsible_content_kit {
285
+ border-color: $border_dark;
286
+ }
287
+ }
24
288
  }
25
289
  }
26
290
  }
27
- }
@@ -81,6 +81,9 @@ $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
+ }
84
87
  }
85
88
  [class*=_active] {
86
89
  background-color: $active_light;
@@ -101,6 +104,9 @@ $selector: ".pb_nav_list";
101
104
  // Horizontal Overrides
102
105
  [class*=pb_nav_list_kit_item] {
103
106
  margin: 0;
107
+ [class*=_item_text]{
108
+ font-weight: $regular;
109
+ }
104
110
  }
105
111
  [class*=_active] {
106
112
  [class*=_text] {
@@ -7,64 +7,141 @@ import { globalProps, GlobalProps } from '../utilities/globalProps'
7
7
  import Icon from '../pb_icon/_icon'
8
8
  import Image from '../pb_image/_image'
9
9
  import Collapsible from '../pb_collapsible/_collapsible'
10
+ import { NavChildProps } from './_nav'
10
11
 
11
12
  type NavItemProps = {
12
13
  active?: boolean,
13
14
  aria?: { [key: string]: string },
15
+ fontWeight?: "regular" | "bold" | "bolder",
14
16
  children?: React.ReactNode[] | React.ReactNode,
15
17
  className?: string,
16
18
  collapsible?: boolean,
17
- collapsibleClick?: () => void,
18
19
  data?: object,
20
+ dark?: boolean,
21
+ fontSize?: "normal" | "small",
19
22
  iconLeft?: string,
20
23
  iconRight?: string | string[],
21
- iconRightClick?: () => void,
22
- iconLeftClick?: () => void,
24
+ onIconRightClick?: () => void,
25
+ onIconLeftClick?: () => void,
23
26
  id?: string,
24
27
  imageUrl?: string,
25
28
  link?: string,
26
- onClick?: React.MouseEventHandler<HTMLElement>,
29
+ onClick?: () => void,
27
30
  target?: '_blank' | '_self' | '_parent' | '_top',
28
31
  text: string,
29
- toggleCollapsed?: any
32
+ collapsibleTrail?: boolean,
33
+ collapsed?: boolean,
34
+ paddingBottom?: string,
35
+ paddingTop?: string,
36
+ paddingLeft?: string,
37
+ paddingRight?: string,
38
+ paddingX?: string,
39
+ paddingY?: string,
40
+ padding?: 'none' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
41
+ orientation?: "vertical" | "horizontal",
42
+ variant?: "normal" | "subtle",
30
43
  } & GlobalProps
31
44
 
32
45
  const NavItem = (props: NavItemProps) => {
33
46
  const {
34
47
  active = false,
35
48
  aria = {},
49
+ fontWeight = "regular",
36
50
  children,
37
51
  className,
38
52
  collapsible,
39
- collapsibleClick,
40
53
  data = {},
54
+ dark = false,
55
+ fontSize = "normal",
41
56
  iconLeft,
42
57
  iconRight,
43
- iconRightClick,
44
- iconLeftClick,
58
+ onIconRightClick,
59
+ onIconLeftClick,
45
60
  id,
46
61
  imageUrl,
47
62
  link,
48
63
  onClick = () => { },
49
64
  target = '_self',
50
65
  text = '',
51
- toggleCollapsed
66
+ collapsibleTrail,
67
+ collapsed,
68
+ // orientation,
69
+ // variant,
70
+ itemPadding,
71
+ padding,
72
+ paddingX,
73
+ paddingY,
74
+ paddingBottom,
75
+ paddingTop,
76
+ paddingLeft,
77
+ paddingRight
52
78
  } = props
53
79
 
80
+ const filteredProps = {...props}
81
+ delete filteredProps?.padding
82
+ delete filteredProps?.paddingX
83
+ delete filteredProps?.paddingY
84
+ delete filteredProps?.paddingBottom
85
+ delete filteredProps?.paddingTop
86
+ delete filteredProps?.paddingRight
87
+ delete filteredProps?.paddingLeft
88
+
54
89
  const Tag = link ? 'a' : 'div'
55
90
  const activeClass = active === true ? 'active' : ''
91
+ const collapsibleTrailClass = collapsible && collapsibleTrail ? 'collapsible_trail' : ''
92
+ const fontSizeClass = fontSize === 'small' ? "font_size_small" : "font_size_normal"
93
+ const fontWeightClass = fontWeight === 'bold' ? "font_bold" : fontWeight === 'bolder' ? "font_bolder" : "font_regular"
56
94
  const ariaProps = buildAriaProps(aria)
57
95
  const dataProps = buildDataProps(data)
58
- const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass), collapsible ? 'pb_collapsible_nav_item' : '', globalProps(props), className)
96
+ const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass),
97
+ collapsible ? buildCss('pb_collapsible_nav_item', activeClass, collapsibleTrailClass) : '',
98
+ fontSizeClass,
99
+ fontWeightClass,
100
+ globalProps(filteredProps),
101
+ className)
102
+
103
+ const paddingProps = {
104
+ padding,
105
+ paddingBottom,
106
+ paddingTop,
107
+ paddingRight,
108
+ paddingLeft,
109
+ paddingX,
110
+ paddingY,
111
+ };
112
+
113
+ const finalItemPadding = {
114
+ ...(itemPadding || {}),
115
+ ...Object.entries(paddingProps).reduce((acc:any, [prop, value]) => {
116
+ if (value) {
117
+ acc[prop] = value;
118
+ }
119
+ return acc;
120
+ }, {}),
121
+ };
59
122
 
123
+ const tagClasses = classnames(collapsible ? 'pb_nav_list_item_link_collapsible' : "pb_nav_list_item_link",
124
+ globalProps({...finalItemPadding}))
60
125
 
61
126
  const handleIconClick = (e:any) => {
62
- if (iconLeftClick) {
127
+ if (onIconLeftClick) {
63
128
  e.stopPropagation();
64
- iconLeftClick()
129
+ onIconLeftClick()
65
130
  }
66
131
  }
67
132
 
133
+ // Map over the children and clone them with itemPadding prop so nested navItems all get itemPadding
134
+ const childrenWithProps = React.Children.map(children, (child) => {
135
+ if (React.isValidElement(child)) {
136
+ const childProps: NavChildProps = {
137
+ itemPadding: itemPadding
138
+ };
139
+ return React.cloneElement(child, childProps);
140
+ }
141
+ return child;
142
+ });
143
+
144
+
68
145
  return (
69
146
  <li
70
147
  {...ariaProps}
@@ -77,20 +154,19 @@ const NavItem = (props: NavItemProps) => {
77
154
  <Collapsible icon={iconRight ? iconRight : ['plus','minus']}
78
155
  iconSize="xs"
79
156
  id={id}
80
- collapsed={toggleCollapsed}
81
- iconClick={iconRightClick}
82
- onClick={collapsibleClick}
157
+ collapsed={collapsed}
158
+ onIconClick={onIconRightClick}
159
+ onClick={onClick}
83
160
  >
84
- <Collapsible.Main>
161
+ <Collapsible.Main dark={dark}>
85
162
  <Tag
86
- className="pb_nav_list_item_link"
163
+ className={tagClasses}
87
164
  href={link}
88
- onClick={onClick}
89
165
  target={target}
90
166
  >
91
167
  {imageUrl &&
92
168
  <div
93
- className="pb_nav_list_item_icon_section"
169
+ className="pb_nav_list_item_icon_section_collapsible"
94
170
  key={imageUrl}
95
171
  onClick={(e)=>handleIconClick(e)}
96
172
  >
@@ -103,30 +179,30 @@ const NavItem = (props: NavItemProps) => {
103
179
 
104
180
  {iconLeft &&
105
181
  <div
106
- className="pb_nav_list_item_icon_section"
182
+ className="pb_nav_list_item_icon_section_collapsible"
107
183
  key={iconLeft}
108
184
  onClick={(e)=>handleIconClick(e)}
109
185
  >
110
186
  <Icon
111
- className="pb_nav_list_item_icon_left"
187
+ className="pb_nav_list_item_icon_left_collapsible"
112
188
  fixedWidth
113
189
  icon={iconLeft}
114
190
  />
115
191
  </div>
116
192
  }
117
- <span className="pb_nav_list_item_text">
193
+ <span className="pb_nav_list_item_text_collapsible">
118
194
  {text}
119
195
  </span>
120
196
  </Tag>
121
197
  </Collapsible.Main>
122
198
  <Collapsible.Content>
123
- {children}
199
+ {childrenWithProps}
124
200
  </Collapsible.Content>
125
201
  </Collapsible>
126
202
  ) : (
127
203
  <Tag
128
- className="pb_nav_list_item_link"
129
- href={link}
204
+ className={tagClasses}
205
+ href={link}
130
206
  onClick={onClick}
131
207
  target={target}
132
208
  >
@@ -0,0 +1,5 @@
1
+ @mixin collapsible_trail_class {
2
+ .pb_collapsible_content_kit {
3
+ border-color: $border_light;
4
+ }
5
+ }
@@ -20,8 +20,15 @@ type NavProps = {
20
20
  link?: string,
21
21
  title?: string,
22
22
  variant?: "normal" | "subtle",
23
+ itemPadding?: {padding?: string, paddingBottom?: string, paddingTop?: string, paddingRight?: string, paddingLeft?: string, paddingX?: string, paddingY?: string}
23
24
  } & GlobalProps
24
25
 
26
+ export type NavChildProps = {
27
+ orientation?: "vertical" | "horizontal";
28
+ variant?: "normal" | "subtle";
29
+ itemPadding?: {padding?: string, paddingBottom?: string, paddingTop?: string, paddingRight?: string, paddingLeft?: string, paddingX?: string, paddingY?: string}
30
+ };
31
+
25
32
  const Nav = (props: NavProps) => {
26
33
  const {
27
34
  aria = {},
@@ -37,6 +44,7 @@ const Nav = (props: NavProps) => {
37
44
  orientation = 'vertical',
38
45
  title = '',
39
46
  variant = 'normal',
47
+ itemPadding,
40
48
  } = props
41
49
 
42
50
  const ariaProps = buildAriaProps(aria)
@@ -50,6 +58,19 @@ const Nav = (props: NavProps) => {
50
58
  className
51
59
  )
52
60
 
61
+ // Map over the children and clone them with orientation and variant props to gain access to them in navItem
62
+ const childrenWithProps = React.Children.map(children, (child) => {
63
+ if (React.isValidElement(child)) {
64
+ const childProps: NavChildProps = {
65
+ orientation: orientation,
66
+ variant: variant,
67
+ itemPadding: itemPadding
68
+ };
69
+ return React.cloneElement(child, childProps);
70
+ }
71
+ return child;
72
+ });
73
+
53
74
  return (
54
75
  <nav
55
76
  {...ariaProps}
@@ -72,7 +93,7 @@ const Nav = (props: NavProps) => {
72
93
  </a>
73
94
  </div>
74
95
  }
75
- <ul>{children}</ul>
96
+ <ul>{childrenWithProps}</ul>
76
97
  </nav>
77
98
  )
78
99
  }
@@ -27,14 +27,7 @@
27
27
  }
28
28
  [class*=_text] {
29
29
  flex: 1;
30
- font-weight: $regular;
31
30
  }
32
- }
33
- &[class*=_active] [class*=_link] {
34
- @include pb_title_4;
35
- color: $primary;
36
- letter-spacing: normal;
37
- }
38
31
  &:hover {
39
32
  background-color: rgba($primary, 0.03);
40
33
  [class*=_icon] {
@@ -44,5 +37,11 @@
44
37
  color: $primary;
45
38
  }
46
39
  }
40
+ }
41
+ &[class*=_active] [class*=_link] {
42
+ @include pb_title_4;
43
+ color: $primary;
44
+ letter-spacing: normal;
45
+ }
47
46
  }
48
47
  }
@@ -56,7 +56,7 @@ $selector: ".pb_nav_list";
56
56
  color: $primary;
57
57
  }
58
58
  [class*=_text] {
59
- color: $primary;
59
+ color: $primary !important;
60
60
  }
61
61
  }
62
62
  }