playbook_ui 13.15.0.pre.alpha.1132globalpropdatepickerspacing1929 → 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 (99) 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_date_picker/_date_picker.scss +3 -2
  26. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +1 -43
  27. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -2
  28. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +1 -15
  29. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +40 -33
  30. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +4 -4
  31. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +2 -1
  32. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +44 -30
  33. data/app/pb_kits/playbook/pb_flex/_flex.tsx +5 -5
  34. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +3 -2
  35. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -4
  36. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +10 -10
  37. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +10 -9
  38. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +3 -2
  39. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +3 -2
  40. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +1 -1
  41. data/app/pb_kits/playbook/pb_layout/_layout.tsx +2 -1
  42. data/app/pb_kits/playbook/pb_layout/layout.test.js +8 -4
  43. data/app/pb_kits/playbook/pb_legend/_legend.tsx +6 -6
  44. data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +4 -4
  45. data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnail.tsx +1 -1
  46. data/app/pb_kits/playbook/pb_lightbox/Carousel/index.tsx +3 -3
  47. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +30 -22
  48. data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +5 -5
  49. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +4 -4
  50. data/app/pb_kits/playbook/pb_list/_list.tsx +15 -15
  51. data/app/pb_kits/playbook/pb_list/_list_item.tsx +1 -1
  52. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +9 -9
  53. data/app/pb_kits/playbook/pb_map/_map.tsx +8 -8
  54. data/app/pb_kits/playbook/pb_map/_map_controls.tsx +15 -7
  55. data/app/pb_kits/playbook/pb_map/_map_custom_button.tsx +4 -2
  56. data/app/pb_kits/playbook/pb_message/_message.tsx +1 -1
  57. data/app/pb_kits/playbook/pb_message/_message_mention.tsx +6 -6
  58. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +46 -42
  59. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +20 -20
  60. data/app/pb_kits/playbook/pb_nav/_item.tsx +56 -47
  61. data/app/pb_kits/playbook/pb_nav/_nav.tsx +15 -15
  62. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +51 -50
  63. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +20 -19
  64. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +4 -3
  65. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -4
  66. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +20 -20
  67. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +4 -4
  68. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorButton.tsx +19 -17
  69. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorTypes.ts +1 -1
  70. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +23 -21
  71. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +18 -10
  72. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +46 -23
  73. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarHistory.tsx +8 -8
  74. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarNodes.tsx +7 -7
  75. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +17 -15
  76. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +9 -7
  77. data/app/pb_kits/playbook/pb_select/_select.scss +13 -4
  78. data/app/pb_kits/playbook/pb_select/_select.tsx +7 -4
  79. data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.html.erb +24 -0
  80. data/app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.jsx +38 -0
  81. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  82. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  83. data/app/pb_kits/playbook/pb_select/select.rb +6 -1
  84. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +25 -24
  85. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +27 -26
  86. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +2 -1
  87. data/app/pb_kits/playbook/pb_source/_source.tsx +15 -15
  88. data/app/pb_kits/playbook/pb_table/_table.tsx +29 -29
  89. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -0
  90. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -4
  91. data/app/pb_kits/playbook/pb_text_input/text_input.rb +1 -5
  92. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +1 -1
  93. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -2
  94. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  95. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
  96. data/dist/menu.yml +4 -1
  97. data/dist/playbook-rails.js +14 -6
  98. data/lib/playbook/version.rb +2 -2
  99. metadata +25 -2
@@ -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
+ }
@@ -10,6 +10,7 @@
10
10
 
11
11
  [class^=pb_date_picker_kit] {
12
12
  .input_wrapper {
13
+ margin-bottom: $space_sm;
13
14
  position: relative;
14
15
 
15
16
  .flatpickr-wrapper {
@@ -46,7 +47,7 @@
46
47
  .text_input_wrapper_add_on .add-on-right .text_input{
47
48
  cursor: pointer;
48
49
  }
49
-
50
+
50
51
  }
51
52
 
52
53
 
@@ -75,4 +76,4 @@
75
76
  &:after {
76
77
  content: none;
77
78
  }
78
- }
79
+ }
@@ -1,8 +1,6 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
- import { Spacing } from "../types"
5
-
6
4
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
7
5
  import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
8
6
 
@@ -11,7 +9,6 @@ import Icon from '../pb_icon/_icon'
11
9
  import Caption from '../pb_caption/_caption'
12
10
  import Body from '../pb_body/_body'
13
11
 
14
-
15
12
  type DatePickerProps = {
16
13
  allowInput?: boolean,
17
14
  aria?: { [key: string]: string },
@@ -37,13 +34,6 @@ type DatePickerProps = {
37
34
  inputOnChange?: (e: React.FormEvent<HTMLInputElement>) => void,
38
35
  inputValue?: string,
39
36
  label?: string,
40
- margin?: Spacing;
41
- marginBottom?: Spacing;
42
- marginTop?: Spacing;
43
- marginRight?: Spacing;
44
- marginLeft?: Spacing;
45
- marginX?: Spacing;
46
- marginY?: Spacing;
47
37
  maxDate: string,
48
38
  minDate: string,
49
39
  name: string,
@@ -88,13 +78,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
88
78
  inputOnChange,
89
79
  inputValue,
90
80
  label = 'Date Picker',
91
- margin,
92
- marginBottom = "sm",
93
- marginTop,
94
- marginRight,
95
- marginLeft,
96
- marginX,
97
- marginY,
98
81
  maxDate,
99
82
  minDate,
100
83
  mode = 'single',
@@ -151,33 +134,8 @@ useEffect(() => {
151
134
  required: false,
152
135
  }, scrollContainer)
153
136
  })
154
-
155
- const spacingMarginProps = {
156
- margin,
157
- marginBottom,
158
- marginTop,
159
- marginRight,
160
- marginLeft,
161
- marginX,
162
- marginY,
163
- }
164
-
165
137
  const filteredProps = {...props}
166
138
  delete filteredProps?.position
167
- delete filteredProps?.margin;
168
- delete filteredProps?.marginX;
169
- delete filteredProps?.marginY;
170
- delete filteredProps?.marginBottom;
171
- delete filteredProps?.marginTop;
172
- delete filteredProps?.marginRight;
173
- delete filteredProps?.marginLeft;
174
-
175
- const inputClasses = classnames(
176
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
177
- //@ts-ignore
178
- globalProps(spacingMarginProps),
179
- className
180
- )
181
139
 
182
140
  const classes = classnames(
183
141
  buildCss('pb_date_picker_kit'),
@@ -221,7 +179,7 @@ useEffect(() => {
221
179
  text={hideLabel ? null : label}
222
180
  />
223
181
  <>
224
- <div className={`date_picker_input_wrapper ${inputClasses}`}>
182
+ <div className="date_picker_input_wrapper">
225
183
  <input
226
184
  autoComplete="off"
227
185
  className="date_picker_input"
@@ -19,7 +19,6 @@
19
19
  name: object.name,
20
20
  placeholder: object.placeholder,
21
21
  required: object.required,
22
- classname: margins_to_remove.join(" ")
23
22
  }) %>
24
23
  <% end %>
25
24
 
@@ -81,4 +80,4 @@
81
80
  }
82
81
  })
83
82
  <% end %>
84
- <% end %>
83
+ <% end %>
@@ -74,22 +74,8 @@ module Playbook
74
74
  prop :year_range, type: Playbook::Props::Array,
75
75
  default: [1900, 2100]
76
76
 
77
- def margins_to_remove
78
- margin_classes_to_remove = []
79
- margin_classes_to_remove << "m_#{object.margin}" if object.margin
80
- margin_classes_to_remove << "mx_#{object.margin_x}" if object.margin_x
81
- margin_classes_to_remove << "my_#{object.margin_y}" if object.margin_y
82
- margin_classes_to_remove << "mb_#{object.margin_bottom}" if object.margin_bottom
83
- margin_classes_to_remove << "mt_#{object.margin_top}" if object.margin_top
84
- margin_classes_to_remove << "mr_#{object.margin_right}" if object.margin_right
85
- margin_classes_to_remove << "ml_#{object.margin_left}" if object.margin_left
86
- margin_classes_to_remove
87
- end
88
-
89
77
  def classname
90
- regex = Regexp.union(margins_to_remove)
91
- classnames = generate_classname("pb_date_picker_kit")
92
- classnames.gsub(regex, "").strip.gsub(/\s+/, " ")
78
+ generate_classname("pb_date_picker_kit")
93
79
  end
94
80
 
95
81
  def date_picker_config
@@ -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) => {
@@ -1,6 +1,7 @@
1
1
  @import "../../pb_textarea/textarea_mixin";
2
2
 
3
3
  [class^=pb_date_picker_kit] {
4
+ margin-bottom: $space_sm;
4
5
 
5
6
  .pb_date_picker_kit_label {
6
7
  margin-bottom: $space_xs;
@@ -64,4 +65,4 @@
64
65
  }
65
66
  }
66
67
  }
67
- }
68
+ }