playbook_ui 13.15.0 → 13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2023

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +14 -12
  3. data/app/pb_kits/playbook/index.js +2 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/CollapsibleTrail.tsx +30 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +59 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/Components/LoadingCell.tsx +5 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +30 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/Components/SubRowHeaderRow.tsx +61 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +128 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/Components/ToggleIconButton.tsx +28 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +5 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/README.md +133 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +95 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +51 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/Utilities/BrowserCheck.tsx +5 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +63 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/Utilities/IconHelpers.tsx +8 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/Utilities/types.ts +8 -0
  19. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +98 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +245 -0
  21. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +56 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.jsx +49 -0
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +13 -0
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_description.md +1 -0
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data.js +278 -0
  26. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +5 -0
  27. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
  28. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/_loading.scss +71 -0
  29. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/_pseudo_states.scss +12 -0
  30. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_colors_swift.md +27 -0
  31. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default_swift.md +22 -0
  32. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_props_table.md +8 -0
  33. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_sizes_swift.md +26 -0
  34. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +6 -0
  35. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +4 -2
  36. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +5 -3
  37. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +40 -33
  38. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +4 -4
  39. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +44 -30
  40. data/app/pb_kits/playbook/pb_flex/_flex.tsx +5 -5
  41. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +3 -2
  42. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -4
  43. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +10 -10
  44. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +10 -9
  45. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +3 -2
  46. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +3 -2
  47. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +1 -1
  48. data/app/pb_kits/playbook/pb_layout/_layout.tsx +2 -1
  49. data/app/pb_kits/playbook/pb_layout/layout.test.js +8 -4
  50. data/app/pb_kits/playbook/pb_legend/_legend.tsx +6 -6
  51. data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +4 -4
  52. data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnail.tsx +1 -1
  53. data/app/pb_kits/playbook/pb_lightbox/Carousel/index.tsx +3 -3
  54. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +30 -22
  55. data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +5 -5
  56. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +4 -4
  57. data/app/pb_kits/playbook/pb_list/_list.tsx +15 -15
  58. data/app/pb_kits/playbook/pb_list/_list_item.tsx +1 -1
  59. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +9 -9
  60. data/app/pb_kits/playbook/pb_map/_map.tsx +8 -8
  61. data/app/pb_kits/playbook/pb_map/_map_controls.tsx +15 -7
  62. data/app/pb_kits/playbook/pb_map/_map_custom_button.tsx +4 -2
  63. data/app/pb_kits/playbook/pb_message/_message.tsx +1 -1
  64. data/app/pb_kits/playbook/pb_message/_message_mention.tsx +6 -6
  65. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +46 -42
  66. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +20 -20
  67. data/app/pb_kits/playbook/pb_nav/_item.tsx +56 -47
  68. data/app/pb_kits/playbook/pb_nav/_nav.tsx +15 -15
  69. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_bold_swift.md +17 -0
  70. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_default_swift.md +17 -0
  71. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_subtle_no_highlight_swift.md +18 -0
  72. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_subtle_swift.md +18 -0
  73. data/app/pb_kits/playbook/pb_nav/docs/_nav_props_swift.md +11 -0
  74. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_bold_swift.md +18 -0
  75. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_default_swift.md +18 -0
  76. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_subtle_no_highlight_swift.md +19 -0
  77. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_subtle_swift.md +17 -0
  78. data/app/pb_kits/playbook/pb_nav/docs/example.yml +17 -0
  79. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +51 -50
  80. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +20 -19
  81. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +4 -3
  82. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -4
  83. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +20 -20
  84. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +4 -4
  85. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorButton.tsx +19 -17
  86. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorTypes.ts +1 -1
  87. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +23 -21
  88. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +18 -10
  89. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +46 -23
  90. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarHistory.tsx +8 -8
  91. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarNodes.tsx +7 -7
  92. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +17 -15
  93. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +9 -7
  94. data/app/pb_kits/playbook/pb_select/_select.scss +13 -4
  95. data/app/pb_kits/playbook/pb_select/_select.tsx +7 -4
  96. data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.html.erb +24 -0
  97. data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.jsx +38 -0
  98. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  99. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  100. data/app/pb_kits/playbook/pb_select/select.rb +6 -1
  101. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +25 -24
  102. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +27 -26
  103. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +2 -1
  104. data/app/pb_kits/playbook/pb_source/_source.tsx +15 -15
  105. data/app/pb_kits/playbook/pb_table/_table.tsx +29 -29
  106. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +1 -1
  107. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -2
  108. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  109. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
  110. data/dist/menu.yml +4 -1
  111. data/dist/playbook-rails.js +14 -6
  112. data/lib/playbook/version.rb +2 -2
  113. metadata +48 -7
@@ -0,0 +1 @@
1
+ The AdvancedTable kit uses the [Tanstack Table v8](https://tanstack.com/table/v8/docs/introduction) under the hood to render advanced tables that allow for complex, nested data structures with expansion and sort options.
@@ -0,0 +1,278 @@
1
+ export const MOCK_DATA = [
2
+ {
3
+ year: "2021",
4
+ quarter: null,
5
+ month: null,
6
+ day: null,
7
+ newEnrollments: "20",
8
+ scheduledMeetings: "10",
9
+ attendanceRate: "51%",
10
+ completedClasses: "3",
11
+ classCompletionRate: "33%",
12
+ graduatedStudents: "19",
13
+ children: [
14
+ {
15
+ year: "2021",
16
+ quarter: "Q1",
17
+ month: null,
18
+ day: null,
19
+ newEnrollments: "2",
20
+ scheduledMeetings: "35",
21
+ attendanceRate: "32%",
22
+ completedClasses: "15",
23
+ classCompletionRate: "52%",
24
+ graduatedStudents: "36",
25
+ children: [
26
+ {
27
+ year: "2021",
28
+ quarter: "Q1",
29
+ month: "January",
30
+ day: null,
31
+ newEnrollments: "16",
32
+ scheduledMeetings: "20",
33
+ attendanceRate: "11%",
34
+ completedClasses: "13",
35
+ classCompletionRate: "47%",
36
+ graduatedStudents: "28",
37
+ children: [
38
+ {
39
+ year: "2021",
40
+ quarter: "Q1",
41
+ month: "January",
42
+ day: "10",
43
+ newEnrollments: "34",
44
+ scheduledMeetings: "28",
45
+ attendanceRate: "97%",
46
+ completedClasses: "20",
47
+ classCompletionRate: "15%",
48
+ graduatedStudents: "17",
49
+ },
50
+ {
51
+ year: "2021",
52
+ quarter: "Q1",
53
+ month: "January",
54
+ day: "20",
55
+ newEnrollments: "43",
56
+ scheduledMeetings: "23",
57
+ attendanceRate: "66%",
58
+ completedClasses: "26",
59
+ classCompletionRate: "47%",
60
+ graduatedStudents: "9",
61
+ },
62
+ ],
63
+ },
64
+ {
65
+ year: "2021",
66
+ quarter: "Q1",
67
+ month: "February",
68
+ day: null,
69
+ newEnrollments: "20",
70
+ scheduledMeetings: "41",
71
+ attendanceRate: "95%",
72
+ completedClasses: "26",
73
+ classCompletionRate: "83%",
74
+ graduatedStudents: "43",
75
+ children: [
76
+ {
77
+ year: "2011",
78
+ quarter: "Q1",
79
+ month: "February",
80
+ day: "15",
81
+ newEnrollments: "19",
82
+ scheduledMeetings: "35",
83
+ attendanceRate: "69%",
84
+ completedClasses: "8",
85
+ classCompletionRate: "75%",
86
+ graduatedStudents: "23",
87
+ },
88
+ ],
89
+ },
90
+ ],
91
+ },
92
+ ],
93
+ },
94
+ {
95
+ year: "2022",
96
+ quarter: null,
97
+ month: null,
98
+ day: null,
99
+ newEnrollments: "25",
100
+ scheduledMeetings: "17",
101
+ attendanceRate: "75%",
102
+ completedClasses: "5",
103
+ classCompletionRate: "45%",
104
+ graduatedStudents: "32",
105
+ children: [
106
+ {
107
+ year: "2022",
108
+ quarter: "Q1",
109
+ month: null,
110
+ day: null,
111
+ newEnrollments: "2",
112
+ scheduledMeetings: "35",
113
+ attendanceRate: "32%",
114
+ completedClasses: "15",
115
+ classCompletionRate: "52%",
116
+ graduatedStudents: "36",
117
+ children: [
118
+ {
119
+ year: "2022",
120
+ quarter: "Q1",
121
+ month: "January",
122
+ day: null,
123
+ newEnrollments: "16",
124
+ scheduledMeetings: "20",
125
+ attendanceRate: "11%",
126
+ completedClasses: "13",
127
+ classCompletionRate: "47%",
128
+ graduatedStudents: "28",
129
+ children: [
130
+ {
131
+ year: "2022",
132
+ quarter: "Q1",
133
+ month: "January",
134
+ day: "15",
135
+ newEnrollments: "34",
136
+ scheduledMeetings: "28",
137
+ attendanceRate: "97%",
138
+ completedClasses: "20",
139
+ classCompletionRate: "15%",
140
+ graduatedStudents: "17",
141
+ },
142
+ {
143
+ year: "2022",
144
+ quarter: "Q1",
145
+ month: "January",
146
+ day: "25",
147
+ newEnrollments: "43",
148
+ scheduledMeetings: "23",
149
+ attendanceRate: "66%",
150
+ completedClasses: "26",
151
+ classCompletionRate: "47%",
152
+ graduatedStudents: "9",
153
+ },
154
+ ],
155
+ },
156
+ {
157
+ year: "2022",
158
+ quarter: "Q1",
159
+ month: "May",
160
+ day: null,
161
+ newEnrollments: "20",
162
+ scheduledMeetings: "41",
163
+ attendanceRate: "95%",
164
+ completedClasses: "26",
165
+ classCompletionRate: "83%",
166
+ graduatedStudents: "43",
167
+ children: [
168
+ {
169
+ year: "2011",
170
+ quarter: "Q1",
171
+ month: "May",
172
+ day: "2",
173
+ newEnrollments: "19",
174
+ scheduledMeetings: "35",
175
+ attendanceRate: "69%",
176
+ completedClasses: "8",
177
+ classCompletionRate: "75%",
178
+ graduatedStudents: "23",
179
+ },
180
+ ],
181
+ },
182
+ ],
183
+ },
184
+ ],
185
+ },
186
+ {
187
+ year: "2023",
188
+ quarter: null,
189
+ month: null,
190
+ day: null,
191
+ newEnrollments: "10",
192
+ scheduledMeetings: "15",
193
+ attendanceRate: "65%",
194
+ completedClasses: "4",
195
+ classCompletionRate: "49%",
196
+ graduatedStudents: "29",
197
+ children: [
198
+ {
199
+ year: "2023",
200
+ quarter: "Q1",
201
+ month: null,
202
+ day: null,
203
+ newEnrollments: "2",
204
+ scheduledMeetings: "35",
205
+ attendanceRate: "32%",
206
+ completedClasses: "15",
207
+ classCompletionRate: "52%",
208
+ graduatedStudents: "36",
209
+ children: [
210
+ {
211
+ year: "2023",
212
+ quarter: "Q1",
213
+ month: "March",
214
+ day: null,
215
+ newEnrollments: "16",
216
+ scheduledMeetings: "20",
217
+ attendanceRate: "11%",
218
+ completedClasses: "13",
219
+ classCompletionRate: "47%",
220
+ graduatedStudents: "28",
221
+ children: [
222
+ {
223
+ year: "2023",
224
+ quarter: "Q1",
225
+ month: "March",
226
+ day: "10",
227
+ newEnrollments: "34",
228
+ scheduledMeetings: "28",
229
+ attendanceRate: "97%",
230
+ completedClasses: "20",
231
+ classCompletionRate: "15%",
232
+ graduatedStudents: "17",
233
+ },
234
+ {
235
+ year: "2023",
236
+ quarter: "Q1",
237
+ month: "March",
238
+ day: "11",
239
+ newEnrollments: "43",
240
+ scheduledMeetings: "23",
241
+ attendanceRate: "66%",
242
+ completedClasses: "26",
243
+ classCompletionRate: "47%",
244
+ graduatedStudents: "9",
245
+ },
246
+ ],
247
+ },
248
+ {
249
+ year: "2023",
250
+ quarter: "Q1",
251
+ month: "April",
252
+ day: null,
253
+ newEnrollments: "20",
254
+ scheduledMeetings: "41",
255
+ attendanceRate: "95%",
256
+ completedClasses: "26",
257
+ classCompletionRate: "83%",
258
+ graduatedStudents: "43",
259
+ children: [
260
+ {
261
+ year: "2023",
262
+ quarter: "Q1",
263
+ month: "April",
264
+ day: "15",
265
+ newEnrollments: "19",
266
+ scheduledMeetings: "35",
267
+ attendanceRate: "69%",
268
+ completedClasses: "8",
269
+ classCompletionRate: "75%",
270
+ graduatedStudents: "23",
271
+ },
272
+ ],
273
+ },
274
+ ],
275
+ },
276
+ ],
277
+ },
278
+ ];
@@ -0,0 +1,5 @@
1
+ examples:
2
+ react:
3
+ - advanced_table_default: Default
4
+
5
+
@@ -0,0 +1 @@
1
+ export { default as AdvancedTableDefault } from './_advanced_table_default.jsx'
@@ -0,0 +1,71 @@
1
+
2
+ //animation scss
3
+ @keyframes wave {
4
+ 0% {
5
+ background-position: -468px 0;
6
+ }
7
+ 100% {
8
+ background-position: 468px 0;
9
+ }
10
+ }
11
+
12
+ .content-loading {
13
+ pointer-events: none;
14
+ p,
15
+ .pb_body_kit_light,
16
+ .loading-toggle-icon,
17
+ .pb_caption_kit_md,
18
+ h4,
19
+ .loading-cell {
20
+ position: relative;
21
+ color: rgba($white, 0) !important;
22
+ background: rgba($white, 0) !important;
23
+ border: 0 !important;
24
+ &::after {
25
+ content: "";
26
+ position: absolute;
27
+ top: $space-xxs;
28
+ left: 0;
29
+ width: 100%;
30
+ height: calc(100% - #{$space-xxs * 2});
31
+ display: block;
32
+ border-radius: $border-rad-light;
33
+ animation-duration: 1.5s;
34
+ animation-fill-mode: forwards;
35
+ animation-iteration-count: infinite;
36
+ animation-name: wave;
37
+ animation-timing-function: linear;
38
+ background: $silver;
39
+ background-color: $silver;
40
+ background-image: linear-gradient(
41
+ to left,
42
+ $silver 0%,
43
+ lighten($silver, 1%) 50%,
44
+ lighten($silver, 1%) 60%,
45
+ $silver 80%,
46
+ $silver 100%
47
+ );
48
+ background-repeat: no-repeat;
49
+ background-size: 800px 104px;
50
+ }
51
+ }
52
+
53
+ .loading-cell {
54
+ height: $space_sm + 4;
55
+ }
56
+
57
+ .loading-toggle-icon {
58
+ width: $space_sm - 1;
59
+ height: $space_sm - 1;
60
+ margin-bottom: $space_xxs + 2;
61
+ &::after {
62
+ height: $space_sm - 1;
63
+ border-radius: $border_radius_rounded;
64
+ }
65
+ }
66
+
67
+ svg,
68
+ img {
69
+ visibility: hidden;
70
+ }
71
+ }
@@ -0,0 +1,12 @@
1
+ %primary-color-pseudo {
2
+ &:hover,
3
+ &:active {
4
+ color: $primary;
5
+ }
6
+
7
+ &:focus-visible {
8
+ border-color: transparent;
9
+ box-shadow: 0px 0px 0 2px $primary_action;
10
+ outline: none;
11
+ }
12
+ }
@@ -0,0 +1,27 @@
1
+ ![collapsible-colors](https://github.com/powerhome/playbook/assets/54749071/daafd129-fd0a-4992-8fee-bfa55aed8a23)
2
+
3
+ ```swift
4
+ let iconSize: PBIcon.IconSize
5
+ let iconColor: CollapsibleIconColor
6
+ let text: String
7
+ @State private var isCollapsed = true
8
+ let lorem =
9
+ "
10
+ Group members... Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit vive.
11
+ Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo.
12
+ Praesent lorem arcu. Vivamus suscipit, libero eu fringilla egestas, orci urna commodo arcu, vel gravida turpis.
13
+ "
14
+ PBCollapsible(isCollapsed: $isCollapsed, iconSize: iconSize, iconColor: iconColor) {
15
+ VStack(spacing: Spacing.medium) {
16
+ CollapsibleDoc(iconColor: .default, text: "Default Section")
17
+ CollapsibleDoc(iconColor: .light, text: "Light Section")
18
+ CollapsibleDoc(iconColor: .lighter, text: "Lighter Section")
19
+ CollapsibleDoc(iconColor: .link, text: "Link Section")
20
+ CollapsibleDoc(iconColor: .error, text: "Error Section")
21
+ CollapsibleDoc(iconColor: .success, text: "Success Section")
22
+ }
23
+ } content: {
24
+ Text(lorem).pbFont(.body)
25
+ }
26
+
27
+ ```
@@ -0,0 +1,22 @@
1
+ ![collapsible-default](https://github.com/powerhome/playbook/assets/54749071/3e97095b-f6bb-45b7-bd33-99ebde0d40fd)
2
+
3
+
4
+ ```swift
5
+ let iconSize: PBIcon.IconSize
6
+ let iconColor: CollapsibleIconColor
7
+ let text: String
8
+ @State private var isCollapsed = true
9
+ let lorem =
10
+ "
11
+ Group members... Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit vive.
12
+ Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo.
13
+ Praesent lorem arcu. Vivamus suscipit, libero eu fringilla egestas, orci urna commodo arcu, vel gravida turpis.
14
+ "
15
+
16
+ PBCollapsible(isCollapsed: $isCollapsed, iconSize: iconSize, iconColor: iconColor) {
17
+ CollapsibleDoc(text: "Main Section")
18
+ } content: {
19
+ Text(lorem).pbFont(.body)
20
+ }
21
+
22
+ ```
@@ -0,0 +1,8 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **isCollapsed** | `Bool` | Value for whether or not the dropdown is closed or open | `false` | `true` `false` |
5
+ | **headerView** | `View` | Title of dropdown | | |
6
+ | **contentView** | `View` | Content of dropdown | | |
7
+ | **iconSize** | `PBIcon.IconSize` | Sets size of chevron icon | `.small` | `xSmall` `small` `large` `x1` `x2` `x3` `x4` `x5` `x6` `x7` `x8` `x9` `x10` |
8
+ | **iconColor** | `CollapsibleIconColor` | Sets color of chevron icon | `.default` | `default` `light` `lighter` `link` `error` `success` |
@@ -0,0 +1,26 @@
1
+ ![collapsible-sizes](https://github.com/powerhome/playbook/assets/54749071/557bfe16-26e4-4966-9f1c-689a2dc44412)
2
+
3
+ ```swift
4
+ let iconSize: PBIcon.IconSize
5
+ let iconColor: CollapsibleIconColor
6
+ let text: String
7
+ @State private var isCollapsed = true
8
+ let lorem =
9
+ "
10
+ Group members... Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit vive.
11
+ Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo.
12
+ Praesent lorem arcu. Vivamus suscipit, libero eu fringilla egestas, orci urna commodo arcu, vel gravida turpis.
13
+ "
14
+
15
+ PBCollapsible(isCollapsed: $isCollapsed, iconSize: iconSize, iconColor: iconColor) {
16
+ VStack(spacing: Spacing.medium) {
17
+ CollapsibleDoc(iconSize: .xSmall, text: "Extra Small Section")
18
+ CollapsibleDoc(iconSize: .small, text: "Small Section")
19
+ CollapsibleDoc(text: "Default Section")
20
+ CollapsibleDoc(iconSize: .large, text: "Large Section")
21
+ }
22
+ } content: {
23
+ Text(lorem).pbFont(.body)
24
+ }
25
+
26
+ ```
@@ -14,3 +14,9 @@ examples:
14
14
  - collapsible_color: Icon Color
15
15
  - collapsible_icons: Custom Icons
16
16
  - collapsible_state: useCollapsible Hook
17
+
18
+ swift:
19
+ - collapsible_default_swift: Default
20
+ - collapsible_sizes_swift: Sizes
21
+ - collapsible_colors_swift: Colors
22
+ - collapsible_props_table: ""
@@ -122,9 +122,11 @@ const highchartsDarkTheme: ThemeProps = {
122
122
  // specific to gauge
123
123
  // unfilled gauge color
124
124
  pane: {
125
- background: [{
125
+ background: {
126
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
127
+ // @ts-ignore
126
128
  borderColor: colors.border_dark,
127
- }],
129
+ },
128
130
  },
129
131
 
130
132
  plotOptions: {
@@ -122,9 +122,11 @@ const highchartsTheme: ThemeProps = {
122
122
  // specific to gauge
123
123
  // unfilled gauge color
124
124
  pane: {
125
- background: [{
126
- borderColor: colors.border_light,
127
- }],
125
+ background: {
126
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
127
+ // @ts-ignore
128
+ borderColor: colors.border_light,
129
+ },
128
130
  },
129
131
 
130
132
  plotOptions: {
@@ -32,6 +32,10 @@ type DatePickerConfig = {
32
32
  } & Pick<BaseOptions, "allowInput" | "defaultDate" | "enableTime" | "maxDate" | "minDate" | "mode" | "plugins" | "position" | "positionElement" >
33
33
 
34
34
  const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HTMLElement) => {
35
+ const noop = () => {
36
+ // intentionally left empty as a no-op placeholder
37
+ }
38
+
35
39
  const {
36
40
  allowInput,
37
41
  closeOnSelect = true,
@@ -45,8 +49,8 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
45
49
  maxDate,
46
50
  minDate,
47
51
  mode,
48
- onChange = () => {},
49
- onClose = () => {},
52
+ onChange = noop,
53
+ onClose = noop,
50
54
  pickerId,
51
55
  plugins,
52
56
  position = "auto",
@@ -72,20 +76,11 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
72
76
  return defaultDate
73
77
  }
74
78
  }
75
- const disabledParser = () => {
76
- const disabledArray=[]
77
-
78
- disableDate && disableDate.length > 0 && disabledArray.push(...disableDate)
79
- disableRange && disableRange.length > 0 && disabledArray.push(...disableRange)
80
- disableWeekdays && disableWeekdays.length > 0 && disabledArray.push(...disabledWeekDays())
81
-
82
- return disabledArray
83
- }
84
79
 
85
80
  const disabledWeekDays = () => {
86
81
  return (
87
82
  [
88
- (date:any) => {
83
+ (date: any) => {
89
84
  const weekdayObj: {
90
85
  [day: string]: number
91
86
  } = {
@@ -110,6 +105,16 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
110
105
  ]
111
106
  )
112
107
  }
108
+
109
+ const disabledParser = () => {
110
+ const disabledArray=[]
111
+
112
+ disableDate && disableDate.length > 0 && disabledArray.push(...disableDate)
113
+ disableRange && disableRange.length > 0 && disabledArray.push(...disableRange)
114
+ disableWeekdays && disableWeekdays.length > 0 && disabledArray.push(...disabledWeekDays())
115
+
116
+ return disabledArray
117
+ }
113
118
  const calendarResizer = () => {
114
119
  const cal = document.querySelector(`#cal-${pickerId}.open`) as HTMLElement
115
120
  const parentInput = cal.parentElement
@@ -125,28 +130,46 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
125
130
 
126
131
  const setPlugins = (thisRangesEndToday: boolean, customQuickPickDates: any) => {
127
132
  const pluginList = []
128
-
133
+
129
134
  // month and week selection
130
135
  if (selectionType === "month" || plugins.length > 0) {
131
136
  pluginList.push(monthSelectPlugin({ shorthand: true, dateFormat: 'F Y', altFormat: 'F Y' }))
132
137
  } else if ( selectionType === "week") {
133
138
  pluginList.push(weekSelect())
134
-
139
+
135
140
  } else if (selectionType === "quickpick") {
136
141
  //------- QUICKPICK VARIANT PLUGIN -------------//
137
142
  pluginList.push(quickPickPlugin(thisRangesEndToday, customQuickPickDates))
138
143
  }
139
-
144
+
140
145
  // time selection
141
146
  if (enableTime) pluginList.push(timeSelectPlugin({ caption: timeCaption, showTimezone: showTimezone}))
142
-
147
+
143
148
  return pluginList
144
149
  }
145
-
150
+
146
151
  const getDateFormat = () => {
147
152
  return enableTime ? `${format} ${timeFormat}` : format
148
153
  }
149
154
 
155
+ // Attach / detach to / from scroll events
156
+ const initialPicker = document.querySelector<HTMLElement & { [x: string]: any }>(`#${pickerId}`)._flatpickr
157
+ const scrollEvent = () => {
158
+ initialPicker._positionCalendar()
159
+ }
160
+ function attachToScroll(scrollParent: string | HTMLElement) {
161
+ document.querySelectorAll(scrollParent as string)[0]?.addEventListener("scroll", scrollEvent, { passive: true })
162
+ }
163
+ function detachFromScroll(scrollParent: string | HTMLElement = document.body) {
164
+ document.querySelectorAll(scrollParent as string)[0]?.removeEventListener("scroll", scrollEvent)
165
+ }
166
+
167
+ // two way binding
168
+ const initialDropdown = document.querySelector<HTMLElement & { [x: string]: any }>(`#year-${pickerId}`)
169
+ const yearChangeHook = () => {
170
+ initialDropdown.value = initialPicker.currentYear
171
+ }
172
+
150
173
  // ===========================================================
151
174
  // | Flatpickr initializer w/ config |
152
175
  // ===========================================================
@@ -193,17 +216,6 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
193
216
  const picker = document.querySelector<HTMLElement & { [x: string]: any }>(`#${pickerId}`)._flatpickr
194
217
  picker.innerContainer.parentElement.id = `cal-${pickerId}`
195
218
 
196
- // Attach / detach to / from scroll events
197
- const scrollEvent = () => {
198
- picker._positionCalendar()
199
- }
200
- function attachToScroll(scrollParent: string | HTMLElement) {
201
- document.querySelectorAll(scrollParent as string)[0]?.addEventListener("scroll", scrollEvent, { passive: true })
202
- }
203
- function detachFromScroll(scrollParent: string | HTMLElement = document.body) {
204
- document.querySelectorAll(scrollParent as string)[0]?.removeEventListener("scroll", scrollEvent)
205
- }
206
-
207
219
  // replace year selector with dropdown
208
220
  picker.yearElements[0].parentElement.innerHTML = `<select class="numInput cur-year" type="number" tabIndex="-1" aria-label="Year" id="year-${pickerId}"></select>`
209
221
 
@@ -242,11 +254,6 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
242
254
  })
243
255
  }
244
256
 
245
- // two way binding
246
- const yearChangeHook = () => {
247
- dropdown.value = picker.currentYear
248
- }
249
-
250
257
  // Adding dropdown icons to year and month selects
251
258
  dropdown.insertAdjacentHTML('afterend', '<i class="far fa-angle-down year-dropdown-icon" id="test-id"></i>')
252
259
  if (picker.monthElements[0].parentElement) {
@@ -53,8 +53,8 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
53
53
 
54
54
  const calculateDateRange = (timePeriod: string, amount: number): Date[] => {
55
55
  const endDate = new Date();
56
- let startDate = new Date();
57
-
56
+ const startDate = new Date();
57
+
58
58
  switch (timePeriod) {
59
59
  case 'days':
60
60
  startDate.setDate(endDate.getDate() - amount);
@@ -76,7 +76,7 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
76
76
  }
77
77
  return [startDate, endDate];
78
78
  };
79
-
79
+
80
80
 
81
81
  type rangesType = {
82
82
  [key: string]: Date[]
@@ -95,7 +95,7 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
95
95
  'Last year': [lastYearStartDate, lastYearEndDate]
96
96
  };
97
97
 
98
-
98
+
99
99
  if (customQuickPickDates && Object.keys(customQuickPickDates).length !== 0) {
100
100
  if (customQuickPickDates.dates.length && customQuickPickDates.override === false) {
101
101
  customQuickPickDates.dates.forEach((item) => {