playbook_ui 12.37.0 → 12.38.0.pre.alpha.PLAY966collapsiblenav41082
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +6 -0
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +3 -3
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +10 -9
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +4 -8
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +75 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -6
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_date/_date.tsx +7 -8
- data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +2 -2
- data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +29 -5
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
- data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +45 -31
- data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +5 -3
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +24 -21
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +1 -1
- data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +1 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +6 -8
- data/app/pb_kits/playbook/pb_kit/dateTime.ts +146 -63
- data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +52 -31
- data/app/pb_kits/playbook/pb_message/_message.tsx +24 -24
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +280 -17
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +6 -0
- data/app/pb_kits/playbook/pb_nav/_item.tsx +75 -24
- data/app/pb_kits/playbook/pb_nav/_mixins.scss +5 -0
- data/app/pb_kits/playbook/pb_nav/_nav.tsx +18 -1
- data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +6 -7
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +85 -58
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +58 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +23 -0
- data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_custom_icons.jsx → _collapsible_nav_emphasize.jsx} +14 -5
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -3
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +5 -4
- data/app/pb_kits/playbook/pb_nav/item.rb +29 -3
- data/app/pb_kits/playbook/pb_time/_time.tsx +9 -11
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +46 -49
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +4 -6
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +11 -11
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +8 -11
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/version.rb +2 -2
- metadata +16 -9
- 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
|
-
.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
}
|
12
|
-
|
13
|
-
.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
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] {
|
@@ -11,57 +11,109 @@ import Collapsible from '../pb_collapsible/_collapsible'
|
|
11
11
|
type NavItemProps = {
|
12
12
|
active?: boolean,
|
13
13
|
aria?: { [key: string]: string },
|
14
|
+
fontWeight?: "regular" | "bold" | "bolder",
|
14
15
|
children?: React.ReactNode[] | React.ReactNode,
|
15
16
|
className?: string,
|
16
17
|
collapsible?: boolean,
|
17
|
-
collapsibleClick?: () => void,
|
18
18
|
data?: object,
|
19
|
+
dark?: boolean,
|
20
|
+
fontSize?: "normal" | "small",
|
19
21
|
iconLeft?: string,
|
20
22
|
iconRight?: string | string[],
|
21
|
-
|
22
|
-
|
23
|
+
onIconRightClick?: () => void,
|
24
|
+
onIconLeftClick?: () => void,
|
23
25
|
id?: string,
|
24
26
|
imageUrl?: string,
|
25
27
|
link?: string,
|
26
|
-
onClick?:
|
28
|
+
onClick?: () => void,
|
27
29
|
target?: '_blank' | '_self' | '_parent' | '_top',
|
28
30
|
text: string,
|
29
|
-
|
31
|
+
collapsibleTrail?: boolean,
|
32
|
+
collapsed?: boolean,
|
33
|
+
paddingBottom?: string,
|
34
|
+
paddingTop?: string,
|
35
|
+
paddingLeft?: string,
|
36
|
+
paddingRight?: string,
|
37
|
+
paddingX?: string,
|
38
|
+
paddingY?: string,
|
39
|
+
padding?: 'none' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
40
|
+
orientation?: "vertical" | "horizontal",
|
41
|
+
variant?: "normal" | "subtle",
|
30
42
|
} & GlobalProps
|
31
43
|
|
32
44
|
const NavItem = (props: NavItemProps) => {
|
33
45
|
const {
|
34
46
|
active = false,
|
35
47
|
aria = {},
|
48
|
+
fontWeight = "regular",
|
36
49
|
children,
|
37
50
|
className,
|
38
51
|
collapsible,
|
39
|
-
collapsibleClick,
|
40
52
|
data = {},
|
53
|
+
dark = false,
|
54
|
+
fontSize = "normal",
|
41
55
|
iconLeft,
|
42
56
|
iconRight,
|
43
|
-
|
44
|
-
|
57
|
+
onIconRightClick,
|
58
|
+
onIconLeftClick,
|
45
59
|
id,
|
46
60
|
imageUrl,
|
47
61
|
link,
|
48
62
|
onClick = () => { },
|
49
63
|
target = '_self',
|
50
64
|
text = '',
|
51
|
-
|
65
|
+
collapsibleTrail,
|
66
|
+
collapsed,
|
67
|
+
// orientation,
|
68
|
+
// variant,
|
69
|
+
padding,
|
70
|
+
paddingX,
|
71
|
+
paddingY,
|
72
|
+
paddingBottom,
|
73
|
+
paddingTop,
|
74
|
+
paddingLeft,
|
75
|
+
paddingRight
|
52
76
|
} = props
|
53
77
|
|
78
|
+
const filteredProps = {...props}
|
79
|
+
delete filteredProps?.padding
|
80
|
+
delete filteredProps?.paddingX
|
81
|
+
delete filteredProps?.paddingY
|
82
|
+
delete filteredProps?.paddingBottom
|
83
|
+
delete filteredProps?.paddingTop
|
84
|
+
delete filteredProps?.paddingRight
|
85
|
+
delete filteredProps?.paddingLeft
|
86
|
+
|
54
87
|
const Tag = link ? 'a' : 'div'
|
55
88
|
const activeClass = active === true ? 'active' : ''
|
89
|
+
const collapsibleTrailClass = collapsible && collapsibleTrail ? 'collapsible_trail' : ''
|
90
|
+
const fontSizeClass = fontSize === 'small' ? "font_size_small" : "font_size_normal"
|
91
|
+
const fontWeightClass = fontWeight === 'bold' ? "font_bold" : fontWeight === 'bolder' ? "font_bolder" : "font_regular"
|
56
92
|
const ariaProps = buildAriaProps(aria)
|
57
93
|
const dataProps = buildDataProps(data)
|
58
|
-
const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass),
|
94
|
+
const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass),
|
95
|
+
collapsible ? buildCss('pb_collapsible_nav_item', activeClass, collapsibleTrailClass) : '',
|
96
|
+
fontSizeClass,
|
97
|
+
fontWeightClass,
|
98
|
+
globalProps(filteredProps),
|
99
|
+
className)
|
100
|
+
|
101
|
+
const tagClasses = classnames(collapsible ? 'pb_nav_list_item_link_collapsible' : "pb_nav_list_item_link",
|
102
|
+
globalProps({
|
103
|
+
padding,
|
104
|
+
paddingBottom,
|
105
|
+
paddingLeft,
|
106
|
+
paddingRight,
|
107
|
+
paddingTop,
|
108
|
+
paddingX,
|
109
|
+
paddingY,
|
110
|
+
}))
|
59
111
|
|
60
112
|
|
61
113
|
const handleIconClick = (e:any) => {
|
62
|
-
if (
|
114
|
+
if (onIconLeftClick) {
|
63
115
|
e.stopPropagation();
|
64
|
-
|
116
|
+
onIconLeftClick()
|
65
117
|
}
|
66
118
|
}
|
67
119
|
|
@@ -77,20 +129,19 @@ const NavItem = (props: NavItemProps) => {
|
|
77
129
|
<Collapsible icon={iconRight ? iconRight : ['plus','minus']}
|
78
130
|
iconSize="xs"
|
79
131
|
id={id}
|
80
|
-
collapsed={
|
81
|
-
|
82
|
-
onClick={
|
132
|
+
collapsed={collapsed}
|
133
|
+
onIconClick={onIconRightClick}
|
134
|
+
onClick={onClick}
|
83
135
|
>
|
84
|
-
<Collapsible.Main>
|
136
|
+
<Collapsible.Main dark={dark}>
|
85
137
|
<Tag
|
86
|
-
className=
|
138
|
+
className={tagClasses}
|
87
139
|
href={link}
|
88
|
-
onClick={onClick}
|
89
140
|
target={target}
|
90
141
|
>
|
91
142
|
{imageUrl &&
|
92
143
|
<div
|
93
|
-
className="
|
144
|
+
className="pb_nav_list_item_icon_section_collapsible"
|
94
145
|
key={imageUrl}
|
95
146
|
onClick={(e)=>handleIconClick(e)}
|
96
147
|
>
|
@@ -103,18 +154,18 @@ const NavItem = (props: NavItemProps) => {
|
|
103
154
|
|
104
155
|
{iconLeft &&
|
105
156
|
<div
|
106
|
-
className="
|
157
|
+
className="pb_nav_list_item_icon_section_collapsible"
|
107
158
|
key={iconLeft}
|
108
159
|
onClick={(e)=>handleIconClick(e)}
|
109
160
|
>
|
110
161
|
<Icon
|
111
|
-
className="
|
162
|
+
className="pb_nav_list_item_icon_left_collapsible"
|
112
163
|
fixedWidth
|
113
164
|
icon={iconLeft}
|
114
165
|
/>
|
115
166
|
</div>
|
116
167
|
}
|
117
|
-
<span className="
|
168
|
+
<span className="pb_nav_list_item_text_collapsible">
|
118
169
|
{text}
|
119
170
|
</span>
|
120
171
|
</Tag>
|
@@ -125,8 +176,8 @@ const NavItem = (props: NavItemProps) => {
|
|
125
176
|
</Collapsible>
|
126
177
|
) : (
|
127
178
|
<Tag
|
128
|
-
|
129
|
-
|
179
|
+
className={tagClasses}
|
180
|
+
href={link}
|
130
181
|
onClick={onClick}
|
131
182
|
target={target}
|
132
183
|
>
|
@@ -22,6 +22,11 @@ type NavProps = {
|
|
22
22
|
variant?: "normal" | "subtle",
|
23
23
|
} & GlobalProps
|
24
24
|
|
25
|
+
type NavChildProps = {
|
26
|
+
orientation: "vertical" | "horizontal";
|
27
|
+
variant: "normal" | "subtle";
|
28
|
+
};
|
29
|
+
|
25
30
|
const Nav = (props: NavProps) => {
|
26
31
|
const {
|
27
32
|
aria = {},
|
@@ -50,6 +55,18 @@ const Nav = (props: NavProps) => {
|
|
50
55
|
className
|
51
56
|
)
|
52
57
|
|
58
|
+
// Map over the children and clone them with orientation and variant props to gain access to them in navItem
|
59
|
+
const childrenWithProps = React.Children.map(children, (child) => {
|
60
|
+
if (React.isValidElement(child)) {
|
61
|
+
const childProps: NavChildProps = {
|
62
|
+
orientation: orientation,
|
63
|
+
variant: variant,
|
64
|
+
};
|
65
|
+
return React.cloneElement(child, childProps);
|
66
|
+
}
|
67
|
+
return child;
|
68
|
+
});
|
69
|
+
|
53
70
|
return (
|
54
71
|
<nav
|
55
72
|
{...ariaProps}
|
@@ -72,7 +89,7 @@ const Nav = (props: NavProps) => {
|
|
72
89
|
</a>
|
73
90
|
</div>
|
74
91
|
}
|
75
|
-
<ul>{
|
92
|
+
<ul>{childrenWithProps}</ul>
|
76
93
|
</nav>
|
77
94
|
)
|
78
95
|
}
|
@@ -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
|
}
|