playbook_ui 15.6.0.pre.alpha.play266913088 → 15.6.0.pre.rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +2 -3
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -95
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +5 -11
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +163 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +190 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +0 -57
- data/app/pb_kits/playbook/pb_background/_background.tsx +6 -6
- data/app/pb_kits/playbook/pb_background/background.test.js +1 -5
- data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +2 -2
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +8 -10
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +1 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +3 -0
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +24 -51
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +19 -53
- data/app/pb_kits/playbook/pb_contact/contact.rb +1 -11
- data/app/pb_kits/playbook/pb_contact/contact.test.js +0 -76
- data/app/pb_kits/playbook/pb_contact/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_contact/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +0 -24
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +7 -197
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +14 -23
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +1 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -2
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +0 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +0 -14
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +4 -5
- data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +0 -31
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +7 -458
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +3 -8
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -3
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +1 -77
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +5 -7
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +1 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +0 -4
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +5 -39
- data/app/pb_kits/playbook/pb_dropdown/index.js +3 -171
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +4 -4
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.tsx +3 -3
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +22 -34
- data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.html.erb +12 -16
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +12 -16
- data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.html.erb +12 -16
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +0 -10
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +15 -66
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_multiple_users/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.test.js +0 -25
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +10 -44
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +4 -34
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +7 -16
- data/app/pb_kits/playbook/pb_radio/docs/_radio_error.md +1 -1
- data/app/pb_kits/playbook/pb_select/_select.tsx +3 -8
- data/app/pb_kits/playbook/pb_select/docs/_select_error.md +1 -1
- data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
- data/app/pb_kits/playbook/pb_select/select.rb +1 -3
- data/app/pb_kits/playbook/pb_select/select.test.js +0 -23
- data/app/pb_kits/playbook/pb_table/_table.tsx +33 -187
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_table/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_table/table.html.erb +12 -68
- data/app/pb_kits/playbook/pb_table/table.rb +3 -22
- data/app/pb_kits/playbook/pb_table/table.test.js +0 -143
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.md +1 -1
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +0 -3
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -1
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_timeline/item.rb +0 -2
- data/app/pb_kits/playbook/pb_timeline/label.html.erb +1 -2
- data/app/pb_kits/playbook/pb_timeline/label.rb +0 -2
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +0 -3
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +0 -51
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +0 -15
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +0 -3
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +2 -13
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -6
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -34
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -6
- data/app/pb_kits/playbook/tokens/_colors.scss +1 -2
- data/dist/chunks/_typeahead-kRdz5zPn.js +6 -0
- data/dist/chunks/lib-CgpqUb6l.js +29 -0
- data/dist/chunks/vendor.js +3 -3
- data/dist/menu.yml +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/forms/builder/collection_select_field.rb +1 -9
- data/lib/playbook/forms/builder/select_field.rb +1 -9
- data/lib/playbook/forms/builder/time_zone_select_field.rb +1 -9
- data/lib/playbook/pb_kit_helper.rb +0 -35
- data/lib/playbook/version.rb +2 -2
- metadata +4 -54
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.html.erb +0 -43
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_colors_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.jsx +0 -54
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background.md +0 -9
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.jsx +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_multi.md +0 -3
- data/app/pb_kits/playbook/pb_background/docs/_background_light.md +0 -1
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.html.erb +0 -33
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled.jsx +0 -46
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_rails.md +0 -2
- data/app/pb_kits/playbook/pb_contact/docs/_contact_unstyled_react.md +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.html.erb +0 -24
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.jsx +0 -60
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_closeable.md +0 -3
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.html.erb +0 -71
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.jsx +0 -57
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_react.md +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.jsx +0 -180
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.md +0 -22
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.html.erb +0 -19
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.html.erb +0 -12
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_rails.md +0 -26
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.html.erb +0 -19
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.html.erb +0 -30
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_default_rails.md +0 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.html.erb +0 -29
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers_rails.md +0 -13
- data/app/pb_kits/playbook/pb_dropdown/quickpick_helper.rb +0 -75
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.jsx +0 -42
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.md +0 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_input_options.html.erb +0 -16
- data/app/pb_kits/playbook/pb_select/docs/_select_input_options.jsx +0 -30
- data/app/pb_kits/playbook/pb_select/docs/_select_input_options.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx +0 -134
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md +0 -34
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb +0 -101
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +0 -33
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx +0 -180
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.html.erb +0 -122
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination_rails.md +0 -3
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.html.erb +0 -60
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.jsx +0 -118
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_show_current_year.md +0 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.html.erb +0 -30
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.jsx +0 -37
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.md +0 -3
- data/app/pb_kits/playbook/utilities/deprecated.ts +0 -73
- data/dist/chunks/_typeahead-CbjBmIDu.js +0 -6
- data/dist/chunks/lib-DxDBrGZX.js +0 -29
|
@@ -275,80 +275,6 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
|
275
275
|
|
|
276
276
|
const { setMinDate, setMaxDate } = getMinMaxDates()
|
|
277
277
|
|
|
278
|
-
// Default Date + Min/Max Date Initialization Helper Functions section ----/
|
|
279
|
-
const toDateObject = (dateValue: any): Date | null => {
|
|
280
|
-
if (!dateValue) return null
|
|
281
|
-
if (dateValue instanceof Date) return dateValue
|
|
282
|
-
if (typeof dateValue === 'string') {
|
|
283
|
-
const parsed = new Date(dateValue)
|
|
284
|
-
return isNaN(parsed.getTime()) ? null : parsed
|
|
285
|
-
}
|
|
286
|
-
if (typeof dateValue === 'number') {
|
|
287
|
-
return new Date(dateValue)
|
|
288
|
-
}
|
|
289
|
-
return null
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// Formatting Date for Flatpickr
|
|
293
|
-
const formatDateForFlatpickr = (dateValue: any): string | null => {
|
|
294
|
-
const dateObj = toDateObject(dateValue)
|
|
295
|
-
if (!dateObj) return null
|
|
296
|
-
|
|
297
|
-
const year = dateObj.getFullYear()
|
|
298
|
-
const month = String(dateObj.getMonth() + 1).padStart(2, '0')
|
|
299
|
-
const day = String(dateObj.getDate()).padStart(2, '0')
|
|
300
|
-
return `${year}-${month}-${day}`
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// Helper to check if defaultDate is earlier than minDate
|
|
304
|
-
const isDefaultDateBeforeMinDate = (defaultDateValue: any, minDateValue: any): boolean => {
|
|
305
|
-
if (!defaultDateValue || !minDateValue) return false
|
|
306
|
-
|
|
307
|
-
const defaultDateObj = toDateObject(defaultDateValue)
|
|
308
|
-
const minDateObj = toDateObject(minDateValue)
|
|
309
|
-
|
|
310
|
-
if (!defaultDateObj || !minDateObj) return false
|
|
311
|
-
|
|
312
|
-
const defaultDateOnly = new Date(defaultDateObj.getFullYear(), defaultDateObj.getMonth(), defaultDateObj.getDate())
|
|
313
|
-
const minDateOnly = new Date(minDateObj.getFullYear(), minDateObj.getMonth(), minDateObj.getDate())
|
|
314
|
-
|
|
315
|
-
return defaultDateOnly < minDateOnly
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// Helper to check if defaultDate is later than maxDate
|
|
319
|
-
const isDefaultDateAfterMaxDate = (defaultDateValue: any, maxDateValue: any): boolean => {
|
|
320
|
-
if (!defaultDateValue || !maxDateValue) return false
|
|
321
|
-
|
|
322
|
-
const defaultDateObj = toDateObject(defaultDateValue)
|
|
323
|
-
const maxDateObj = toDateObject(maxDateValue)
|
|
324
|
-
|
|
325
|
-
if (!defaultDateObj || !maxDateObj) return false
|
|
326
|
-
|
|
327
|
-
const defaultDateOnly = new Date(defaultDateObj.getFullYear(), defaultDateObj.getMonth(), defaultDateObj.getDate())
|
|
328
|
-
const maxDateOnly = new Date(maxDateObj.getFullYear(), maxDateObj.getMonth(), maxDateObj.getDate())
|
|
329
|
-
|
|
330
|
-
return defaultDateOnly > maxDateOnly
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const defaultDateValue: any = defaultDateGetter()
|
|
334
|
-
// Only check for and out-of-range if user actually provided minDate/maxDate constraints
|
|
335
|
-
const isBeforeMin = minDate && isDefaultDateBeforeMinDate(defaultDateValue, setMinDate)
|
|
336
|
-
const isAfterMax = maxDate && isDefaultDateAfterMaxDate(defaultDateValue, setMaxDate)
|
|
337
|
-
|
|
338
|
-
// Store these values for use in onClose handler
|
|
339
|
-
const hasOutOfRangeDefault = (isBeforeMin || isAfterMax) && defaultDateValue
|
|
340
|
-
|
|
341
|
-
// Temporarily adjust minDate/maxDate to allow defaultDate to render if it's out of range via user provided minDate/maxDate constraints
|
|
342
|
-
const effectiveMinDate = isBeforeMin && defaultDateValue && minDate
|
|
343
|
-
? formatDateForFlatpickr(defaultDateValue) || setMinDate
|
|
344
|
-
: setMinDate
|
|
345
|
-
|
|
346
|
-
const effectiveMaxDate = isAfterMax && defaultDateValue && maxDate
|
|
347
|
-
? formatDateForFlatpickr(defaultDateValue) || setMaxDate
|
|
348
|
-
: setMaxDate
|
|
349
|
-
|
|
350
|
-
// End of Default Date + Min/Max Date Initialization Helper Functions section ----/
|
|
351
|
-
|
|
352
278
|
flatpickr(`#${pickerId}`, {
|
|
353
279
|
allowInput,
|
|
354
280
|
closeOnSelect,
|
|
@@ -360,32 +286,11 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
|
360
286
|
locale: {
|
|
361
287
|
rangeSeparator: ' to '
|
|
362
288
|
},
|
|
363
|
-
maxDate:
|
|
364
|
-
minDate:
|
|
289
|
+
maxDate: setMaxDate,
|
|
290
|
+
minDate: setMinDate,
|
|
365
291
|
mode,
|
|
366
292
|
nextArrow: '<i class="far fa-angle-right"></i>',
|
|
367
293
|
onOpen: [(_selectedDates, _dateStr, fp) => {
|
|
368
|
-
// If defaultDate was out of range of a dev set min/max date, restore it when calendar opens (in situation where the input was manually cleared or the calendar was closed without selection)
|
|
369
|
-
if (hasOutOfRangeDefault) {
|
|
370
|
-
const dateObj = toDateObject(defaultDateValue)
|
|
371
|
-
if (dateObj) {
|
|
372
|
-
const inputIsBlank = !fp.input.value || fp.input.value.trim() === ''
|
|
373
|
-
const noSelection = !fp.selectedDates || fp.selectedDates.length === 0
|
|
374
|
-
|
|
375
|
-
if (inputIsBlank || noSelection) {
|
|
376
|
-
const formattedDate = fp.formatDate(dateObj, getDateFormat())
|
|
377
|
-
if (formattedDate) {
|
|
378
|
-
fp.input.value = formattedDate
|
|
379
|
-
}
|
|
380
|
-
fp.selectedDates = [dateObj]
|
|
381
|
-
fp.jumpToDate(dateObj)
|
|
382
|
-
setTimeout(() => {
|
|
383
|
-
yearChangeHook(fp)
|
|
384
|
-
}, 0)
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
294
|
calendarResizer()
|
|
390
295
|
if (resizeRepositionHandlerRef) {
|
|
391
296
|
window.removeEventListener('resize', resizeRepositionHandlerRef)
|
|
@@ -398,30 +303,12 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
|
398
303
|
if (!staticPosition && scrollContainer) attachToScroll(scrollContainer)
|
|
399
304
|
positionCalendarIfNeeded(fp)
|
|
400
305
|
}],
|
|
401
|
-
onClose: [(selectedDates, dateStr
|
|
306
|
+
onClose: [(selectedDates, dateStr) => {
|
|
402
307
|
if (resizeRepositionHandlerRef) {
|
|
403
308
|
window.removeEventListener('resize', resizeRepositionHandlerRef)
|
|
404
309
|
resizeRepositionHandlerRef = null
|
|
405
310
|
}
|
|
406
311
|
if (!staticPosition && scrollContainer) detachFromScroll(scrollContainer as HTMLElement)
|
|
407
|
-
|
|
408
|
-
// If defaultDate was out of range and no date was selected, preserve the default date
|
|
409
|
-
if (hasOutOfRangeDefault && (!selectedDates || selectedDates.length === 0)) {
|
|
410
|
-
const dateObj = toDateObject(defaultDateValue)
|
|
411
|
-
if (dateObj && fp.input) {
|
|
412
|
-
const formattedDate = fp.formatDate(dateObj, getDateFormat())
|
|
413
|
-
if (formattedDate) {
|
|
414
|
-
setTimeout(() => {
|
|
415
|
-
if (fp.input && (!fp.selectedDates || fp.selectedDates.length === 0)) {
|
|
416
|
-
fp.input.value = formattedDate
|
|
417
|
-
fp.selectedDates = [dateObj]
|
|
418
|
-
fp.jumpToDate(dateObj)
|
|
419
|
-
}
|
|
420
|
-
}, 0)
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
312
|
onClose(selectedDates, dateStr)
|
|
426
313
|
}],
|
|
427
314
|
onChange: [(selectedDates, dateStr, fp) => {
|
|
@@ -443,71 +330,6 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
|
443
330
|
const picker = document.querySelector<HTMLElement & { [x: string]: any }>(`#${pickerId}`)._flatpickr
|
|
444
331
|
picker.innerContainer.parentElement.id = `cal-${pickerId}`
|
|
445
332
|
|
|
446
|
-
// If defaultDate was out of range, restore the original minDate/maxDate after initialization (defaultDate displayed, still cannot select dates outside the actual range via user provided minDate/maxDate constraints)
|
|
447
|
-
if ((isBeforeMin || isAfterMax) && defaultDateValue) {
|
|
448
|
-
const dateObj = toDateObject(defaultDateValue)
|
|
449
|
-
const formattedDate = dateObj ? picker.formatDate(dateObj, getDateFormat()) : null
|
|
450
|
-
|
|
451
|
-
setTimeout(() => {
|
|
452
|
-
if (!dateObj || !picker.input || !formattedDate) return
|
|
453
|
-
|
|
454
|
-
picker.setDate(dateObj, false)
|
|
455
|
-
|
|
456
|
-
if (isBeforeMin && setMinDate && minDate) {
|
|
457
|
-
picker.set('minDate', setMinDate)
|
|
458
|
-
}
|
|
459
|
-
if (isAfterMax && setMaxDate && maxDate) {
|
|
460
|
-
picker.set('maxDate', setMaxDate)
|
|
461
|
-
}
|
|
462
|
-
picker.input.value = formattedDate
|
|
463
|
-
|
|
464
|
-
picker.selectedDates = [dateObj]
|
|
465
|
-
|
|
466
|
-
setTimeout(() => {
|
|
467
|
-
yearChangeHook(picker)
|
|
468
|
-
}, 0)
|
|
469
|
-
|
|
470
|
-
// Restore function for out-of-range default dates
|
|
471
|
-
const restoreOutOfRangeValue = () => {
|
|
472
|
-
if (!picker.input) return
|
|
473
|
-
|
|
474
|
-
const inputIsBlank = !picker.input.value || picker.input.value.trim() === ''
|
|
475
|
-
const noSelection = !picker.selectedDates || picker.selectedDates.length === 0
|
|
476
|
-
|
|
477
|
-
if (inputIsBlank || noSelection) {
|
|
478
|
-
setTimeout(() => {
|
|
479
|
-
if (picker.input && (!picker.input.value || picker.input.value.trim() === '')) {
|
|
480
|
-
picker.input.value = formattedDate
|
|
481
|
-
}
|
|
482
|
-
if (!picker.selectedDates || picker.selectedDates.length === 0) {
|
|
483
|
-
picker.selectedDates = [dateObj]
|
|
484
|
-
if (picker.isOpen) {
|
|
485
|
-
picker.jumpToDate(dateObj)
|
|
486
|
-
picker.redraw()
|
|
487
|
-
setTimeout(() => {
|
|
488
|
-
yearChangeHook(picker)
|
|
489
|
-
}, 0)
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}, 0)
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
const originalClear = picker.clear.bind(picker)
|
|
497
|
-
picker.clear = function(...args: any[]) {
|
|
498
|
-
const result = originalClear(...args)
|
|
499
|
-
setTimeout(() => restoreOutOfRangeValue(), 0)
|
|
500
|
-
return result
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
picker.input.addEventListener('input', restoreOutOfRangeValue)
|
|
504
|
-
|
|
505
|
-
picker.config.onClose.push(() => {
|
|
506
|
-
restoreOutOfRangeValue()
|
|
507
|
-
})
|
|
508
|
-
}, 10)
|
|
509
|
-
}
|
|
510
|
-
|
|
511
333
|
// replace year selector with dropdown
|
|
512
334
|
picker.yearElements[0].parentElement.innerHTML = `<select class="numInput cur-year" type="number" tabIndex="-1" aria-label="Year" id="year-${pickerId}"></select>`
|
|
513
335
|
|
|
@@ -570,16 +392,10 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
|
570
392
|
picker.config.onClose.push((selectedDates: string) => {
|
|
571
393
|
if (selectedDates?.length) {
|
|
572
394
|
const element = document.querySelector(`#${syncStartWith}`) as any;
|
|
573
|
-
// Check if it's a
|
|
395
|
+
// Check if it's a Dropdown QuickPick (has _dropdownRef) or DatePicker QuickPick (has _flatpickr)
|
|
574
396
|
if (element?._dropdownRef?.current) {
|
|
575
397
|
element._dropdownRef.current.clearSelected();
|
|
576
|
-
}
|
|
577
|
-
// Check if it's a Rails Dropdown (has _pbDropdownInstance)
|
|
578
|
-
else if (element?._pbDropdownInstance) {
|
|
579
|
-
element._pbDropdownInstance.clearSelected();
|
|
580
|
-
}
|
|
581
|
-
// Check if it's a DatePicker QuickPick (has _flatpickr)
|
|
582
|
-
else {
|
|
398
|
+
} else {
|
|
583
399
|
const quickpick = element?._flatpickr;
|
|
584
400
|
quickpick?.clear();
|
|
585
401
|
}
|
|
@@ -592,16 +408,10 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
|
592
408
|
picker.config.onClose.push((selectedDates: string) => {
|
|
593
409
|
if (selectedDates?.length) {
|
|
594
410
|
const element = document.querySelector(`#${syncEndWith}`) as any;
|
|
595
|
-
// Check if it's a
|
|
411
|
+
// Check if it's a Dropdown QuickPick (has _dropdownRef) or DatePicker QuickPick (has _flatpickr)
|
|
596
412
|
if (element?._dropdownRef?.current) {
|
|
597
413
|
element._dropdownRef.current.clearSelected();
|
|
598
|
-
}
|
|
599
|
-
// Check if it's a Rails Dropdown (has _pbDropdownInstance)
|
|
600
|
-
else if (element?._pbDropdownInstance) {
|
|
601
|
-
element._pbDropdownInstance.clearSelected();
|
|
602
|
-
}
|
|
603
|
-
// Check if it's a DatePicker QuickPick (has _flatpickr)
|
|
604
|
-
else {
|
|
414
|
+
} else {
|
|
605
415
|
const quickpick = element?._flatpickr;
|
|
606
416
|
quickpick?.clear();
|
|
607
417
|
}
|
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
<%= pb_rails("
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
controls_start_id: "
|
|
8
|
-
controls_end_id: "end-date-picker-1",
|
|
9
|
-
start_date_id: "quickpick_start_date_1",
|
|
10
|
-
start_date_name: "start_date",
|
|
11
|
-
end_date_id: "quickpick_end_date_1",
|
|
12
|
-
end_date_name: "end_date"
|
|
1
|
+
<%= pb_rails("date_picker", props: {
|
|
2
|
+
mode: "range",
|
|
3
|
+
picker_id: "quick-pick-date-range",
|
|
4
|
+
placeholder: "Select a Date Range",
|
|
5
|
+
selection_type: "quickpick",
|
|
6
|
+
controls_end_id: "quick-pick-date-range-end",
|
|
7
|
+
controls_start_id: "quick-pick-date-range-start",
|
|
13
8
|
}) %>
|
|
14
9
|
|
|
15
10
|
<%= pb_rails("date_picker", props: {
|
|
16
|
-
picker_id: "
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
placeholder: "Select Start Date",
|
|
20
|
-
sync_start_with: "dropdown-quickpick-with-date-pickers-1"
|
|
11
|
+
picker_id: "quick-pick-date-range-start",
|
|
12
|
+
placeholder: "Select a Start Date",
|
|
13
|
+
sync_start_with:"quick-pick-date-range",
|
|
21
14
|
}) %>
|
|
22
15
|
|
|
23
16
|
<%= pb_rails("date_picker", props: {
|
|
24
|
-
picker_id: "
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
sync_end_with: "dropdown-quickpick-with-date-pickers-1"
|
|
29
|
-
}) %>
|
|
17
|
+
picker_id: "quick-pick-date-range-end",
|
|
18
|
+
placeholder: "Select an End Date",
|
|
19
|
+
sync_end_with:"quick-pick-date-range",
|
|
20
|
+
}) %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
You can link a Quickpick
|
|
1
|
+
You can link a Quickpick DatePicker to standard DatePickers using the following props:
|
|
2
2
|
|
|
3
3
|
**For the Quickpick DatePicker**:
|
|
4
4
|
`controls_start_id`: ID of the DatePicker that should receive the start date.
|
|
@@ -51,7 +51,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
|
51
51
|
cancelButton,
|
|
52
52
|
confirmButton,
|
|
53
53
|
className,
|
|
54
|
-
closeable,
|
|
55
54
|
data = {},
|
|
56
55
|
htmlOptions = {},
|
|
57
56
|
id,
|
|
@@ -188,7 +187,7 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
|
188
187
|
style={{ content: dynamicInlineProps }}
|
|
189
188
|
>
|
|
190
189
|
<>
|
|
191
|
-
{title && !status ? <Dialog.Header
|
|
190
|
+
{title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
|
|
192
191
|
{!status && text ? <Dialog.Body>{text}</Dialog.Body> : null}
|
|
193
192
|
{status && (
|
|
194
193
|
<Dialog.Body
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
>
|
|
15
15
|
<%= pb_content_tag(:dialog, role: "dialog", "aria-modal": "true", "aria-label": "Dialog") do %>
|
|
16
16
|
<% if object.status === "" && object.title %>
|
|
17
|
-
<%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id
|
|
17
|
+
<%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id }) %>
|
|
18
18
|
<% end %>
|
|
19
19
|
<% if object.status === "" && object.text %>
|
|
20
20
|
<%= pb_rails("dialog/dialog_body", props: { text: object.text }) %>
|
|
@@ -23,7 +23,6 @@ module Playbook
|
|
|
23
23
|
default: ""
|
|
24
24
|
prop :custom_event_type, type: Playbook::Props::String,
|
|
25
25
|
default: ""
|
|
26
|
-
prop :closeable, type: Playbook::Props::Boolean, default: true
|
|
27
26
|
|
|
28
27
|
def classname
|
|
29
28
|
generate_classname("pb_dialog pb_dialog_rails pb_dialog_#{size}_#{placement}")
|
|
@@ -129,17 +129,3 @@ test('renders loading dialog with disabled buttons', async () => {
|
|
|
129
129
|
|
|
130
130
|
cleanup()
|
|
131
131
|
})
|
|
132
|
-
|
|
133
|
-
test('renders dialog without close button when closeable is false', async () => {
|
|
134
|
-
|
|
135
|
-
const { queryByText, container } = render(<DialogTest closeable={false} />);
|
|
136
|
-
|
|
137
|
-
fireEvent.click(queryByText('Open Dialog'));
|
|
138
|
-
|
|
139
|
-
await waitFor(() => expect(queryByText("Header Title is the Title Prop")));
|
|
140
|
-
|
|
141
|
-
const closeBtn = container.querySelector('.pb_dialog_close_icon');
|
|
142
|
-
expect(closeBtn).not.toBeInTheDocument();
|
|
143
|
-
|
|
144
|
-
cleanup()
|
|
145
|
-
})
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<%= pb_content_tag(:div, class: object.sticky_header) do %>
|
|
2
2
|
<%= pb_rails("flex", props: {classname:object.classname, spacing:"between", padding:"sm", align:"center"}) do %>
|
|
3
3
|
<%= content.presence || object.title %>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<% end %>
|
|
4
|
+
|
|
5
|
+
<button class="dialog-button-class pb_dialog_close_icon" type="button" data-close-dialog= <%= object.id %> aria-label="Close Dialog" >
|
|
6
|
+
<%= pb_rails("icon", props: { custom_icon: Playbook::Engine::root.join(times_icon), aria: { hidden: true } }) %>
|
|
7
|
+
</button>
|
|
9
8
|
<% end %>
|
|
10
9
|
<%= pb_rails("section_separator") %>
|
|
11
10
|
<% end %>
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
<%
|
|
2
|
-
options = [
|
|
3
|
-
{
|
|
4
|
-
label: "United States",
|
|
5
|
-
value: "unitedStates",
|
|
6
|
-
id: "us"
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
label: "United Kingdom",
|
|
10
|
-
value: "unitedKingdom",
|
|
11
|
-
id: "gb"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
label: "Pakistan",
|
|
15
|
-
value: "pakistan",
|
|
16
|
-
id: "pk"
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
%>
|
|
20
|
-
|
|
21
|
-
|
|
22
1
|
<%= pb_rails("button", props: { text: "Open Complex Dialog", data:{"open-dialog": "dialog-complex"} }) %>
|
|
23
2
|
|
|
24
3
|
<%= pb_rails("dialog", props: { id:"dialog-complex", size: "lg", full_height: true }) do %>
|
|
@@ -31,16 +10,6 @@
|
|
|
31
10
|
<%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
|
|
32
11
|
<%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
|
|
33
12
|
<%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
|
|
34
|
-
<%= pb_rails("dropdown", props: {options: options, autocomplete: true}) %>
|
|
35
|
-
<%= pb_rails("typeahead", props: {
|
|
36
|
-
id: "typeahead-default",
|
|
37
|
-
placeholder: "Select one...",
|
|
38
|
-
options: options,
|
|
39
|
-
name: :foo,
|
|
40
|
-
margin_top: "sm",
|
|
41
|
-
is_multi: false
|
|
42
|
-
})
|
|
43
|
-
%>
|
|
44
13
|
|
|
45
14
|
<% end %>
|
|
46
15
|
<%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-complex"}) %>
|
|
@@ -12,8 +12,6 @@ examples:
|
|
|
12
12
|
- dialog_full_height_placement: Full Height Placement
|
|
13
13
|
- dialog_loading: Loading
|
|
14
14
|
- dialog_turbo_frames: Within Turbo Frames
|
|
15
|
-
- dialog_overflow_visible: Overflow Visible
|
|
16
|
-
- dialog_closeable: Close Button in Header
|
|
17
15
|
|
|
18
16
|
|
|
19
17
|
react:
|
|
@@ -27,8 +25,6 @@ examples:
|
|
|
27
25
|
- dialog_full_height: Full Height
|
|
28
26
|
- dialog_full_height_placement: Full Height Placement
|
|
29
27
|
- dialog_loading: Loading
|
|
30
|
-
- dialog_overflow_visible: Overflow Visible
|
|
31
|
-
- dialog_closeable: Close Button in Header
|
|
32
28
|
|
|
33
29
|
swift:
|
|
34
30
|
- dialog_default_swift: Simple
|
|
@@ -8,6 +8,4 @@ export { default as DialogStatus } from './_dialog_status.jsx'
|
|
|
8
8
|
export { default as DialogStackedAlert } from './_dialog_stacked_alert.jsx'
|
|
9
9
|
export { default as DialogFullHeight } from './_dialog_full_height.jsx'
|
|
10
10
|
export { default as DialogFullHeightPlacement } from './_dialog_full_height_placement.jsx'
|
|
11
|
-
export { default as DialogLoading } from './_dialog_loading.jsx'
|
|
12
|
-
export { default as DialogOverflowVisible } from './_dialog_overflow_visible.jsx'
|
|
13
|
-
export { default as DialogCloseable } from './_dialog_closeable.jsx'
|
|
11
|
+
export { default as DialogLoading } from './_dialog_loading.jsx'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
You can customize the order of the colors you would like to use by using the `colors` prop. Only the data and status colors will work for Playbook charts. See the [design page](https://playbook.powerapp.cloud/
|
|
1
|
+
You can customize the order of the colors you would like to use by using the `colors` prop. Only the data and status colors will work for Playbook charts. See the [design page](https://playbook.powerapp.cloud/token/colors) for reference.
|