playbook_ui 15.3.0.pre.alpha.PLAY2407daterangeinlineshowcurrentyear12138 → 15.3.0.pre.alpha.PLAY2532flexboxdefaultresponsive12209

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +1 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +4 -4
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +5 -5
  5. data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +2 -2
  6. data/app/pb_kits/playbook/pb_advanced_table/index.js +7 -7
  7. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +2 -2
  8. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -1
  9. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +13 -20
  10. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.rb +4 -6
  11. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +0 -17
  12. data/app/pb_kits/playbook/pb_date_range_inline/docs/_description.md +1 -1
  13. data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +2 -3
  14. data/app/pb_kits/playbook/pb_date_range_inline/docs/index.js +0 -1
  15. data/app/pb_kits/playbook/pb_form/pb_form_validation.js +44 -11
  16. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +110 -17
  17. data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
  18. data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
  19. data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
  20. data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
  21. data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
  22. data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
  23. data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
  24. data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
  25. data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
  26. data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
  27. data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
  28. data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
  29. data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
  30. data/dist/chunks/{_line_graph-BRirnhGy.js → _line_graph-9bI76O2f.js} +1 -1
  31. data/dist/chunks/_typeahead-By0NwDwL.js +6 -0
  32. data/dist/chunks/{_weekday_stacked-DEkzyJsS.js → _weekday_stacked-ClJbIaDx.js} +2 -2
  33. data/dist/chunks/pb_form_validation-BNfSnIUF.js +1 -0
  34. data/dist/chunks/vendor.js +1 -1
  35. data/dist/playbook-doc.js +1 -1
  36. data/dist/playbook-rails-react-bindings.js +1 -1
  37. data/dist/playbook-rails.js +1 -1
  38. data/dist/playbook.css +1 -1
  39. data/lib/playbook/version.rb +1 -1
  40. metadata +6 -9
  41. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.html.erb +0 -4
  42. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.jsx +0 -43
  43. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_show_current_year.md +0 -1
  44. data/dist/chunks/_typeahead-CFOqvZNu.js +0 -6
  45. data/dist/chunks/pb_form_validation-BZppqQZM.js +0 -1
@@ -55,7 +55,6 @@ const formatToGlobalCountryName = (countryName: string) => {
55
55
 
56
56
  const formatAllCountries = () => {
57
57
  const countryData = intlTelInput.getCountryData()
58
-
59
58
  for (let i = 0; i < countryData.length; i++) {
60
59
  const country = countryData[i]
61
60
  country.name = formatToGlobalCountryName(country.name)
@@ -110,18 +109,54 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
110
109
 
111
110
  const inputRef = useRef<HTMLInputElement | null>(null)
112
111
  const itiRef = useRef<any>(null);
112
+ const wrapperRef = useRef<HTMLDivElement | null>(null);
113
113
  const [inputValue, setInputValue] = useState(value)
114
114
  const [error, setError] = useState(props.error || "")
115
115
  const [dropDownIsOpen, setDropDownIsOpen] = useState(false)
116
116
  const [selectedData, setSelectedData] = useState()
117
117
  const [hasTyped, setHasTyped] = useState(false)
118
+ const [formSubmitted, setFormSubmitted] = useState(false)
119
+ const [hasStartedValidating, setHasStartedValidating] = useState(false)
120
+
121
+ // Only sync initial error from props, not continuous updates
122
+ // Once validation starts, internal validation takes over
123
+ useEffect(() => {
124
+ if (props.error && !hasStartedValidating) {
125
+ setError(props.error)
126
+ // If there's an initial error from props, mark as submitted so it shows
127
+ if (props.error) {
128
+ setFormSubmitted(true)
129
+ }
130
+ }
131
+ }, [props.error, hasStartedValidating])
132
+
133
+ // Function to update validation state on the wrapper element
134
+ // Only applies when input is required
135
+ const updateValidationState = (hasError: boolean) => {
136
+ if (wrapperRef.current && required) {
137
+ if (hasError) {
138
+ wrapperRef.current.setAttribute('data-pb-phone-validation-error', 'true')
139
+ } else {
140
+ wrapperRef.current.removeAttribute('data-pb-phone-validation-error')
141
+ }
142
+ }
143
+ }
144
+
145
+ // Determine which error to display
146
+ // Show internal errors on blur (hasTyped) or on form submission (formSubmitted)
147
+ const shouldShowInternalError = (hasTyped || formSubmitted) && required && error
148
+ const displayError = shouldShowInternalError ? error : ""
118
149
 
119
150
  useEffect(() => {
120
- if ((error ?? '').length > 0) {
151
+ const hasError = (error ?? '').length > 0
152
+ if (hasError) {
121
153
  onValidate(false)
122
154
  } else {
123
155
  onValidate(true)
124
156
  }
157
+
158
+ // Update validation state whenever error changes
159
+ updateValidationState(hasError)
125
160
  }, [error, onValidate])
126
161
 
127
162
  const unformatNumber = (formattedNumber: any) => {
@@ -137,6 +172,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
137
172
 
138
173
  const validateTooLongNumber = (itiInit: any) => {
139
174
  if (!itiInit) return
175
+
140
176
  if (itiInit.getValidationError() === ValidationError.TooLong) {
141
177
  return showFormattedError('too long')
142
178
  } else {
@@ -146,13 +182,11 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
146
182
 
147
183
  const validateTooShortNumber = (itiInit: any) => {
148
184
  if (!itiInit) return
149
-
150
185
  // If field is empty, don't show "too short" error
151
186
  if (!inputValue || inputValue.trim() === '') {
152
187
  setError('')
153
188
  return false
154
189
  }
155
-
156
190
  if (itiInit.getValidationError() === ValidationError.TooShort) {
157
191
  return showFormattedError('too short')
158
192
  } else {
@@ -172,7 +206,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
172
206
  }
173
207
 
174
208
  const validateUnhandledError = (itiInit: any) => {
175
- if (!itiInit) return
209
+ if (!required || !itiInit) return
176
210
  if (itiInit.getValidationError() === ValidationError.SomethingWentWrong) {
177
211
  if (inputValue.length === 1) {
178
212
  return showFormattedError('too short')
@@ -184,7 +218,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
184
218
  }
185
219
  }
186
220
  }
187
-
188
221
  const validateMissingAreaCode = (itiInit: any) => {
189
222
  if (!itiInit) return
190
223
  if (itiInit.getValidationError() === ValidationError.MissingAreaCode) {
@@ -201,8 +234,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
201
234
  }
202
235
  }
203
236
 
237
+ // Validation for required empty fields
204
238
  const validateRequiredField = () => {
205
- if (!inputValue || inputValue.trim() === '') {
239
+ if (required && (!inputValue || inputValue.trim() === '')) {
206
240
  setError('Missing phone number')
207
241
  return true
208
242
  }
@@ -210,14 +244,24 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
210
244
  }
211
245
 
212
246
  const validateErrors = () => {
213
- // If field is empty, show error message
247
+ // Signal validation has started, so prop errors won't override internal validation
248
+ if (!hasStartedValidating) {
249
+ setHasStartedValidating(true)
250
+ }
251
+
252
+ // If field is empty, only show required field error if applicable
214
253
  if (!inputValue || inputValue.trim() === '') {
215
254
  if (validateRequiredField()) return
255
+ // Clear any existing errors if field is empty and not required
256
+ if (!required) {
257
+ setError('')
258
+ }
216
259
  return
217
260
  }
218
261
 
219
- if (!hasTyped && !error) return
262
+ if (!hasTyped && !error) return
220
263
 
264
+ // Run validation checks
221
265
  if (itiRef.current) isValid(itiRef.current.isValidNumber())
222
266
  if (validateOnlyNumbers(itiRef.current)) return
223
267
  if (validateTooLongNumber(itiRef.current)) return
@@ -227,6 +271,29 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
227
271
  if (validateRepeatCountryCode(itiRef.current)) return
228
272
  }
229
273
 
274
+ // Add listener for form validation to track when validation should be shown
275
+ useEffect(() => {
276
+ const handleInvalid = (event: Event) => {
277
+ const target = event.target as HTMLInputElement
278
+ const phoneNumberContainer = target.closest('.pb_phone_number_input')
279
+
280
+ if (phoneNumberContainer && phoneNumberContainer === wrapperRef.current) {
281
+ const invalidInputName = target.name || target.getAttribute('name')
282
+ if (invalidInputName === name) {
283
+ setFormSubmitted(true)
284
+ // Trigger validation when form is submitted
285
+ validateErrors()
286
+ }
287
+ }
288
+ }
289
+
290
+ document.addEventListener('invalid', handleInvalid, true)
291
+
292
+ return () => {
293
+ document.removeEventListener('invalid', handleInvalid, true)
294
+ }
295
+ }, [name, inputValue])
296
+
230
297
  /*
231
298
  useImperativeHandle exposes the kit's input element to a parent component via a ref.
232
299
  See the Playbook docs for use cases.
@@ -238,6 +305,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
238
305
  setInputValue("")
239
306
  setError("")
240
307
  setHasTyped(false)
308
+ setFormSubmitted(false)
309
+ setHasStartedValidating(false)
310
+ // Only clear validation state if field was required
311
+ if (required) {
312
+ updateValidationState(false)
313
+ }
241
314
  },
242
315
  inputNode() {
243
316
  return inputRef.current
@@ -247,6 +320,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
247
320
  // Run validation and return error message or true
248
321
  const isEmpty = !inputValue || inputValue.trim() === ''
249
322
 
323
+ if (required && isEmpty) {
324
+ setError('Missing phone number')
325
+ setFormSubmitted(true)
326
+ return 'Missing phone number'
327
+ }
328
+
250
329
  if (isEmpty) {
251
330
  // Show missing phone number error
252
331
  const errorMessage = 'Missing phone number'
@@ -266,6 +345,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
266
345
  const countryName = itiRef.current.getSelectedCountryData().name
267
346
  const errorMessage = `Invalid ${countryName} phone number (repeat country code)`
268
347
  setError(errorMessage)
348
+ setFormSubmitted(true)
269
349
  setHasTyped(true)
270
350
  return errorMessage
271
351
  }
@@ -275,6 +355,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
275
355
  const countryName = itiRef.current.getSelectedCountryData().name
276
356
  const errorMessage = `Invalid ${countryName} phone number (enter numbers only)`
277
357
  setError(errorMessage)
358
+ setFormSubmitted(true)
278
359
  setHasTyped(true)
279
360
  return errorMessage
280
361
  }
@@ -295,7 +376,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
295
376
  errorMessage = `Invalid ${countryName} phone number`
296
377
  }
297
378
 
379
+ // Set the error state so the validation attribute gets added
298
380
  setError(errorMessage)
381
+ setFormSubmitted(true)
299
382
  setHasTyped(true)
300
383
 
301
384
  return errorMessage
@@ -314,11 +397,16 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
314
397
 
315
398
  const handleOnChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
316
399
  if (!hasTyped) setHasTyped(true)
317
-
318
400
  setInputValue(evt.target.value)
319
401
 
402
+ // Reset form submitted state when user types
403
+ if (formSubmitted) {
404
+ setFormSubmitted(false)
405
+ }
406
+
320
407
  let phoneNumberData
321
408
 
409
+ // Handle formatAsYouType with input event
322
410
  if (formatAsYouType) {
323
411
  const formattedPhoneNumberData = getCurrentSelectedData(itiRef.current, evt.target.value)
324
412
  phoneNumberData = {...formattedPhoneNumberData, number: unformatNumber(formattedPhoneNumberData.number)}
@@ -329,12 +417,15 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
329
417
  setSelectedData(phoneNumberData)
330
418
  onChange(phoneNumberData)
331
419
  isValid(itiRef.current.isValidNumber())
420
+
421
+ // Trigger validation after onChange for React Hook Form
422
+ // This ensures validation state is up-to-date
423
+ setTimeout(() => validateErrors(), 0)
332
424
  }
333
425
 
334
426
  // Separating Concerns as React Docs Recommend
335
427
  // This also Fixes things for our react_component rendering on the Rails Side
336
428
  useEffect(formatAllCountries, [])
337
-
338
429
  // If an initial country is not specified, the "globe" icon will show
339
430
  // Always set a country
340
431
  const fallbackCountry =
@@ -375,9 +466,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
375
466
  inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
376
467
  inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
377
468
 
378
- // Handle formatAsYouType with input event
379
- if (formatAsYouType) {
380
- inputRef.current.addEventListener("input", (evt: Event) => {
469
+ // Handle formatAsYouType with input event
470
+ if (formatAsYouType) {
471
+ inputRef.current.addEventListener("input", (evt: Event) => {
381
472
  const target = evt.target as HTMLInputElement
382
473
  const formattedValue = target.value
383
474
 
@@ -396,13 +487,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
396
487
  }
397
488
  }
398
489
  }, [])
399
-
400
490
  let textInputProps: {[key: string]: any} = {
401
491
  className: dropDownIsOpen ? 'dropdown_open' : '',
402
492
  dark,
403
493
  "data-phone-number": JSON.stringify(selectedData),
404
494
  disabled,
405
- error: hasTyped ? error : props.error,
495
+ error: hasTyped ? error : props.error || displayError,
406
496
  type: 'tel',
407
497
  id,
408
498
  label,
@@ -412,7 +502,10 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
412
502
  value: inputValue
413
503
  }
414
504
 
415
- let wrapperProps: Record<string, unknown> = { className: classes }
505
+ let wrapperProps: Record<string, unknown> = {
506
+ className: classes,
507
+ ref: wrapperRef
508
+ }
416
509
 
417
510
  if (!isEmpty(aria)) textInputProps = {...textInputProps, ...ariaProps}
418
511
  if (!isEmpty(data)) wrapperProps = {...wrapperProps, ...dataProps}
@@ -213,10 +213,24 @@ export type GlobalProps = AlignContent & AlignItems & AlignSelf &
213
213
 
214
214
  const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
215
215
  const keys: string[] = Object.keys(prop)
216
- return keys.map((size: Sizes) => {
217
- const propValue: string = typeof(prop[size]) === 'string' ? camelToSnakeCase(prop[size]) : prop[size]
218
- return `${classPrefix}_${size}_${propValue}`
219
- }).join(" ")
216
+ const screenSizeValues = ["xs", "sm", "md", "lg", "xl"]
217
+ let classResult = ''
218
+
219
+ // Handle default value separately (generates base class without size prefix)
220
+ if (prop.default !== undefined) {
221
+ const defaultValue: string = typeof(prop.default) === 'string' ? camelToSnakeCase(prop.default) : prop.default
222
+ classResult += `${classPrefix}_${defaultValue} `
223
+ }
224
+
225
+ // Handle responsive sizes (generates classes with size prefix)
226
+ keys.forEach((key) => {
227
+ if (screenSizeValues.includes(key)) {
228
+ const propValue: string = typeof(prop[key]) === 'string' ? camelToSnakeCase(prop[key]) : prop[key]
229
+ classResult += `${classPrefix}_${key}_${propValue} `
230
+ }
231
+ })
232
+
233
+ return classResult.trim()
220
234
  }
221
235
 
222
236
  //reusable function for top, bottom, right and left props
@@ -436,9 +450,11 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
436
450
  if (typeof zIndexEntry[1] == "number") {
437
451
  css += `z_index_${zIndexEntry[1]} `
438
452
  } else if (typeof zIndexEntry[1] == "object") {
439
- Object.entries(zIndexEntry[1]).forEach((zIndexObj) => {
440
- css += `z_index_${zIndexObj[0]}_${zIndexObj[1]} `
453
+ const responsiveObj: {[key: string]: string} = {}
454
+ Object.entries(zIndexEntry[1]).forEach(([key, value]) => {
455
+ responsiveObj[key] = value.toString()
441
456
  })
457
+ css += getResponsivePropClasses(responsiveObj, 'z_index')
442
458
  } else if (zIndexEntry[1] === 'max') {
443
459
  css += `z_index_max `
444
460
  }
@@ -463,9 +479,11 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
463
479
  if (typeof displayEntry[1] == "string") {
464
480
  css += `display_${displayEntry[1]} `
465
481
  } else if (typeof displayEntry[1] == "object") {
466
- Object.entries(displayEntry[1]).forEach((displayObj) => {
467
- css += `display_${displayObj[0]}_${displayObj[1]} `
482
+ const responsiveObj: {[key: string]: string} = {}
483
+ Object.entries(displayEntry[1]).forEach(([key, value]) => {
484
+ responsiveObj[key] = typeof value === 'string' ? value : value.toString()
468
485
  })
486
+ css += getResponsivePropClasses(responsiveObj, 'display')
469
487
  } else {
470
488
  ' '
471
489
  }
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ alignContent={{ default: "spaceAround", xs: "center", sm: "spaceAround", md: "center" }}
44
+ data={{ testid: testId }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`align_content_space_around`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`align_content_xs_center`)
53
+ expect(kit).toHaveClass(`align_content_sm_space_around`)
54
+ expect(kit).toHaveClass(`align_content_md_center`)
55
+ })
@@ -34,3 +34,21 @@ test('Global Props: returns proper class name', () => {
34
34
  })
35
35
  }
36
36
  })
37
+
38
+ test('Global Props: returns proper class name with default key', () => {
39
+ const testId = `${testSubject}-default-responsive`
40
+ render(
41
+ <Body
42
+ alignItems={{ default: "end", xs: "center", sm: "end", md: "center" }}
43
+ data={{ testid: testId }}
44
+ text="Hi"
45
+ />
46
+ )
47
+ const kit = screen.getByTestId(testId)
48
+ // Should have base class for default value
49
+ expect(kit).toHaveClass(`align_items_end`)
50
+ // Should have responsive classes for screen sizes
51
+ expect(kit).toHaveClass(`align_items_xs_center`)
52
+ expect(kit).toHaveClass(`align_items_sm_end`)
53
+ expect(kit).toHaveClass(`align_items_md_center`)
54
+ })
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ alignSelf={{ default: "end", xs: "center", sm: "end", md: "center" }}
44
+ data={{ testid: testId }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`align_self_end`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`align_self_xs_center`)
53
+ expect(kit).toHaveClass(`align_self_sm_end`)
54
+ expect(kit).toHaveClass(`align_self_md_center`)
55
+ })
@@ -36,3 +36,21 @@ test('Global Props: returns proper class name', () => {
36
36
  })
37
37
  }
38
38
  })
39
+
40
+ test('Global Props: returns proper class name with default key', () => {
41
+ const testId = `${testSubject}-default-responsive`
42
+ render(
43
+ <Body
44
+ data={{ testid: testId }}
45
+ display={{ default: "none", xs: "block", sm: "none", md: "block" }}
46
+ text="Hi"
47
+ />
48
+ )
49
+ const kit = screen.getByTestId(testId)
50
+ // Should have base class for default value
51
+ expect(kit).toHaveClass(`display_none`)
52
+ // Should have responsive classes for screen sizes
53
+ expect(kit).toHaveClass(`display_xs_block`)
54
+ expect(kit).toHaveClass(`display_sm_none`)
55
+ expect(kit).toHaveClass(`display_md_block`)
56
+ })
@@ -62,3 +62,21 @@ test('Global Props: returns proper class name', () => {
62
62
  })
63
63
  }
64
64
  })
65
+
66
+ test('Global Props: returns proper class name with default key', () => {
67
+ const testId = `${testSubject}-default-responsive`
68
+ render(
69
+ <Body
70
+ data={{ testid: testId }}
71
+ flex={{ default: "3", xs: "1", sm: "3", md: "1" }}
72
+ text="Hi"
73
+ />
74
+ )
75
+ const kit = screen.getByTestId(testId)
76
+ // Should have base class for default value
77
+ expect(kit).toHaveClass(`flex_3`)
78
+ // Should have responsive classes for screen sizes
79
+ expect(kit).toHaveClass(`flex_xs_1`)
80
+ expect(kit).toHaveClass(`flex_sm_3`)
81
+ expect(kit).toHaveClass(`flex_md_1`)
82
+ })
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ data={{ testid: testId }}
44
+ flexDirection={{ default: "column", xs: "row", sm: "column", md: "row" }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`flex_direction_column`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`flex_direction_xs_row`)
53
+ expect(kit).toHaveClass(`flex_direction_sm_column`)
54
+ expect(kit).toHaveClass(`flex_direction_md_row`)
55
+ })
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
33
33
  })
34
34
  }
35
35
  })
36
+
37
+ test('Global Props: returns proper class name with default key', () => {
38
+ const testId = `${testSubject}-default-responsive`
39
+ render(
40
+ <Body
41
+ data={{ testid: testId }}
42
+ flexGrow={{ default: 1, xs: 0, sm: 1, md: 0 }}
43
+ text="Hi"
44
+ />
45
+ )
46
+ const kit = screen.getByTestId(testId)
47
+ // Should have base class for default value
48
+ expect(kit).toHaveClass(`flex_grow_1`)
49
+ // Should have responsive classes for screen sizes
50
+ expect(kit).toHaveClass(`flex_grow_xs_0`)
51
+ expect(kit).toHaveClass(`flex_grow_sm_1`)
52
+ expect(kit).toHaveClass(`flex_grow_md_0`)
53
+ })
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
33
33
  })
34
34
  }
35
35
  })
36
+
37
+ test('Global Props: returns proper class name with default key', () => {
38
+ const testId = `${testSubject}-default-responsive`
39
+ render(
40
+ <Body
41
+ data={{ testid: testId }}
42
+ flexShrink={{ default: 0, xs: 1, sm: 0, md: 1 }}
43
+ text="Hi"
44
+ />
45
+ )
46
+ const kit = screen.getByTestId(testId)
47
+ // Should have base class for default value
48
+ expect(kit).toHaveClass(`flex_shrink_0`)
49
+ // Should have responsive classes for screen sizes
50
+ expect(kit).toHaveClass(`flex_shrink_xs_1`)
51
+ expect(kit).toHaveClass(`flex_shrink_sm_0`)
52
+ expect(kit).toHaveClass(`flex_shrink_md_1`)
53
+ })
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ data={{ testid: testId }}
44
+ flexWrap={{ default: "wrap", xs: "nowrap", sm: "wrap", md: "nowrap" }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`flex_wrap_wrap`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`flex_wrap_xs_nowrap`)
53
+ expect(kit).toHaveClass(`flex_wrap_sm_wrap`)
54
+ expect(kit).toHaveClass(`flex_wrap_md_nowrap`)
55
+ })
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ data={{ testid: testId }}
44
+ justifyContent={{ default: "spaceBetween", xs: "start", sm: "spaceBetween", md: "start" }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`justify_content_space_between`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`justify_content_xs_start`)
53
+ expect(kit).toHaveClass(`justify_content_sm_space_between`)
54
+ expect(kit).toHaveClass(`justify_content_md_start`)
55
+ })
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ data={{ testid: testId }}
44
+ justifySelf={{ default: "end", xs: "start", sm: "end", md: "center" }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`justify_self_end`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`justify_self_xs_start`)
53
+ expect(kit).toHaveClass(`justify_self_sm_end`)
54
+ expect(kit).toHaveClass(`justify_self_md_center`)
55
+ })
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
33
33
  })
34
34
  }
35
35
  })
36
+
37
+ test('Global Props: returns proper class name with default key', () => {
38
+ const testId = `${testSubject}-default-responsive`
39
+ render(
40
+ <Body
41
+ data={{ testid: testId }}
42
+ order={{ default: 3, xs: 1, sm: 3, md: 1 }}
43
+ text="Hi"
44
+ />
45
+ )
46
+ const kit = screen.getByTestId(testId)
47
+ // Should have base class for default value
48
+ expect(kit).toHaveClass(`flex_order_3`)
49
+ // Should have responsive classes for screen sizes
50
+ expect(kit).toHaveClass(`flex_order_xs_1`)
51
+ expect(kit).toHaveClass(`flex_order_sm_3`)
52
+ expect(kit).toHaveClass(`flex_order_md_1`)
53
+ })