playbook_ui 12.36.0 → 12.37.0.pre.alpha.PLAY951collapsiblenav31073

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/index.js +2 -1
  3. data/app/pb_kits/playbook/pb_badge/docs/_badge_colors_swift.md +33 -0
  4. data/app/pb_kits/playbook/pb_badge/docs/_badge_default_swift.md +9 -0
  5. data/app/pb_kits/playbook/pb_badge/docs/_badge_notification_swift.md +9 -0
  6. data/app/pb_kits/playbook/pb_badge/docs/_badge_props_swift.md +6 -0
  7. data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded_swift.md +9 -0
  8. data/app/pb_kits/playbook/pb_badge/docs/example.yml +7 -0
  9. data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +6 -0
  10. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +15 -13
  11. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +25 -8
  12. data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
  14. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
  15. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +11 -4
  16. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
  17. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
  18. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +75 -0
  19. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +3 -0
  20. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -6
  21. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +2 -1
  22. data/app/pb_kits/playbook/pb_collapsible/useCollapsible.tsx +14 -0
  23. data/app/pb_kits/playbook/pb_date/_date.tsx +7 -8
  24. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +2 -2
  25. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +29 -5
  26. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
  27. data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
  28. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +45 -31
  29. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +5 -3
  30. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +24 -21
  31. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +1 -1
  32. data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +1 -1
  33. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +2 -2
  34. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +1 -1
  35. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +6 -8
  36. data/app/pb_kits/playbook/pb_kit/dateTime.ts +146 -63
  37. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +52 -31
  38. data/app/pb_kits/playbook/pb_message/_message.tsx +24 -24
  39. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +273 -3
  40. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +6 -0
  41. data/app/pb_kits/playbook/pb_nav/_item.tsx +47 -10
  42. data/app/pb_kits/playbook/pb_nav/_mixins.scss +5 -0
  43. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +6 -7
  44. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  45. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +13 -6
  46. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -0
  47. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +58 -0
  48. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +1 -0
  49. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +23 -0
  50. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_custom_icons.jsx → _collapsible_nav_emphasize.jsx} +18 -11
  51. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -0
  52. data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -3
  53. data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
  54. data/app/pb_kits/playbook/pb_nav/item.html.erb +5 -4
  55. data/app/pb_kits/playbook/pb_nav/item.rb +25 -2
  56. data/app/pb_kits/playbook/pb_pill/docs/_pill_default_swift.md +5 -0
  57. data/app/pb_kits/playbook/pb_pill/docs/_pill_props_swift.md +5 -0
  58. data/app/pb_kits/playbook/pb_pill/docs/_pill_variants_swift.md +10 -0
  59. data/app/pb_kits/playbook/pb_pill/docs/example.yml +5 -0
  60. data/app/pb_kits/playbook/pb_radio/docs/_radio_alignment_swift.md +16 -0
  61. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_swift.md +18 -0
  62. data/app/pb_kits/playbook/pb_radio/docs/_radio_default_swift.md +15 -0
  63. data/app/pb_kits/playbook/pb_radio/docs/_radio_error_swift.md +14 -0
  64. data/app/pb_kits/playbook/pb_radio/docs/_radio_orientation_swift.md +15 -0
  65. data/app/pb_kits/playbook/pb_radio/docs/_radio_padding_swift.md +31 -0
  66. data/app/pb_kits/playbook/pb_radio/docs/_radio_props_swift.md +10 -0
  67. data/app/pb_kits/playbook/pb_radio/docs/_radio_spacing_swift.md +36 -0
  68. data/app/pb_kits/playbook/pb_radio/docs/_radio_subtitle_swift.md +13 -0
  69. data/app/pb_kits/playbook/pb_radio/docs/example.yml +11 -0
  70. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_options.html.erb +12 -0
  71. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +1 -0
  72. data/app/pb_kits/playbook/pb_text_input/text_input.rb +1 -1
  73. data/app/pb_kits/playbook/pb_time/_time.tsx +9 -11
  74. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +46 -49
  75. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +4 -6
  76. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +11 -11
  77. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align_swift.md +45 -0
  78. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default_swift.md +26 -0
  79. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed_swift.md +25 -0
  80. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_props_swift.md +10 -0
  81. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones_swift.md +67 -0
  82. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated_swift.md +19 -0
  83. data/app/pb_kits/playbook/pb_timestamp/docs/example.yml +8 -0
  84. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +8 -11
  85. data/dist/playbook-rails.js +7 -7
  86. data/lib/playbook/version.rb +2 -2
  87. metadata +41 -9
  88. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +0 -120
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import classnames from "classnames";
3
- import DateTime from "../pb_kit/dateTime";
4
3
  import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
5
4
  import { globalProps } from "../utilities/globalProps";
5
+ import DateTime from '../pb_kit/dateTime';
6
6
 
7
7
  import Body from "../pb_body/_body";
8
8
  import Caption from "../pb_caption/_caption";
@@ -26,9 +26,9 @@ type LabelValueProps = {
26
26
  title?: string;
27
27
  };
28
28
 
29
- const dateString = (value: DateTime) => {
30
- const month = value.toMonthNum();
31
- const day = value.toDay();
29
+ const dateString = (value: Date) => {
30
+ const month = DateTime.toMonthNum(value);
31
+ const day = DateTime.toDay(value);
32
32
 
33
33
  return ` · ${month}/${day}`;
34
34
  };
@@ -52,7 +52,6 @@ const LabelValue = (props: LabelValueProps) => {
52
52
 
53
53
  const ariaProps = buildAriaProps(aria);
54
54
  const dataProps = buildDataProps(data);
55
- const formattedDate = new DateTime({ value: date });
56
55
  const variantClass = variant === "details" ? "details" : "";
57
56
  const classes = classnames(
58
57
  buildCss("pb_label_value_kit", variantClass),
@@ -62,59 +61,81 @@ const LabelValue = (props: LabelValueProps) => {
62
61
 
63
62
  return (
64
63
  <div
65
- {...ariaProps}
66
- {...dataProps}
67
- className={classes}
68
- id={id}
69
- title={title}
64
+ {...ariaProps}
65
+ {...dataProps}
66
+ className={classes}
67
+ id={id}
68
+ title={title}
70
69
  >
71
- <Caption dark={dark} text={label} />
70
+ <Caption dark={dark}
71
+ text={label}
72
+ />
72
73
  {variant === "details" ? (
73
- <Flex inline vertical="center">
74
+ <Flex inline
75
+ vertical="center"
76
+ >
74
77
  {icon && (
75
- <Body color="light" dark={dark} marginRight="xs">
76
- <Icon dark={dark} fixedWidth icon={icon} />
78
+ <Body color="light"
79
+ dark={dark}
80
+ marginRight="xs"
81
+ >
82
+ <Icon dark={dark}
83
+ fixedWidth
84
+ icon={icon}
85
+ />
77
86
  </Body>
78
87
  )}
79
88
  {description && (
80
89
  <Body
81
- color="light"
82
- dark={dark}
83
- marginRight="xs"
84
- text={description}
90
+ color="light"
91
+ dark={dark}
92
+ marginRight="xs"
93
+ text={description}
85
94
  />
86
95
  )}
87
96
  {active === true ? (
88
- <Flex inline vertical="center">
97
+ <Flex inline
98
+ vertical="center"
99
+ >
89
100
  {title && (
90
- <Title dark={dark} size={4} text={title} variant="link" />
101
+ <Title dark={dark}
102
+ size={4}
103
+ text={title}
104
+ variant="link"
105
+ />
91
106
  )}
92
107
  {date && (
93
108
  <Title
94
- dark={dark}
95
- marginLeft="xs"
96
- size={4}
97
- text={" " + dateString(formattedDate)}
98
- variant="link"
109
+ dark={dark}
110
+ marginLeft="xs"
111
+ size={4}
112
+ text={" " + dateString(date)}
113
+ variant="link"
99
114
  />
100
115
  )}
101
116
  </Flex>
102
117
  ) : (
103
118
  <>
104
- {title && <Title dark={dark} size={4} text={title} />}
119
+ {title && <Title dark={dark}
120
+ size={4}
121
+ text={title}
122
+ />
123
+ }
105
124
  {date && (
106
125
  <Title
107
- dark={dark}
108
- marginLeft="xs"
109
- size={4}
110
- text={" " + dateString(formattedDate)}
126
+ dark={dark}
127
+ marginLeft="xs"
128
+ size={4}
129
+ text={" " + dateString(date)}
111
130
  />
112
131
  )}
113
132
  </>
114
133
  )}
115
134
  </Flex>
116
135
  ) : (
117
- <Body dark={dark} text={value} />
136
+ <Body dark={dark}
137
+ text={value}
138
+ />
118
139
  )}
119
140
  </div>
120
141
  );
@@ -25,7 +25,7 @@ type MessageProps = {
25
25
  label?: string,
26
26
  message: string,
27
27
  timestamp?: string,
28
- timestampObject?: string,
28
+ timestampObject?: Date,
29
29
  timezone?: string,
30
30
  alignTimestamp?: string,
31
31
  }
@@ -62,50 +62,50 @@ const Message = (props: MessageProps) => {
62
62
 
63
63
  return (
64
64
  <div
65
- {...ariaProps}
66
- {...dataProps}
67
- className={classes}
68
- id={id}
65
+ {...ariaProps}
66
+ {...dataProps}
67
+ className={classes}
68
+ id={id}
69
69
  >
70
70
  {shouldDisplayAvatar &&
71
71
  <Avatar
72
- imageUrl={avatarUrl}
73
- name={avatarName}
74
- size="xs"
75
- status={avatarStatus}
72
+ imageUrl={avatarUrl}
73
+ name={avatarName}
74
+ size="xs"
75
+ status={avatarStatus}
76
76
  />
77
77
  }
78
78
  <div className="content_wrapper">
79
79
  <Flex
80
- justify={alignTimestamp === 'left' ? 'none' : 'between'}
81
- orientation="row"
80
+ justify={alignTimestamp === 'left' ? 'none' : 'between'}
81
+ orientation="row"
82
82
  >
83
83
  {label &&
84
84
  <Title
85
- className="message_title"
86
- size={4}
87
- text={label}
85
+ className="message_title"
86
+ size={4}
87
+ text={label}
88
88
  />
89
89
  }
90
90
  <Timestamp
91
- className={`pull-${alignTimestamp} ${timestampObject ? 'message_humanized_time' : null}`}
92
- text={timestamp}
93
- timestamp={''}
94
- timezone={timezone}
91
+ className={`pull-${alignTimestamp} ${timestampObject ? 'message_humanized_time' : null}`}
92
+ text={timestamp}
93
+ timestamp={''}
94
+ timezone={timezone}
95
95
  />
96
96
  {timestampObject &&
97
97
  <Timestamp
98
- className={`pull-${alignTimestamp} message_timestamp`}
99
- text={''}
100
- timestamp={timestampObject}
101
- timezone={timezone}
98
+ className={`pull-${alignTimestamp} message_timestamp`}
99
+ text={''}
100
+ timestamp={timestampObject}
101
+ timezone={timezone}
102
102
  />
103
103
  }
104
104
  </Flex>
105
105
  {message &&
106
106
  <Body
107
- className="pb_message_body"
108
- text={message}
107
+ className="pb_message_body"
108
+ text={message}
109
109
  />
110
110
  }
111
111
  {children}
@@ -1,6 +1,276 @@
1
+ @import "../tokens/spacing";
2
+ @import "../tokens/colors";
3
+ @import "../tokens/border_radius";
4
+ @import "../tokens/titles";
5
+ @import "../tokens/typography";
6
+ @import "./mixins";
7
+
1
8
  [class^="pb_nav_list"] {
2
- .pb_collapsible_main_kit,
3
- .pb_collapsible_content_kit {
4
- padding: 0 !important;
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
+ }
37
+ }
38
+
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
+
177
+ &: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
+ }
208
+
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
+ }
5
275
  }
6
276
  }
@@ -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,43 +11,73 @@ import Collapsible from '../pb_collapsible/_collapsible'
11
11
  type NavItemProps = {
12
12
  active?: boolean,
13
13
  aria?: { [key: string]: string },
14
+ fontWeight?: "regular" | "bold",
14
15
  children?: React.ReactNode[] | React.ReactNode,
15
16
  className?: string,
16
17
  collapsible?: boolean,
17
18
  data?: object,
19
+ dark?: boolean,
20
+ fontSize?: "normal" | "small",
18
21
  iconLeft?: string,
19
22
  iconRight?: string | string[],
23
+ onIconRightClick?: () => void,
24
+ onIconLeftClick?: () => void,
20
25
  id?: string,
21
26
  imageUrl?: string,
22
27
  link?: string,
23
- onClick?: React.MouseEventHandler<HTMLElement>,
28
+ onClick?: () => void,
24
29
  target?: '_blank' | '_self' | '_parent' | '_top',
25
30
  text: string,
31
+ collapsibleTrail?: boolean,
32
+ collapsed?: boolean
26
33
  } & GlobalProps
27
34
 
28
35
  const NavItem = (props: NavItemProps) => {
29
36
  const {
30
37
  active = false,
31
38
  aria = {},
39
+ fontWeight = "regular",
32
40
  children,
33
41
  className,
34
42
  collapsible,
35
43
  data = {},
44
+ dark = false,
45
+ fontSize = "normal",
36
46
  iconLeft,
37
47
  iconRight,
48
+ onIconRightClick,
49
+ onIconLeftClick,
38
50
  id,
39
51
  imageUrl,
40
52
  link,
41
53
  onClick = () => { },
42
54
  target = '_self',
43
55
  text = '',
56
+ collapsibleTrail,
57
+ collapsed
44
58
  } = props
45
59
 
46
60
  const Tag = link ? 'a' : 'div'
47
61
  const activeClass = active === true ? 'active' : ''
62
+ const collapsibleTrailClass = collapsible && collapsibleTrail ? 'collapsible_trail' : ''
63
+ const fontSizeClass = fontSize === 'small' ? "font_size_small" : "font_size_normal"
64
+ const fontWeightClass = fontWeight === 'bold' ? "font_bold" : "font_regular"
48
65
  const ariaProps = buildAriaProps(aria)
49
66
  const dataProps = buildDataProps(data)
50
- const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass), globalProps(props), className)
67
+ const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass),
68
+ collapsible ? buildCss('pb_collapsible_nav_item', activeClass, collapsibleTrailClass) : '',
69
+ fontSizeClass,
70
+ fontWeightClass,
71
+ globalProps(props),
72
+ className)
73
+
74
+
75
+ const handleIconClick = (e:any) => {
76
+ if (onIconLeftClick) {
77
+ e.stopPropagation();
78
+ onIconLeftClick()
79
+ }
80
+ }
51
81
 
52
82
  return (
53
83
  <li
@@ -58,18 +88,24 @@ const NavItem = (props: NavItemProps) => {
58
88
  >
59
89
  {
60
90
  collapsible ? (
61
- <Collapsible icon={iconRight ? iconRight : ['plus','minus']} iconSize="xs">
62
- <Collapsible.Main>
91
+ <Collapsible icon={iconRight ? iconRight : ['plus','minus']}
92
+ iconSize="xs"
93
+ id={id}
94
+ collapsed={collapsed}
95
+ onIconClick={onIconRightClick}
96
+ onClick={onClick}
97
+ >
98
+ <Collapsible.Main dark={dark}>
63
99
  <Tag
64
- className="pb_nav_list_item_link"
100
+ className="pb_nav_list_item_link_collapsible"
65
101
  href={link}
66
- onClick={onClick}
67
102
  target={target}
68
103
  >
69
104
  {imageUrl &&
70
105
  <div
71
- className="pb_nav_list_item_icon_section"
106
+ className="pb_nav_list_item_icon_section_collapsible"
72
107
  key={imageUrl}
108
+ onClick={(e)=>handleIconClick(e)}
73
109
  >
74
110
  <Image
75
111
  className="pb_nav_img_wrapper"
@@ -80,17 +116,18 @@ const NavItem = (props: NavItemProps) => {
80
116
 
81
117
  {iconLeft &&
82
118
  <div
83
- className="pb_nav_list_item_icon_section"
119
+ className="pb_nav_list_item_icon_section_collapsible"
84
120
  key={iconLeft}
121
+ onClick={(e)=>handleIconClick(e)}
85
122
  >
86
123
  <Icon
87
- className="pb_nav_list_item_icon_left"
124
+ className="pb_nav_list_item_icon_left_collapsible"
88
125
  fixedWidth
89
126
  icon={iconLeft}
90
127
  />
91
128
  </div>
92
129
  }
93
- <span className="pb_nav_list_item_text">
130
+ <span className="pb_nav_list_item_text_collapsible">
94
131
  {text}
95
132
  </span>
96
133
  </Tag>
@@ -0,0 +1,5 @@
1
+ @mixin collapsible_trail_class {
2
+ .pb_collapsible_content_kit {
3
+ border-color: $border_light;
4
+ }
5
+ }
@@ -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
  }