playbook_ui 15.5.0.pre.alpha.PLAY2503datepickerdefaultdateoutsideminmaxrange12814 → 15.5.0.pre.alpha.PLAY2554homeaddressstreetaccessibility12695
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_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_date_picker/date_picker.test.js +0 -24
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +3 -181
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_min_max.html.erb +0 -18
- data/app/pb_kits/playbook/pb_dialog/index.js +15 -10
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -8
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -11
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +124 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.jsx +147 -12
- 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_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/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/dist/chunks/_typeahead-CkkCTRLh.js +6 -0
- data/dist/chunks/{lib-x6lM2EFN.js → lib-CgpqUb6l.js} +1 -1
- data/dist/chunks/vendor.js +2 -2
- 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/version.rb +1 -1
- metadata +4 -10
- data/app/pb_kits/playbook/pb_background/docs/_background_light.md +0 -1
- 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_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/dist/chunks/_typeahead-DCwdpOmC.js +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b17349abd67079ab8e811b239c8971e2809a0299a6f69e41e247ee2a34a8d7bc
|
|
4
|
+
data.tar.gz: f0d3ef9cca63f616d580065e9058bc5a6514ddfda74ea028af65191562bf7c9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 65f48b3ade3d01c25fb8e4f44828db75e64aba0ceba8bcfd7b9f7b17b11750ed7c7ad890e424a33333da0c88e299701094d18fbc8227b20994579cecaa575a2c
|
|
7
|
+
data.tar.gz: 858d50215f7af0969b58fddf455b162a6109efd4a3854884dcfbf55fbf29658345dd7dcd1faf97f9b5ecaf79a2022637e0f9f869f3ba7159cdf174e9c615bc0d
|
|
@@ -102,16 +102,16 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
|
102
102
|
useEffect(() => {
|
|
103
103
|
const updateResponsiveProps = () => {
|
|
104
104
|
setResponsiveProps({
|
|
105
|
-
backgroundSize: getResponsiveValue(backgroundSize),
|
|
106
|
-
backgroundPosition: getResponsiveValue(backgroundPosition),
|
|
107
|
-
backgroundRepeat: getResponsiveValue(backgroundRepeat),
|
|
108
|
-
backgroundColor: getResponsiveValue(backgroundColor),
|
|
109
|
-
imageUrl: getResponsiveValue(imageUrl),
|
|
105
|
+
backgroundSize: getResponsiveValue(props.backgroundSize),
|
|
106
|
+
backgroundPosition: getResponsiveValue(props.backgroundPosition),
|
|
107
|
+
backgroundRepeat: getResponsiveValue(props.backgroundRepeat),
|
|
108
|
+
backgroundColor: getResponsiveValue(props.backgroundColor),
|
|
109
|
+
imageUrl: getResponsiveValue(props.imageUrl),
|
|
110
110
|
});
|
|
111
111
|
};
|
|
112
112
|
window.addEventListener('resize', updateResponsiveProps);
|
|
113
113
|
return () => window.removeEventListener('resize', updateResponsiveProps);
|
|
114
|
-
}, [
|
|
114
|
+
}, [props]);
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
// Extract currently applicable responsive values.
|
|
@@ -4,6 +4,7 @@ import Background from './_background'
|
|
|
4
4
|
|
|
5
5
|
const props = {
|
|
6
6
|
data: { testid: 'background' },
|
|
7
|
+
backgroundColor: null,
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
it('Should be accessible', async () => {
|
|
@@ -41,8 +42,3 @@ test('applies correct overlay class when imageOverlay prop is provided', () => {
|
|
|
41
42
|
const kit = renderKit(Background, props, { imageOverlay: 'opacity_6' });
|
|
42
43
|
expect(kit).toHaveClass('imageoverlay_opacity_6');
|
|
43
44
|
});
|
|
44
|
-
|
|
45
|
-
test('Sets backgroundColor to light as default when no backgroundColor prop is provided', () => {
|
|
46
|
-
const kit = renderKit(Background, props);
|
|
47
|
-
expect(kit).toHaveClass('pb_background_color_light');
|
|
48
|
-
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
examples:
|
|
2
2
|
|
|
3
3
|
rails:
|
|
4
|
-
- background_light:
|
|
4
|
+
- background_light: Light
|
|
5
5
|
- background_white: White
|
|
6
6
|
- background_gradient: Gradient
|
|
7
7
|
- background_image: Image
|
|
@@ -11,7 +11,7 @@ examples:
|
|
|
11
11
|
- background_size: Size
|
|
12
12
|
|
|
13
13
|
react:
|
|
14
|
-
- background_light:
|
|
14
|
+
- background_light: Light
|
|
15
15
|
- background_white: White
|
|
16
16
|
- background_gradient: Gradient
|
|
17
17
|
- background_image: Image
|
|
@@ -251,28 +251,4 @@ describe('DatePicker Kit', () => {
|
|
|
251
251
|
expect(input).toHaveValue(DateTime.getYearStartDate(new Date()).formatDate() + " to " + new Date().formatDate())
|
|
252
252
|
})
|
|
253
253
|
})
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
test('displays defaultDate when it is later than maxDate', async () => {
|
|
257
|
-
const testId = 'datepicker-out-of-range-after'
|
|
258
|
-
const futureDateString = '01/15/2020'
|
|
259
|
-
const maxDateString = '01/10/2020'
|
|
260
|
-
|
|
261
|
-
render(
|
|
262
|
-
<DatePicker
|
|
263
|
-
data={{ testid: testId }}
|
|
264
|
-
defaultDate={futureDateString}
|
|
265
|
-
format="m/d/Y"
|
|
266
|
-
maxDate={maxDateString}
|
|
267
|
-
pickerId="date-picker-out-of-range-after"
|
|
268
|
-
/>
|
|
269
|
-
)
|
|
270
|
-
|
|
271
|
-
const kit = screen.getByTestId(testId)
|
|
272
|
-
const input = within(kit).getByPlaceholderText('Select Date')
|
|
273
|
-
|
|
274
|
-
await waitFor(() => {
|
|
275
|
-
expect(input).toHaveValue('01/15/2020')
|
|
276
|
-
}, { timeout: 5000 })
|
|
277
|
-
})
|
|
278
254
|
})
|
|
@@ -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
|
|
|
@@ -11,22 +11,4 @@
|
|
|
11
11
|
max_date: "10/20/2020",
|
|
12
12
|
min_date: "10/10/2020",
|
|
13
13
|
picker_id: "date-picker-min-max2"
|
|
14
|
-
}) %>
|
|
15
|
-
|
|
16
|
-
<%= pb_rails("date_picker", props: {
|
|
17
|
-
format: "m/d/Y",
|
|
18
|
-
label: "Default date earlier than min_date (preserved)",
|
|
19
|
-
default_date: (DateTime.current - 3.days).utc.iso8601,
|
|
20
|
-
min_date: (DateTime.current - 1.day).utc.iso8601,
|
|
21
|
-
max_date: (DateTime.current + 7.days).utc.iso8601,
|
|
22
|
-
picker_id: "date-picker-min-max-default-before"
|
|
23
|
-
}) %>
|
|
24
|
-
|
|
25
|
-
<%= pb_rails("date_picker", props: {
|
|
26
|
-
format: "m/d/Y",
|
|
27
|
-
label: "Default date later than max_date (preserved)",
|
|
28
|
-
default_date: (DateTime.current + 10.days).utc.iso8601,
|
|
29
|
-
min_date: (DateTime.current - 1.day).utc.iso8601,
|
|
30
|
-
max_date: (DateTime.current + 7.days).utc.iso8601,
|
|
31
|
-
picker_id: "date-picker-min-max-default-after"
|
|
32
14
|
}) %>
|
|
@@ -143,25 +143,30 @@ export default class PbDialog extends PbEnhancedElement {
|
|
|
143
143
|
|
|
144
144
|
// Close dialog box on outside click
|
|
145
145
|
dialogs.forEach((dialogElement) => {
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
146
|
+
const originalClickHandler = dialogElement._outsideClickHandler
|
|
147
|
+
if (originalClickHandler) dialogElement.removeEventListener("click", originalClickHandler)
|
|
148
|
+
|
|
148
149
|
dialogElement._outsideClickHandler = (event) => {
|
|
149
150
|
const dialogParentDataset = dialogElement.parentElement.dataset
|
|
150
151
|
if (dialogParentDataset.overlayClick === "overlay_close") return
|
|
151
152
|
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
event.
|
|
156
|
-
event.
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
// Get the dialog's bounding box (the actual content area)
|
|
154
|
+
const rect = dialogElement.getBoundingClientRect()
|
|
155
|
+
const clickedInDialog = (
|
|
156
|
+
event.clientX >= rect.left &&
|
|
157
|
+
event.clientX <= rect.right &&
|
|
158
|
+
event.clientY >= rect.top &&
|
|
159
|
+
event.clientY <= rect.bottom
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
// Only close if clicked outside the dialog content (on the backdrop)
|
|
163
|
+
if (!clickedInDialog) {
|
|
159
164
|
dialogElement.close()
|
|
160
165
|
event.stopPropagation()
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
|
|
164
|
-
dialogElement.addEventListener("
|
|
169
|
+
dialogElement.addEventListener("click", dialogElement._outsideClickHandler);
|
|
165
170
|
})
|
|
166
171
|
}
|
|
167
172
|
}
|
|
@@ -112,14 +112,7 @@
|
|
|
112
112
|
name: "checkbox-name",
|
|
113
113
|
class: "checkbox-class"
|
|
114
114
|
%>
|
|
115
|
-
<%= form.date_picker :example_date_picker_1, props: {
|
|
116
|
-
label: true,
|
|
117
|
-
# Testing out-of-range default date feature: default_date is earlier than min_date
|
|
118
|
-
# This should still display the default date even though it's outside the valid range
|
|
119
|
-
default_date: (DateTime.current - 3.days).utc.iso8601,
|
|
120
|
-
min_date: (DateTime.current - 1.day).utc.iso8601,
|
|
121
|
-
max_date: (DateTime.current + 7.days).utc.iso8601
|
|
122
|
-
} %>
|
|
115
|
+
<%= form.date_picker :example_date_picker_1, props: { label: true } %>
|
|
123
116
|
<%= form.star_rating_field :example_star_rating, props: { variant: "interactive", label: true } %>
|
|
124
117
|
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true } %>
|
|
125
118
|
<%= form.multi_level_select :example_multi_level_select, props: { id: "multi-level-select-form-default", tree_data: treeData, margin_bottom: "sm", label: "Example Multi Level Select field" } %>
|
|
@@ -113,17 +113,7 @@
|
|
|
113
113
|
<%= form.select :example_select_validation, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true, validation_message: "Please, select an option." } %>
|
|
114
114
|
<%= form.collection_select :example_collection_select_validation, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
|
|
115
115
|
<%= form.check_box :example_checkbox_validation, props: { text: "Example Checkbox Validation", label: true, required: true }, checked_value: "1", unchecked_value: "0" %>
|
|
116
|
-
<%= form.date_picker :example_date_picker_2, props: {
|
|
117
|
-
label: true,
|
|
118
|
-
required: true,
|
|
119
|
-
validation_message: "Please, select a date.",
|
|
120
|
-
allow_input: true,
|
|
121
|
-
# Testing out-of-range default date feature: default_date is earlier than min_date
|
|
122
|
-
# This should still display the default date even though it's outside the valid range
|
|
123
|
-
default_date: (DateTime.current - 3.days).utc.iso8601,
|
|
124
|
-
min_date: (DateTime.current - 1.day).utc.iso8601,
|
|
125
|
-
max_date: (DateTime.current + 7.days).utc.iso8601
|
|
126
|
-
} %>
|
|
116
|
+
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true, validation_message: "Please, select a date.", allow_input: true } %>
|
|
127
117
|
<%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
|
|
128
118
|
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true, blank_selection: "Select a Time Zone...", required: true } %>
|
|
129
119
|
<%= form.multi_level_select :example_multi_level_select, props: { id: "multi-level-select-form", tree_data: treeData, margin_bottom: "sm", required: true, label: "Example Multi Level Select field" } %>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
<%= pb_rails("caption", props: { text: "with all" }) %>
|
|
1
2
|
<%= pb_rails("home_address_street", props: {
|
|
2
3
|
address: "70 Prospect Ave",
|
|
3
4
|
address_cont: "Apt M18",
|
|
@@ -8,4 +9,127 @@
|
|
|
8
9
|
state: "PA",
|
|
9
10
|
zipcode: "19382",
|
|
10
11
|
territory: "PHL",
|
|
12
|
+
}) %>
|
|
13
|
+
|
|
14
|
+
<%= pb_rails("caption", props: { margin_top: "sm", text: "First two lines blank: without address and address cont and housestyle" }) %>
|
|
15
|
+
<%= pb_rails("home_address_street", props: {
|
|
16
|
+
city: "West Chester",
|
|
17
|
+
home_id: 8250263,
|
|
18
|
+
home_url: "https://powerhrg.com/",
|
|
19
|
+
state: "PA",
|
|
20
|
+
zipcode: "19382",
|
|
21
|
+
territory: "PHL",
|
|
22
|
+
}) %>
|
|
23
|
+
|
|
24
|
+
<%= pb_rails("caption", props: { margin_top: "sm", text: "First line half blank Second line full: with housestyle and without address and address cont" }) %>
|
|
25
|
+
<%= pb_rails("home_address_street", props: {
|
|
26
|
+
city: "West Chester",
|
|
27
|
+
home_id: 8250263,
|
|
28
|
+
home_url: "https://powerhrg.com/",
|
|
29
|
+
house_style: "Colonial",
|
|
30
|
+
state: "PA",
|
|
31
|
+
zipcode: "19382",
|
|
32
|
+
territory: "PHL",
|
|
33
|
+
}) %>
|
|
34
|
+
|
|
35
|
+
<%= pb_rails("caption", props: { margin_top: "sm", text: "First line full Second line blank: with address and housestyle and without address cont" }) %>
|
|
36
|
+
<%= pb_rails("home_address_street", props: {
|
|
37
|
+
address: "70 Prospect Ave",
|
|
38
|
+
city: "West Chester",
|
|
39
|
+
home_id: 8250263,
|
|
40
|
+
home_url: "https://powerhrg.com/",
|
|
41
|
+
house_style: "Colonial",
|
|
42
|
+
state: "PA",
|
|
43
|
+
zipcode: "19382",
|
|
44
|
+
territory: "PHL",
|
|
45
|
+
}) %>
|
|
46
|
+
|
|
47
|
+
<%= pb_rails("caption", props: { margin_top: "sm", text: "First line half blank Second line full: without address and with housestyle and address cont" }) %>
|
|
48
|
+
<%= pb_rails("home_address_street", props: {
|
|
49
|
+
address_cont: "Apt M18",
|
|
50
|
+
city: "West Chester",
|
|
51
|
+
home_id: 8250263,
|
|
52
|
+
home_url: "https://powerhrg.com/",
|
|
53
|
+
house_style: "Colonial",
|
|
54
|
+
state: "PA",
|
|
55
|
+
zipcode: "19382",
|
|
56
|
+
territory: "PHL",
|
|
57
|
+
}) %>
|
|
58
|
+
|
|
59
|
+
<%= pb_rails("caption", props: { margin_top: "sm", text: "First line blank Second line full: with address cont and without address and housestyle" }) %>
|
|
60
|
+
<%= pb_rails("home_address_street", props: {
|
|
61
|
+
address_cont: "Apt M18",
|
|
62
|
+
city: "West Chester",
|
|
63
|
+
home_id: 8250263,
|
|
64
|
+
home_url: "https://powerhrg.com/",
|
|
65
|
+
state: "PA",
|
|
66
|
+
zipcode: "19382",
|
|
67
|
+
territory: "PHL",
|
|
68
|
+
}) %>
|
|
69
|
+
|
|
70
|
+
<%= pb_rails("caption", props: { margin_top: "sm", text: "Emphasis, Modified, Target and Formatted doc examples below" }) %>
|
|
71
|
+
<%= pb_rails("home_address_street", props: {
|
|
72
|
+
address: "70 Prospect Ave",
|
|
73
|
+
city: "West Chester",
|
|
74
|
+
emphasis: "none",
|
|
75
|
+
home_id: 8250263,
|
|
76
|
+
home_url: "https://powerhrg.com/",
|
|
77
|
+
house_style: "Colonial",
|
|
78
|
+
margin_bottom: "sm",
|
|
79
|
+
state: "PA",
|
|
80
|
+
zipcode: "19382",
|
|
81
|
+
territory: "PHL",
|
|
82
|
+
}) %>
|
|
83
|
+
|
|
84
|
+
<%= pb_rails("home_address_street", props: {
|
|
85
|
+
city: "West Chester",
|
|
86
|
+
emphasis: "city",
|
|
87
|
+
home_id: 8250263,
|
|
88
|
+
home_url: "https://powerhrg.com/",
|
|
89
|
+
margin_bottom: "sm",
|
|
90
|
+
state: "PA",
|
|
91
|
+
zipcode: "19382",
|
|
92
|
+
territory: "PHL",
|
|
93
|
+
}) %>
|
|
94
|
+
|
|
95
|
+
<%= pb_rails("home_address_street", props: {
|
|
96
|
+
city: "West Chester",
|
|
97
|
+
emphasis: "none",
|
|
98
|
+
home_id: 8250263,
|
|
99
|
+
home_url: "https://powerhrg.com/",
|
|
100
|
+
margin_bottom: "sm",
|
|
101
|
+
state: "PA",
|
|
102
|
+
zipcode: "19382",
|
|
103
|
+
territory: "PHL",
|
|
104
|
+
}) %>
|
|
105
|
+
|
|
106
|
+
<%= pb_rails("home_address_street", props: {
|
|
107
|
+
address: "70 Prospect Ave",
|
|
108
|
+
city: "West Chester",
|
|
109
|
+
margin_bottom: "sm",
|
|
110
|
+
state: "PA",
|
|
111
|
+
zipcode: "19382",
|
|
112
|
+
territory: "PHL",
|
|
113
|
+
}) %>
|
|
114
|
+
|
|
115
|
+
<%= pb_rails("home_address_street", props: {
|
|
116
|
+
city: "West Chester",
|
|
117
|
+
home_id: 8250263,
|
|
118
|
+
home_url: "https://powerhrg.com/",
|
|
119
|
+
margin_bottom: "sm",
|
|
120
|
+
state: "PA",
|
|
121
|
+
target: "_blank",
|
|
122
|
+
zipcode: "19382",
|
|
123
|
+
territory: "PHL",
|
|
124
|
+
}) %>
|
|
125
|
+
|
|
126
|
+
<%= pb_rails("home_address_street", props: {
|
|
127
|
+
address: "70 pRoSpEcT ave",
|
|
128
|
+
city: "West Chester",
|
|
129
|
+
home_id: 8250263,
|
|
130
|
+
home_url: "https://powerhrg.com/",
|
|
131
|
+
preserve_case: true,
|
|
132
|
+
state: "pa",
|
|
133
|
+
zipcode: "19382",
|
|
134
|
+
territory: "PHL",
|
|
11
135
|
}) %>
|