playbook_ui 14.7.0.pre.alpha.dependabotnpmandyarnfloatinguireact026284532 → 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/pb_card/docs/_card_light.md +1 -1
- data/app/pb_kits/playbook/pb_date/_date.scss +0 -3
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +1 -17
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +175 -88
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +47 -79
- data/app/pb_kits/playbook/pb_drawer/drawer.test.jsx +16 -20
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +1 -43
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +2 -6
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +3 -5
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_timeline/timeline.rb +1 -11
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +4 -4
- data/app/pb_kits/playbook/utilities/_hover.scss +27 -40
- data/app/pb_kits/playbook/utilities/globalProps.ts +3 -5
- data/dist/chunks/_typeahead-CFuWkfWK.js +22 -0
- data/dist/chunks/_weekday_stacked-OvN7ix-I.js +45 -0
- data/dist/chunks/{lib-BC6ESsxG.js → lib-D-mTv-kp.js} +1 -1
- data/dist/chunks/{pb_form_validation-B_Z9rEbg.js → pb_form_validation-BkWGwJsl.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +1 -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 +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -25
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.html.erb +0 -42
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.jsx +0 -44
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_default_date.md +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.html.erb +0 -26
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.md +0 -7
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +0 -38
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +0 -19
- data/app/pb_kits/playbook/pb_draggable/draggable.html.erb +0 -3
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +0 -18
- data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +0 -3
- data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +0 -15
- data/app/pb_kits/playbook/pb_draggable/draggable_item.html.erb +0 -7
- data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +0 -18
- data/app/pb_kits/playbook/pb_draggable/index.js +0 -125
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb +0 -94
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx +0 -180
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md +0 -1
- data/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +0 -79
- data/dist/chunks/_typeahead-CEqbLlRy.js +0 -22
- data/dist/chunks/_weekday_stacked-BiF9GqI1.js +0 -45
@@ -1,12 +1,8 @@
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
2
2
|
import classnames from "classnames";
|
3
|
+
import Modal from "react-modal";
|
3
4
|
|
4
|
-
import {
|
5
|
-
buildAriaProps,
|
6
|
-
buildCss,
|
7
|
-
buildDataProps,
|
8
|
-
buildHtmlProps,
|
9
|
-
} from "../utilities/props";
|
5
|
+
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
10
6
|
import { globalProps } from "../utilities/globalProps";
|
11
7
|
|
12
8
|
import { DialogContext } from "../pb_dialog/_dialog_context";
|
@@ -57,19 +53,13 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
|
|
57
53
|
let globalPropsString: string = globalProps(props);
|
58
54
|
|
59
55
|
// Check if the string contains any of the prefixes
|
60
|
-
const containsPrefix = [
|
61
|
-
|
62
|
-
|
63
|
-
"pt_",
|
64
|
-
"pl_",
|
65
|
-
"pr_",
|
66
|
-
"px_",
|
67
|
-
"py_",
|
68
|
-
].some((prefix) => globalPropsString.includes(prefix));
|
56
|
+
const containsPrefix = ['p_', 'pb_', 'pt_', 'pl_', 'pr_', 'px_', 'py_'].some((prefix) =>
|
57
|
+
globalPropsString.includes(prefix)
|
58
|
+
);
|
69
59
|
|
70
60
|
// If none of the prefixes are found, append 'p_sm' to the string
|
71
61
|
if (!containsPrefix) {
|
72
|
-
globalPropsString +=
|
62
|
+
globalPropsString += ' p_sm';
|
73
63
|
}
|
74
64
|
|
75
65
|
const drawerClassNames = {
|
@@ -77,9 +67,9 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
|
|
77
67
|
"pb_drawer",
|
78
68
|
buildCss("pb_drawer", size, placement),
|
79
69
|
{
|
80
|
-
drawer_border_full: border === "full",
|
81
|
-
drawer_border_right: border === "right",
|
82
|
-
drawer_border_left: border === "left",
|
70
|
+
"drawer_border_full": border === "full",
|
71
|
+
"drawer_border_right": border === "right",
|
72
|
+
"drawer_border_left": border === "left",
|
83
73
|
}
|
84
74
|
)} ${globalPropsString}`,
|
85
75
|
afterOpen: "pb_drawer_after_open",
|
@@ -92,18 +82,19 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
|
|
92
82
|
};
|
93
83
|
|
94
84
|
const overlayClassNames = {
|
95
|
-
base: `pb_drawer${overlay ?
|
96
|
-
fullHeight !== null && fullHeightClassNames()
|
97
|
-
} ${!overlay ? "no-background" : ""}`,
|
85
|
+
base: `pb_drawer${overlay ? '_overlay' : '_no_overlay'} ${fullHeight !== null && fullHeightClassNames()} ${!overlay ? 'no-background' : ''}`,
|
98
86
|
afterOpen: "pb_drawer_overlay_after_open",
|
99
87
|
beforeClose: "pb_drawer_overlay_before_close",
|
100
88
|
};
|
101
89
|
|
102
|
-
const classes = classnames(
|
90
|
+
const classes = classnames(
|
91
|
+
buildCss("pb_drawer_wrapper"),
|
92
|
+
className
|
93
|
+
);
|
103
94
|
|
104
95
|
const [triggerOpened, setTriggerOpened] = useState(false);
|
105
96
|
|
106
|
-
const breakpointWidths: Record<DrawerProps[
|
97
|
+
const breakpointWidths: Record<DrawerProps['breakpoint'], number> = {
|
107
98
|
none: 0,
|
108
99
|
xs: 575,
|
109
100
|
sm: 768,
|
@@ -116,7 +107,7 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
|
|
116
107
|
const [isBreakpointOpen, setIsBreakpointOpen] = useState(false);
|
117
108
|
|
118
109
|
useEffect(() => {
|
119
|
-
if (breakpoint ===
|
110
|
+
if (breakpoint === 'none') return;
|
120
111
|
|
121
112
|
const handleResize = () => {
|
122
113
|
const width = window.innerWidth;
|
@@ -129,57 +120,39 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
|
|
129
120
|
}
|
130
121
|
};
|
131
122
|
|
132
|
-
window.addEventListener(
|
123
|
+
window.addEventListener('resize', handleResize);
|
133
124
|
|
134
125
|
// Call handler once on mount to set initial state
|
135
126
|
handleResize();
|
136
127
|
|
137
128
|
return () => {
|
138
|
-
window.removeEventListener(
|
129
|
+
window.removeEventListener('resize', handleResize);
|
139
130
|
};
|
140
131
|
}, [breakpoint]);
|
141
132
|
|
142
|
-
const modalIsOpened = trigger ? triggerOpened : opened || isBreakpointOpen;
|
143
|
-
|
144
|
-
const [animationState, setAnimationState] = useState("");
|
145
|
-
|
146
|
-
useEffect(() => {
|
147
|
-
if (modalIsOpened) {
|
148
|
-
setAnimationState("afterOpen");
|
149
|
-
} else if (!modalIsOpened && animationState === "afterOpen") {
|
150
|
-
setAnimationState("beforeClose");
|
151
|
-
setTimeout(() => {
|
152
|
-
setAnimationState("");
|
153
|
-
}, 200); // closeTimeoutMS
|
154
|
-
}
|
155
|
-
}, [modalIsOpened]);
|
156
|
-
|
157
|
-
const isModalVisible = modalIsOpened || animationState === "beforeClose";
|
133
|
+
const modalIsOpened = trigger ? triggerOpened : (opened || isBreakpointOpen);
|
158
134
|
|
159
135
|
useEffect(() => {
|
160
|
-
const sizeMap: Record<DrawerProps[
|
161
|
-
xl:
|
162
|
-
lg:
|
163
|
-
md:
|
164
|
-
sm:
|
165
|
-
xs:
|
136
|
+
const sizeMap: Record<DrawerProps['size'], string> = {
|
137
|
+
xl: '365px',
|
138
|
+
lg: '300px',
|
139
|
+
md: '250px',
|
140
|
+
sm: '200px',
|
141
|
+
xs: '64px',
|
166
142
|
};
|
167
|
-
const body = document.querySelector(
|
143
|
+
const body = document.querySelector('body');
|
168
144
|
|
169
|
-
if (modalIsOpened && behavior ===
|
170
|
-
if (placement ===
|
145
|
+
if (modalIsOpened && behavior === 'push' && body) {
|
146
|
+
if (placement === 'left') {
|
171
147
|
body.style.cssText = `margin-left: ${sizeMap[size]} !important; margin-right: '' !important;`;
|
172
|
-
} else if (placement ===
|
148
|
+
} else if (placement === 'right') {
|
173
149
|
body.style.cssText = `margin-right: ${sizeMap[size]} !important; margin-left: '' !important;`;
|
174
150
|
}
|
175
151
|
|
176
|
-
body.classList.add(
|
152
|
+
body.classList.add('ReactModal__Body--open');
|
177
153
|
} else if (body) {
|
178
|
-
|
179
|
-
|
180
|
-
}
|
181
|
-
body.style.cssText = ""; // Clear the styles when modal is closed or behavior is not 'push'
|
182
|
-
body.classList.remove("PBDrawer__Body--open");
|
154
|
+
body.style.cssText = ''; // Clear the styles when modal is closed or behavior is not 'push'
|
155
|
+
body.classList.remove('ReactModal__Body--open');
|
183
156
|
}
|
184
157
|
}, [modalIsOpened, behavior, placement, size]);
|
185
158
|
|
@@ -199,27 +172,22 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
|
|
199
172
|
{...htmlProps}
|
200
173
|
className={classes}
|
201
174
|
>
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
[drawerClassNames.beforeClose]: animationState === "beforeClose",
|
215
|
-
})}
|
216
|
-
onClick={(e) => e.stopPropagation()}
|
217
|
-
>
|
175
|
+
<Modal
|
176
|
+
ariaHideApp={false}
|
177
|
+
className={drawerClassNames}
|
178
|
+
closeTimeoutMS={200}
|
179
|
+
contentLabel="Minimal Modal Example"
|
180
|
+
id={id}
|
181
|
+
isOpen={modalIsOpened}
|
182
|
+
onRequestClose={onClose}
|
183
|
+
overlayClassName={overlayClassNames}
|
184
|
+
shouldCloseOnOverlayClick={overlay}
|
185
|
+
>
|
186
|
+
<>
|
218
187
|
{children}
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
</div>
|
188
|
+
</>
|
189
|
+
</Modal>
|
190
|
+
</div>
|
223
191
|
</DialogContext.Provider>
|
224
192
|
);
|
225
193
|
};
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React, { useState } from 'react';
|
2
|
-
import { render, fireEvent, screen } from '../utilities/test-utils';
|
2
|
+
import { render, cleanup, fireEvent, screen } from '../utilities/test-utils';
|
3
3
|
import { Drawer, Button } from 'playbook-ui';
|
4
|
-
import { waitFor } from '@testing-library/react';
|
5
4
|
|
6
5
|
const size = 'sm';
|
7
6
|
|
@@ -12,10 +11,9 @@ function DrawerTest({ props }) {
|
|
12
11
|
|
13
12
|
return (
|
14
13
|
<>
|
15
|
-
|
14
|
+
<Button onClick={open}>{'Open Drawer'}</Button>
|
16
15
|
<Drawer
|
17
16
|
className="wrapper"
|
18
|
-
id="drawer-id"
|
19
17
|
onClose={close}
|
20
18
|
opened={isOpen}
|
21
19
|
placement="left"
|
@@ -29,17 +27,24 @@ function DrawerTest({ props }) {
|
|
29
27
|
);
|
30
28
|
}
|
31
29
|
|
30
|
+
afterEach(cleanup);
|
31
|
+
|
32
32
|
test('renders with the right border class when border prop is right', async () => {
|
33
33
|
render(<DrawerTest props={{ border: 'right' }} />);
|
34
34
|
|
35
35
|
fireEvent.click(screen.getByText('Open Drawer'));
|
36
36
|
|
37
|
-
|
37
|
+
const drawer = await screen.findByRole('dialog');
|
38
|
+
expect(drawer).toHaveClass('drawer_border_right');
|
39
|
+
});
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
+
test('renders with the left border class when border prop is left', async () => {
|
42
|
+
render(<DrawerTest props={{ border: 'left' }} />);
|
41
43
|
|
42
|
-
|
44
|
+
fireEvent.click(screen.getByText('Open Drawer'));
|
45
|
+
|
46
|
+
const drawer = await screen.findByRole('dialog');
|
47
|
+
expect(drawer).toHaveClass('drawer_border_left');
|
43
48
|
});
|
44
49
|
|
45
50
|
test('renders with the full border class when border prop is full', async () => {
|
@@ -47,10 +52,7 @@ test('renders with the full border class when border prop is full', async () =>
|
|
47
52
|
|
48
53
|
fireEvent.click(screen.getByText('Open Drawer'));
|
49
54
|
|
50
|
-
|
51
|
-
|
52
|
-
const container = document.getElementById('drawer-id');
|
53
|
-
const drawer = container.querySelector('#drawer-id .pb_drawer');
|
55
|
+
const drawer = await screen.findByRole('dialog');
|
54
56
|
expect(drawer).toHaveClass('drawer_border_full');
|
55
57
|
});
|
56
58
|
|
@@ -59,10 +61,7 @@ test('does not have a border class when border prop is none', async () => {
|
|
59
61
|
|
60
62
|
fireEvent.click(screen.getByText('Open Drawer'));
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
const container = document.getElementById('drawer-id');
|
65
|
-
const drawer = container.querySelector('#drawer-id .pb_drawer');
|
64
|
+
const drawer = await screen.findByRole('dialog');
|
66
65
|
expect(drawer).not.toHaveClass('drawer_border_right');
|
67
66
|
expect(drawer).not.toHaveClass('drawer_border_left');
|
68
67
|
expect(drawer).not.toHaveClass('drawer_border_full');
|
@@ -73,9 +72,6 @@ test('renders the correct size class for a large drawer', async () => {
|
|
73
72
|
|
74
73
|
fireEvent.click(screen.getByText('Open Drawer'));
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
const container = document.getElementById('drawer-id');
|
79
|
-
const drawer = container.querySelector('#drawer-id .pb_drawer');
|
75
|
+
const drawer = await screen.findByRole('dialog');
|
80
76
|
expect(drawer).toHaveClass('pb_drawer pb_drawer_lg_left');
|
81
77
|
});
|
@@ -8,12 +8,6 @@ $icon_margin: $space_xs/2;
|
|
8
8
|
$icon_height: 28px;
|
9
9
|
$height_from_top: $icon_height/2 - $connector_width/2;
|
10
10
|
|
11
|
-
// Add gap variables
|
12
|
-
$gap_xs: $height_from_top + $space_xs;
|
13
|
-
$gap_sm: $height_from_top + $space_sm;
|
14
|
-
$gap_md: $height_from_top + $space_md;
|
15
|
-
$gap_lg: $height_from_top + $space_lg;
|
16
|
-
|
17
11
|
@mixin pb_timeline_line_solid($width, $height, $margin) {
|
18
12
|
width: $width;
|
19
13
|
height: $height;
|
@@ -162,7 +156,7 @@ $gap_lg: $height_from_top + $space_lg;
|
|
162
156
|
}
|
163
157
|
}
|
164
158
|
}
|
165
|
-
}
|
159
|
+
}
|
166
160
|
}
|
167
161
|
}
|
168
162
|
&[class*=_vertical] {
|
@@ -272,41 +266,5 @@ $gap_lg: $height_from_top + $space_lg;
|
|
272
266
|
}
|
273
267
|
}
|
274
268
|
}
|
275
|
-
&[class*=_gap_xs] {
|
276
|
-
[class*=pb_timeline_item_kit] {
|
277
|
-
[class=pb_timeline_item_step] {
|
278
|
-
[class=pb_timeline_item_connector] {
|
279
|
-
height: $gap_xs !important;
|
280
|
-
}
|
281
|
-
}
|
282
|
-
}
|
283
|
-
}
|
284
|
-
&[class*=_gap_sm] {
|
285
|
-
[class*=pb_timeline_item_kit] {
|
286
|
-
[class=pb_timeline_item_step] {
|
287
|
-
[class=pb_timeline_item_connector] {
|
288
|
-
height: $gap_sm !important;
|
289
|
-
}
|
290
|
-
}
|
291
|
-
}
|
292
|
-
}
|
293
|
-
&[class*=_gap_md] {
|
294
|
-
[class*=pb_timeline_item_kit] {
|
295
|
-
[class=pb_timeline_item_step] {
|
296
|
-
[class=pb_timeline_item_connector] {
|
297
|
-
height: $gap_md !important;
|
298
|
-
}
|
299
|
-
}
|
300
|
-
}
|
301
|
-
}
|
302
|
-
&[class*=_gap_lg] {
|
303
|
-
[class*=pb_timeline_item_kit] {
|
304
|
-
[class=pb_timeline_item_step] {
|
305
|
-
[class=pb_timeline_item_connector] {
|
306
|
-
height: $gap_lg !important;
|
307
|
-
}
|
308
|
-
}
|
309
|
-
}
|
310
|
-
}
|
311
269
|
}
|
312
270
|
}
|
@@ -20,7 +20,6 @@ type TimelineProps = {
|
|
20
20
|
id?: string,
|
21
21
|
orientation?: string,
|
22
22
|
showDate?: boolean,
|
23
|
-
gap?: 'xs' | 'sm' | 'md' | 'lg' | 'none',
|
24
23
|
} & GlobalProps
|
25
24
|
|
26
25
|
const Timeline = ({
|
@@ -32,16 +31,13 @@ const Timeline = ({
|
|
32
31
|
id,
|
33
32
|
orientation = 'horizontal',
|
34
33
|
showDate = false,
|
35
|
-
gap = 'none',
|
36
34
|
...props
|
37
35
|
}: TimelineProps): React.ReactElement => {
|
38
36
|
const ariaProps = buildAriaProps(aria)
|
39
37
|
const dataProps = buildDataProps(data)
|
40
38
|
const htmlProps = buildHtmlProps(htmlOptions)
|
41
39
|
const dateStyle = showDate === true ? '_with_date' : ''
|
42
|
-
const
|
43
|
-
const timelineCss = buildCss('pb_timeline_kit', `${orientation}`, dateStyle, gapStyle)
|
44
|
-
|
40
|
+
const timelineCss = buildCss('pb_timeline_kit', `_${orientation}`, dateStyle)
|
45
41
|
return (
|
46
42
|
<div
|
47
43
|
{...ariaProps}
|
@@ -60,4 +56,4 @@ Timeline.Step = TimelineStep
|
|
60
56
|
Timeline.Label = TimelineLabel
|
61
57
|
Timeline.Detail = TimelineDetail
|
62
58
|
|
63
|
-
export default Timeline
|
59
|
+
export default Timeline
|
@@ -1,16 +1,14 @@
|
|
1
1
|
examples:
|
2
|
-
|
2
|
+
|
3
3
|
rails:
|
4
4
|
- timeline_default: Default
|
5
5
|
- timeline_vertical: Vertical
|
6
6
|
- timeline_with_date: With Date
|
7
7
|
- timeline_with_children: With Children
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
|
9
|
+
|
11
10
|
react:
|
12
11
|
- timeline_default: Default
|
13
12
|
- timeline_vertical: Vertical
|
14
13
|
- timeline_with_date: With Date
|
15
14
|
- timeline_with_children: With Children
|
16
|
-
- timeline_with_gap: With Gap
|
@@ -2,5 +2,3 @@ export { default as TimelineDefault } from './_timeline_default.jsx'
|
|
2
2
|
export { default as TimelineVertical } from './_timeline_vertical.jsx'
|
3
3
|
export { default as TimelineWithDate } from './_timeline_with_date.jsx'
|
4
4
|
export { default as TimelineWithChildren } from './_timeline_with_children.jsx'
|
5
|
-
export { default as TimelineWithGap } from './_timeline_with_gap.jsx'
|
6
|
-
|
@@ -8,15 +8,9 @@ module Playbook
|
|
8
8
|
default: "horizontal"
|
9
9
|
prop :show_date, type: Playbook::Props::Boolean,
|
10
10
|
default: false
|
11
|
-
prop :gap, type: Playbook::Props::Enum,
|
12
|
-
values: %w[xs sm md lg none],
|
13
|
-
default: "none"
|
14
11
|
|
15
12
|
def classname
|
16
|
-
generate_classname("pb_timeline_kit",
|
17
|
-
orientation,
|
18
|
-
date_class,
|
19
|
-
gap_class)
|
13
|
+
generate_classname("pb_timeline_kit", orientation, date_class)
|
20
14
|
end
|
21
15
|
|
22
16
|
private
|
@@ -24,10 +18,6 @@ module Playbook
|
|
24
18
|
def date_class
|
25
19
|
show_date ? "with_date" : nil
|
26
20
|
end
|
27
|
-
|
28
|
-
def gap_class
|
29
|
-
gap == "none" ? nil : "gap_#{gap}"
|
30
|
-
end
|
31
21
|
end
|
32
22
|
end
|
33
23
|
end
|
@@ -147,26 +147,26 @@ test('should pass id prop', () => {
|
|
147
147
|
test('should have horizontal orientation by default', () => {
|
148
148
|
render(<TimelineDefault />)
|
149
149
|
const kit = screen.getByTestId(testId)
|
150
|
-
expect(kit).toHaveClass('
|
150
|
+
expect(kit).toHaveClass('pb_timeline_kit__horizontal')
|
151
151
|
})
|
152
152
|
|
153
153
|
test('should pass vertical orientation', () => {
|
154
154
|
const props = { orientation: 'vertical' }
|
155
155
|
render(<TimelineDefault {...props} />)
|
156
156
|
const kit = screen.getByTestId(testId)
|
157
|
-
expect(kit).toHaveClass('
|
157
|
+
expect(kit).toHaveClass('pb_timeline_kit__vertical')
|
158
158
|
})
|
159
159
|
|
160
160
|
test('should pass showDate prop', () => {
|
161
161
|
const props = { showDate: true }
|
162
162
|
render(<TimelineDefault {...props} />)
|
163
163
|
const kit = screen.getByTestId(testId)
|
164
|
-
expect(kit).toHaveClass('
|
164
|
+
expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
|
165
165
|
})
|
166
166
|
|
167
167
|
test('should pass showDate prop with Children', () => {
|
168
168
|
const props = { showDate: true }
|
169
169
|
render(<TimelineWithChildren {...props} />)
|
170
170
|
const kit = screen.getByTestId(testId)
|
171
|
-
expect(kit).toHaveClass('
|
171
|
+
expect(kit).toHaveClass('pb_timeline_kit__horizontal__with_date')
|
172
172
|
})
|
@@ -21,47 +21,34 @@
|
|
21
21
|
}
|
22
22
|
|
23
23
|
@mixin hover-color-classes($colors-list) {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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;
|
33
34
|
}
|
34
|
-
}
|
35
|
-
|
36
|
-
@include hover-scale-classes($scales);
|
37
|
-
@include hover-shadow-classes($box_shadows);
|
38
|
-
@include hover-color-classes($product_colors);
|
39
|
-
@include hover-color-classes($status_colors);
|
40
|
-
@include hover-color-classes($data_colors);
|
41
|
-
@include hover-color-classes($shadow_colors);
|
42
|
-
@include hover-color-classes($colors);
|
43
|
-
@include hover-color-classes($interface_colors);
|
44
|
-
@include hover-color-classes($main_colors);
|
45
|
-
@include hover-color-classes($background_colors);
|
46
|
-
@include hover-color-classes($card_colors);
|
47
|
-
@include hover-color-classes($active_colors);
|
48
|
-
@include hover-color-classes($action_colors);
|
49
|
-
@include hover-color-classes($hover_colors);
|
50
|
-
@include hover-color-classes($border_colors);
|
51
|
-
@include hover-color-classes($text_colors);
|
52
|
-
@include hover-color-classes($category_colors);
|
53
|
-
|
54
|
-
.hover_visibility {
|
55
|
-
opacity: 0;
|
56
|
-
transition: opacity $transition-speed ease;
|
57
|
-
|
58
|
-
&:hover {
|
59
|
-
opacity: 1;
|
60
35
|
}
|
61
36
|
}
|
62
37
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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);
|
@@ -63,8 +63,7 @@ type FlexWrap = {
|
|
63
63
|
type Hover = Shadow & {
|
64
64
|
background?: string,
|
65
65
|
color?: string,
|
66
|
-
scale?: "sm" | "md" | "lg"
|
67
|
-
visibility?: boolean,
|
66
|
+
scale?: "sm" | "md" | "lg"
|
68
67
|
}
|
69
68
|
|
70
69
|
type GroupHover = {
|
@@ -231,10 +230,9 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
231
230
|
let css = '';
|
232
231
|
if (!hover) return css;
|
233
232
|
css += hover.shadow ? `hover_shadow_${hover.shadow} ` : '';
|
234
|
-
css += hover.background ? `
|
233
|
+
css += hover.background ? `hover_background_${hover.background } ` : '';
|
235
234
|
css += hover.scale ? `hover_scale_${hover.scale} ` : '';
|
236
|
-
css += hover.color ? `
|
237
|
-
css += hover.visibility ? `hover_visibility` : '';
|
235
|
+
css += hover.color ? `hover_color_${hover.color } ` : '';
|
238
236
|
return css;
|
239
237
|
},
|
240
238
|
|