playbook_ui 13.15.0 → 13.16.0.pre.alpha.PBNTR177NewAdvancedTableKit2010

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) 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 +120 -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/SubComponents/TableBody.tsx +95 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/SubComponents/TableHeader.tsx +51 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/Utilities/helper_functions.tsx +77 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/Utilities/types.ts +8 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +97 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +237 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +56 -0
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.jsx +52 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data.js +278 -0
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +5 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
  23. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/_loading.scss +60 -0
  24. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/_pseudo_states.scss +12 -0
  25. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_colors_swift.md +27 -0
  26. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default_swift.md +22 -0
  27. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_props_table.md +8 -0
  28. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_sizes_swift.md +26 -0
  29. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +6 -0
  30. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +4 -2
  31. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +5 -3
  32. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +40 -33
  33. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +4 -4
  34. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +44 -30
  35. data/app/pb_kits/playbook/pb_flex/_flex.tsx +5 -5
  36. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +3 -2
  37. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -4
  38. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +10 -10
  39. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +10 -9
  40. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +3 -2
  41. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +3 -2
  42. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +1 -1
  43. data/app/pb_kits/playbook/pb_layout/_layout.tsx +2 -1
  44. data/app/pb_kits/playbook/pb_layout/layout.test.js +8 -4
  45. data/app/pb_kits/playbook/pb_legend/_legend.tsx +6 -6
  46. data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +4 -4
  47. data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnail.tsx +1 -1
  48. data/app/pb_kits/playbook/pb_lightbox/Carousel/index.tsx +3 -3
  49. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +30 -22
  50. data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +5 -5
  51. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +4 -4
  52. data/app/pb_kits/playbook/pb_list/_list.tsx +15 -15
  53. data/app/pb_kits/playbook/pb_list/_list_item.tsx +1 -1
  54. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +9 -9
  55. data/app/pb_kits/playbook/pb_map/_map.tsx +8 -8
  56. data/app/pb_kits/playbook/pb_map/_map_controls.tsx +15 -7
  57. data/app/pb_kits/playbook/pb_map/_map_custom_button.tsx +4 -2
  58. data/app/pb_kits/playbook/pb_message/_message.tsx +1 -1
  59. data/app/pb_kits/playbook/pb_message/_message_mention.tsx +6 -6
  60. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +46 -42
  61. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +20 -20
  62. data/app/pb_kits/playbook/pb_nav/_item.tsx +56 -47
  63. data/app/pb_kits/playbook/pb_nav/_nav.tsx +15 -15
  64. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_bold_swift.md +17 -0
  65. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_default_swift.md +17 -0
  66. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_subtle_no_highlight_swift.md +18 -0
  67. data/app/pb_kits/playbook/pb_nav/docs/_nav_horizontal_subtle_swift.md +18 -0
  68. data/app/pb_kits/playbook/pb_nav/docs/_nav_props_swift.md +11 -0
  69. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_bold_swift.md +18 -0
  70. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_default_swift.md +18 -0
  71. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_subtle_no_highlight_swift.md +19 -0
  72. data/app/pb_kits/playbook/pb_nav/docs/_nav_vertical_subtle_swift.md +17 -0
  73. data/app/pb_kits/playbook/pb_nav/docs/example.yml +17 -0
  74. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +51 -50
  75. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +20 -19
  76. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +4 -3
  77. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -4
  78. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +20 -20
  79. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +4 -4
  80. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorButton.tsx +19 -17
  81. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorTypes.ts +1 -1
  82. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +23 -21
  83. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +18 -10
  84. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +46 -23
  85. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarHistory.tsx +8 -8
  86. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarNodes.tsx +7 -7
  87. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +17 -15
  88. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +9 -7
  89. data/app/pb_kits/playbook/pb_select/_select.scss +13 -4
  90. data/app/pb_kits/playbook/pb_select/_select.tsx +7 -4
  91. data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.html.erb +24 -0
  92. data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.jsx +38 -0
  93. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  94. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  95. data/app/pb_kits/playbook/pb_select/select.rb +6 -1
  96. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +25 -24
  97. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +27 -26
  98. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +2 -1
  99. data/app/pb_kits/playbook/pb_source/_source.tsx +15 -15
  100. data/app/pb_kits/playbook/pb_table/_table.tsx +29 -29
  101. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +1 -1
  102. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -2
  103. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  104. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
  105. data/dist/menu.yml +4 -1
  106. data/dist/playbook-rails.js +14 -6
  107. data/lib/playbook/version.rb +2 -2
  108. metadata +43 -7
@@ -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: "2011",
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: "2011",
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: "2011",
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: "2011",
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: "2011",
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: "20",
100
+ scheduledMeetings: "10",
101
+ attendanceRate: "51%",
102
+ completedClasses: "3",
103
+ classCompletionRate: "33%",
104
+ graduatedStudents: "19",
105
+ children: [
106
+ {
107
+ year: "2011",
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: "2011",
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: "2011",
132
+ quarter: "Q1",
133
+ month: "January",
134
+ day: "10",
135
+ newEnrollments: "34",
136
+ scheduledMeetings: "28",
137
+ attendanceRate: "97%",
138
+ completedClasses: "20",
139
+ classCompletionRate: "15%",
140
+ graduatedStudents: "17",
141
+ },
142
+ {
143
+ year: "2011",
144
+ quarter: "Q1",
145
+ month: "January",
146
+ day: "20",
147
+ newEnrollments: "43",
148
+ scheduledMeetings: "23",
149
+ attendanceRate: "66%",
150
+ completedClasses: "26",
151
+ classCompletionRate: "47%",
152
+ graduatedStudents: "9",
153
+ },
154
+ ],
155
+ },
156
+ {
157
+ year: "2011",
158
+ quarter: "Q1",
159
+ month: "February",
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: "February",
172
+ day: "15",
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: "20",
192
+ scheduledMeetings: "10",
193
+ attendanceRate: "51%",
194
+ completedClasses: "3",
195
+ classCompletionRate: "33%",
196
+ graduatedStudents: "19",
197
+ children: [
198
+ {
199
+ year: "2011",
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: "2011",
212
+ quarter: "Q1",
213
+ month: "January",
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: "2011",
224
+ quarter: "Q1",
225
+ month: "January",
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: "2011",
236
+ quarter: "Q1",
237
+ month: "January",
238
+ day: "20",
239
+ newEnrollments: "43",
240
+ scheduledMeetings: "23",
241
+ attendanceRate: "66%",
242
+ completedClasses: "26",
243
+ classCompletionRate: "47%",
244
+ graduatedStudents: "9",
245
+ },
246
+ ],
247
+ },
248
+ {
249
+ year: "2011",
250
+ quarter: "Q1",
251
+ month: "February",
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: "2011",
262
+ quarter: "Q1",
263
+ month: "February",
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,60 @@
1
+ .content-loading {
2
+ pointer-events: none;
3
+ p,
4
+ .pb_body_kit_light,
5
+ .loading-toggle-icon,
6
+ .pb_caption_kit_md,
7
+ h4,
8
+ .loading-cell {
9
+ position: relative;
10
+ color: rgba($white, 0) !important;
11
+ background: rgba($white, 0) !important;
12
+ border: 0 !important;
13
+ &::after {
14
+ content: "";
15
+ position: absolute;
16
+ top: $space-xxs;
17
+ left: 0;
18
+ width: 100%;
19
+ height: calc(100% - #{$space-xxs * 2});
20
+ display: block;
21
+ border-radius: $border-rad-light;
22
+ animation-duration: 1.5s;
23
+ animation-fill-mode: forwards;
24
+ animation-iteration-count: infinite;
25
+ animation-name: wave;
26
+ animation-timing-function: linear;
27
+ background: $silver;
28
+ background-color: $silver;
29
+ background-image: linear-gradient(
30
+ to left,
31
+ $silver 0%,
32
+ lighten($silver, 1%) 50%,
33
+ lighten($silver, 1%) 60%,
34
+ $silver 80%,
35
+ $silver 100%
36
+ );
37
+ background-repeat: no-repeat;
38
+ background-size: 800px 104px;
39
+ }
40
+ }
41
+
42
+ .loading-cell {
43
+ height: $space_sm + 4;
44
+ }
45
+
46
+ .loading-toggle-icon {
47
+ width: $space_sm - 1;
48
+ height: $space_sm - 1;
49
+ margin-bottom: $space_xxs + 2;
50
+ &::after {
51
+ height: $space_sm - 1;
52
+ border-radius: $border_radius_rounded;
53
+ }
54
+ }
55
+
56
+ svg,
57
+ img {
58
+ visibility: hidden;
59
+ }
60
+ }
@@ -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) => {