playbook_ui 14.6.2.pre.alpha.PLAY15814384 → 14.7.0.pre.alpha.dependabotnpmandyarnintltelinput24704448
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +8 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +21 -28
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +37 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +13 -2
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +8 -7
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +37 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.tsx +67 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading_mixins.scss +40 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.jsx +51 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.md +1 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.jsx +26 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.md +1 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.jsx +11 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +59 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.md +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.jsx +20 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.md +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +13 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +12 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +8 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.test.jsx +81 -0
- data/app/pb_kits/playbook/utilities/_hover.scss +46 -43
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +1 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +5 -0
- data/dist/chunks/_typeahead-CFuWkfWK.js +22 -0
- data/dist/chunks/_weekday_stacked-OvN7ix-I.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +4 -1
- data/dist/playbook-doc.js +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/hover.rb +4 -1
- data/lib/playbook/version.rb +2 -2
- metadata +22 -4
- data/dist/chunks/_typeahead-C-6MLSyC.js +0 -22
- data/dist/chunks/_weekday_stacked-CFhGhr9V.js +0 -45
@@ -0,0 +1,81 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '@testing-library/react'
|
3
|
+
import { ensureAccessible } from '../utilities/test-utils'
|
4
|
+
import { SkeletonLoading } from 'playbook-ui'
|
5
|
+
|
6
|
+
/* See these resources for more testing info:
|
7
|
+
- https://github.com/testing-library/jest-dom#usage for useage and examples
|
8
|
+
- https://jestjs.io/docs/en/using-matchers
|
9
|
+
*/
|
10
|
+
|
11
|
+
describe('SkeletonLoading', () => {
|
12
|
+
const defaultProps = {
|
13
|
+
data: { testid: 'skeleton-loading' }
|
14
|
+
}
|
15
|
+
|
16
|
+
it('should be accessible', async () => {
|
17
|
+
ensureAccessible(SkeletonLoading, defaultProps)
|
18
|
+
})
|
19
|
+
|
20
|
+
it('renders with default props', () => {
|
21
|
+
const { container } = render(<SkeletonLoading {...defaultProps} />)
|
22
|
+
const skeleton = screen.getByTestId('skeleton-loading')
|
23
|
+
|
24
|
+
expect(skeleton).toBeInTheDocument()
|
25
|
+
expect(skeleton).toHaveClass('pb_skeleton_loading')
|
26
|
+
expect(container.querySelectorAll('div[class*="border_radius_"]')).toHaveLength(1)
|
27
|
+
})
|
28
|
+
|
29
|
+
it('renders multiple skeleton items based on stack prop', () => {
|
30
|
+
const props = {
|
31
|
+
...defaultProps,
|
32
|
+
stack: 3
|
33
|
+
}
|
34
|
+
const { container } = render(<SkeletonLoading {...props} />)
|
35
|
+
|
36
|
+
expect(container.querySelectorAll('div[class*="border_radius_"]')).toHaveLength(3)
|
37
|
+
})
|
38
|
+
|
39
|
+
it('applies custom styles correctly', () => {
|
40
|
+
const props = {
|
41
|
+
...defaultProps,
|
42
|
+
height: '24px',
|
43
|
+
width: '50%',
|
44
|
+
borderRadius: 'lg',
|
45
|
+
color: 'light',
|
46
|
+
dark: true
|
47
|
+
}
|
48
|
+
const { container } = render(<SkeletonLoading {...props} />)
|
49
|
+
const skeletonItem = container.querySelector('div[class*="border_radius_"]')
|
50
|
+
|
51
|
+
expect(skeletonItem).toHaveClass('border_radius_lg')
|
52
|
+
expect(skeletonItem).toHaveClass('dark')
|
53
|
+
})
|
54
|
+
|
55
|
+
it('applies gap class to items after first one', () => {
|
56
|
+
const props = {
|
57
|
+
...defaultProps,
|
58
|
+
stack: 3,
|
59
|
+
gap: 'md'
|
60
|
+
}
|
61
|
+
const { container } = render(<SkeletonLoading {...props} />)
|
62
|
+
const skeletonItems = container.querySelectorAll('div[class*="border_radius_"]')
|
63
|
+
|
64
|
+
expect(skeletonItems[0]).not.toHaveClass('gap_md')
|
65
|
+
expect(skeletonItems[1]).toHaveClass('gap_md')
|
66
|
+
expect(skeletonItems[2]).toHaveClass('gap_md')
|
67
|
+
})
|
68
|
+
|
69
|
+
it('handles no gap properly', () => {
|
70
|
+
const props = {
|
71
|
+
...defaultProps,
|
72
|
+
stack: 2,
|
73
|
+
gap: 'none'
|
74
|
+
}
|
75
|
+
const { container } = render(<SkeletonLoading {...props} />)
|
76
|
+
const skeletonItems = container.querySelectorAll('div[class*="border_radius_"]')
|
77
|
+
|
78
|
+
expect(skeletonItems[0]).not.toHaveClass('gap_none')
|
79
|
+
expect(skeletonItems[1]).not.toHaveClass('gap_none')
|
80
|
+
})
|
81
|
+
})
|
@@ -1,51 +1,54 @@
|
|
1
1
|
@import "../tokens/exports/scale.module";
|
2
2
|
|
3
|
-
@mixin hover-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
.hover_color_#{"" + $name}:hover {
|
10
|
-
color: $color !important;
|
11
|
-
transition: color $transition-speed ease;
|
12
|
-
}
|
3
|
+
@mixin hover-scale-classes($scales-list) {
|
4
|
+
@each $name, $scale in $scales-list {
|
5
|
+
.hover_#{"" + $name}:hover,
|
6
|
+
.group_hover:hover .group_hover.hover_#{"" + $name} {
|
7
|
+
transform: $scale;
|
8
|
+
transition: transform $transition-speed ease;
|
13
9
|
}
|
14
10
|
}
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
}
|
12
|
+
|
13
|
+
@mixin hover-shadow-classes($shadows-list) {
|
14
|
+
@each $name, $shadow in $shadows-list {
|
15
|
+
.hover_#{"" + $name}:hover,
|
16
|
+
.group_hover:hover .group_hover.hover_#{"" + $name} {
|
17
|
+
box-shadow: $shadow;
|
18
|
+
transition: box-shadow $transition-speed ease;
|
22
19
|
}
|
23
20
|
}
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
}
|
22
|
+
|
23
|
+
@mixin hover-color-classes($colors-list) {
|
24
|
+
@each $name, $color in $colors-list {
|
25
|
+
.hover_background_#{"" + $name}:hover,
|
26
|
+
.group_hover:hover .group_hover.hover_background_#{"" + $name} {
|
27
|
+
background-color: $color !important;
|
28
|
+
transition: background-color $transition-speed ease;
|
29
|
+
}
|
30
|
+
.hover_color_#{"" + $name}:hover,
|
31
|
+
.group_hover:hover .group_hover.hover_color_#{"" + $name} {
|
32
|
+
color: $color !important;
|
33
|
+
transition: color $transition-speed ease;
|
31
34
|
}
|
32
35
|
}
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
36
|
+
}
|
37
|
+
|
38
|
+
@include hover-scale-classes($scales);
|
39
|
+
@include hover-shadow-classes($box_shadows);
|
40
|
+
@include hover-color-classes($product_colors);
|
41
|
+
@include hover-color-classes($status_colors);
|
42
|
+
@include hover-color-classes($data_colors);
|
43
|
+
@include hover-color-classes($shadow_colors);
|
44
|
+
@include hover-color-classes($colors);
|
45
|
+
@include hover-color-classes($interface_colors);
|
46
|
+
@include hover-color-classes($main_colors);
|
47
|
+
@include hover-color-classes($background_colors);
|
48
|
+
@include hover-color-classes($card_colors);
|
49
|
+
@include hover-color-classes($active_colors);
|
50
|
+
@include hover-color-classes($action_colors);
|
51
|
+
@include hover-color-classes($hover_colors);
|
52
|
+
@include hover-color-classes($border_colors);
|
53
|
+
@include hover-color-classes($text_colors);
|
54
|
+
@include hover-color-classes($category_colors);
|
@@ -66,6 +66,10 @@ type Hover = Shadow & {
|
|
66
66
|
scale?: "sm" | "md" | "lg"
|
67
67
|
}
|
68
68
|
|
69
|
+
type GroupHover = {
|
70
|
+
groupHover?: boolean,
|
71
|
+
}
|
72
|
+
|
69
73
|
type JustifyContent = {
|
70
74
|
justifyContent?: Alignment & Space
|
71
75
|
}
|
@@ -221,6 +225,7 @@ const filterClassName = (value: string): string => {
|
|
221
225
|
// Prop categories
|
222
226
|
const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} = {
|
223
227
|
|
228
|
+
groupHoverProps: ({ groupHover }: GroupHover ) => groupHover ? 'group_hover ' : '',
|
224
229
|
hoverProps: ({ hover }: { hover?: Hover }) => {
|
225
230
|
let css = '';
|
226
231
|
if (!hover) return css;
|