playbook_ui 12.31.0 → 12.32.0
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_button/docs/_button_hover.html.erb +3 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +37 -31
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +28 -19
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.html.erb +17 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.jsx +33 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.md +3 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +8 -2
- data/app/pb_kits/playbook/pb_message/docs/_message_hover.html.erb +25 -0
- data/app/pb_kits/playbook/pb_message/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +12 -1
- data/app/pb_kits/playbook/utilities/_hover.scss +1 -1
- data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
- data/dist/playbook-rails.js +4 -4
- data/lib/playbook/border_radius.rb +29 -0
- data/lib/playbook/classnames.rb +2 -0
- data/lib/playbook/hover.rb +60 -0
- data/lib/playbook/kit_base.rb +4 -0
- data/lib/playbook/version.rb +2 -2
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a79955ccab5fc9bbdbb96a5a4d10cd3f65f6e85801573552c171032bae82ca4b
|
4
|
+
data.tar.gz: bb3d6b87543fbfce6c0ce0d1d006d73b670d239ae77acde85be73effcb5af1a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a9c508c6a7fef4e46f8bc0127a8afd4cfa33f3e7622428447c7beac1849bccb0a671ddb3eeb3c53344c699b067dbfd612f770e31abf643ccff9b1468ff97c13
|
7
|
+
data.tar.gz: e996bd743ae739a19a668a12ad4668acb3da51787e7b83f9dec559e88fb9cb75dae48191097fe5d46768ca360a57d43784fac4c3b4aae30a1b7209abc602ee68
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<%= pb_rails("button", props: { hover: { shadow: "deep"}, text: "Shadow Deep", margin_right: "lg" }) %>
|
2
|
+
<%= pb_rails("button", props: { hover: { shadow: "deeper"}, text: "Shadow Deeper", margin_right: "lg" }) %>
|
3
|
+
<%= pb_rails("button", props: { hover: { shadow: "deepest"}, text: "Shadow Deepest", margin_right: "lg" }) %>
|
@@ -71,13 +71,42 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
71
71
|
}
|
72
72
|
}
|
73
73
|
const disabledParser = () => {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
const disabledArray=[]
|
75
|
+
|
76
|
+
disableDate && disableDate.length > 0 && disabledArray.push(...disableDate)
|
77
|
+
disableRange && disableRange.length > 0 && disabledArray.push(...disableRange)
|
78
|
+
disableWeekdays && disableWeekdays.length > 0 && disabledArray.push(...disabledWeekDays())
|
79
|
+
|
80
|
+
return disabledArray
|
81
|
+
}
|
82
|
+
|
83
|
+
const disabledWeekDays = () => {
|
84
|
+
return (
|
85
|
+
[
|
86
|
+
(date:any) => {
|
87
|
+
const weekdayObj: {
|
88
|
+
[day: string]: number
|
89
|
+
} = {
|
90
|
+
Sunday: 0,
|
91
|
+
Monday: 1,
|
92
|
+
Tuesday: 2,
|
93
|
+
Wednesday: 3,
|
94
|
+
Thursday: 4,
|
95
|
+
Friday: 5,
|
96
|
+
Saturday: 6,
|
97
|
+
}
|
98
|
+
return (
|
99
|
+
date.getDay() === weekdayObj[disableWeekdays[0]] ||
|
100
|
+
date.getDay() === weekdayObj[disableWeekdays[1]] ||
|
101
|
+
date.getDay() === weekdayObj[disableWeekdays[2]] ||
|
102
|
+
date.getDay() === weekdayObj[disableWeekdays[3]] ||
|
103
|
+
date.getDay() === weekdayObj[disableWeekdays[4]] ||
|
104
|
+
date.getDay() === weekdayObj[disableWeekdays[5]] ||
|
105
|
+
date.getDay() === weekdayObj[disableWeekdays[6]]
|
106
|
+
)
|
107
|
+
},
|
108
|
+
]
|
109
|
+
)
|
81
110
|
}
|
82
111
|
const calendarResizer = () => {
|
83
112
|
const cal = document.querySelector(`#cal-${pickerId}.open`) as HTMLElement
|
@@ -127,30 +156,7 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
127
156
|
disableMobile: true,
|
128
157
|
dateFormat: getDateFormat(),
|
129
158
|
defaultDate: defaultDateGetter(),
|
130
|
-
disable:
|
131
|
-
(date) => {
|
132
|
-
const weekdayObj: {
|
133
|
-
[day: string]: number
|
134
|
-
} = {
|
135
|
-
Sunday: 0,
|
136
|
-
Monday: 1,
|
137
|
-
Tuesday: 2,
|
138
|
-
Wednesday: 3,
|
139
|
-
Thursday: 4,
|
140
|
-
Friday: 5,
|
141
|
-
Saturday: 6,
|
142
|
-
}
|
143
|
-
return (
|
144
|
-
date.getDay() === weekdayObj[disableWeekdays[0]] ||
|
145
|
-
date.getDay() === weekdayObj[disableWeekdays[1]] ||
|
146
|
-
date.getDay() === weekdayObj[disableWeekdays[2]] ||
|
147
|
-
date.getDay() === weekdayObj[disableWeekdays[3]] ||
|
148
|
-
date.getDay() === weekdayObj[disableWeekdays[4]] ||
|
149
|
-
date.getDay() === weekdayObj[disableWeekdays[5]] ||
|
150
|
-
date.getDay() === weekdayObj[disableWeekdays[6]]
|
151
|
-
)
|
152
|
-
},
|
153
|
-
] : disabledParser(),
|
159
|
+
disable: disabledParser(),
|
154
160
|
enableTime,
|
155
161
|
locale: {
|
156
162
|
rangeSeparator: ' to '
|
@@ -14,24 +14,26 @@ const iconMap = {
|
|
14
14
|
};
|
15
15
|
|
16
16
|
type FixedConfirmationToastProps = {
|
17
|
-
autoClose?: number
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
17
|
+
autoClose?: number,
|
18
|
+
children?: React.ReactChild[] | React.ReactChild,
|
19
|
+
className?: string,
|
20
|
+
closeable?: boolean,
|
21
|
+
data?: string,
|
22
|
+
horizontal?: "right" | "left" | "center",
|
23
|
+
id?: string,
|
24
|
+
multiLine?: boolean,
|
25
|
+
onClose?: () => void,
|
26
|
+
open?: boolean,
|
27
|
+
status?: "success" | "error" | "neutral" | "tip",
|
28
|
+
text?: string,
|
29
|
+
vertical?: "top" | "bottom",
|
30
|
+
}
|
30
31
|
|
31
32
|
const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
|
32
33
|
const [showToast, toggleToast] = useState(true);
|
33
34
|
const {
|
34
35
|
autoClose = 0,
|
36
|
+
children,
|
35
37
|
className,
|
36
38
|
closeable = false,
|
37
39
|
horizontal,
|
@@ -75,13 +77,20 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
|
|
75
77
|
{showToast && (
|
76
78
|
<div className={css} onClick={handleClick}>
|
77
79
|
{icon && <Icon className="pb_icon" fixedWidth icon={icon} />}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
text
|
82
|
-
|
80
|
+
|
81
|
+
{
|
82
|
+
children && children ||
|
83
|
+
text && (
|
84
|
+
<Title
|
85
|
+
className="pb_fixed_confirmation_toast_text"
|
86
|
+
size={4}
|
87
|
+
text={text}
|
88
|
+
/>
|
89
|
+
)
|
90
|
+
}
|
91
|
+
|
83
92
|
{closeable && (
|
84
|
-
<Icon className="pb_icon" fixedWidth={false} icon="times" />
|
93
|
+
<Icon className="pb_icon" cursor="pointer" fixedWidth={false} icon="times" />
|
85
94
|
)}
|
86
95
|
</div>
|
87
96
|
)}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= pb_rails("fixed_confirmation_toast", props: {
|
2
|
+
padding_y: "none",
|
3
|
+
status: "success"
|
4
|
+
}) do %>
|
5
|
+
<%= pb_rails("title", props: {
|
6
|
+
dark: true,
|
7
|
+
margin_left: "md",
|
8
|
+
text: "Design & Handoff Process was moved to UX Designer Learning Track.",
|
9
|
+
size: 4
|
10
|
+
}) %>
|
11
|
+
<%= pb_rails("button", props: {
|
12
|
+
dark: true,
|
13
|
+
padding_right: "none",
|
14
|
+
text: "Undo",
|
15
|
+
variant: "link"
|
16
|
+
}) %>
|
17
|
+
<% end %>
|
data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.jsx
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import FixedConfirmationToast from '../_fixed_confirmation_toast'
|
4
|
+
import Button from '../../pb_button/_button'
|
5
|
+
import Title from '../../pb_title/_title'
|
6
|
+
|
7
|
+
const FixedConfirmationToastChildren = (props) => {
|
8
|
+
return (
|
9
|
+
<>
|
10
|
+
<FixedConfirmationToast
|
11
|
+
paddingY="none"
|
12
|
+
status="success"
|
13
|
+
{...props}
|
14
|
+
>
|
15
|
+
<Title
|
16
|
+
dark
|
17
|
+
marginLeft="md"
|
18
|
+
size={4}
|
19
|
+
text="Design & Handoff Process was moved to UX Designer Learning Track."
|
20
|
+
/>
|
21
|
+
<Button
|
22
|
+
dark
|
23
|
+
onClick={() => alert("button clicked!")}
|
24
|
+
paddingRight="none"
|
25
|
+
text="Undo"
|
26
|
+
variant="link"
|
27
|
+
/>
|
28
|
+
</FixedConfirmationToast>
|
29
|
+
</>
|
30
|
+
)
|
31
|
+
}
|
32
|
+
|
33
|
+
export default FixedConfirmationToastChildren
|
@@ -5,6 +5,7 @@ examples:
|
|
5
5
|
- fixed_confirmation_toast_multi_line: Multi Line
|
6
6
|
- fixed_confirmation_toast_close: Click to Close
|
7
7
|
- fixed_confirmation_toast_positions: Click to Show Positions
|
8
|
+
- fixed_confirmation_toast_children: Children
|
8
9
|
|
9
10
|
react:
|
10
11
|
- fixed_confirmation_toast_default: Default
|
@@ -12,3 +13,4 @@ examples:
|
|
12
13
|
- fixed_confirmation_toast_close: Click to Close
|
13
14
|
- fixed_confirmation_toast_positions: Click to Show Positions
|
14
15
|
- fixed_confirmation_toast_auto_close: Click to Show Auto Close
|
16
|
+
- fixed_confirmation_toast_children: Children
|
@@ -3,3 +3,4 @@ export { default as FixedConfirmationToastMultiLine } from './_fixed_confirmatio
|
|
3
3
|
export { default as FixedConfirmationToastClose } from './_fixed_confirmation_toast_close.jsx'
|
4
4
|
export { default as FixedConfirmationToastPositions } from './_fixed_confirmation_toast_positions.jsx'
|
5
5
|
export { default as FixedConfirmationToastAutoClose } from './_fixed_confirmation_toast_auto_close.jsx'
|
6
|
+
export { default as FixedConfirmationToastChildren } from './_fixed_confirmation_toast_children.jsx'
|
@@ -4,6 +4,12 @@
|
|
4
4
|
data: object.data,
|
5
5
|
class: object.classname) do %>
|
6
6
|
<%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
<% if content %>
|
9
|
+
<%= content %>
|
10
|
+
<% elsif object.show_text? %>
|
11
|
+
<%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_fixed_confirmation_toast_text" }) %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= pb_rails("icon", props: { icon: "times", classname: "pb_icon", cursor: "pointer" }) if object.closeable %>
|
9
15
|
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= pb_rails("message", props: {
|
2
|
+
avatar_name: "Mike Bishop",
|
3
|
+
avatar_status: "online",
|
4
|
+
avatar_url: "https://randomuser.me/api/portraits/men/50.jpg",
|
5
|
+
border_radius: "rounded",
|
6
|
+
hover: { background: "success_subtle" },
|
7
|
+
label: "Anna Black",
|
8
|
+
message: "How can we assist you today?",
|
9
|
+
padding: "xs",
|
10
|
+
}) %>
|
11
|
+
|
12
|
+
<br><br>
|
13
|
+
|
14
|
+
<%= pb_rails("message", props: {
|
15
|
+
align_timestamp: "left",
|
16
|
+
avatar_name: "Lucille Sanchez",
|
17
|
+
avatar_url: "https://randomuser.me/api/portraits/women/50.jpg",
|
18
|
+
border_radius: "rounded",
|
19
|
+
hover: { shadow: "deepest" },
|
20
|
+
label: "Becca Jacobs",
|
21
|
+
message: "Application for Kate Smith is waiting for your approval",
|
22
|
+
padding: "xs",
|
23
|
+
}) %>
|
24
|
+
|
25
|
+
<br><br>
|
@@ -250,6 +250,15 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
250
250
|
}
|
251
251
|
}
|
252
252
|
|
253
|
+
const itemsSelectedLength = () => {
|
254
|
+
let items
|
255
|
+
if (returnAllSelected && returnedArray && returnedArray.length) {
|
256
|
+
items = returnedArray.length
|
257
|
+
} else if (!returnAllSelected && defaultReturn && defaultReturn.length) {
|
258
|
+
items = defaultReturn.length
|
259
|
+
}
|
260
|
+
return items
|
261
|
+
}
|
253
262
|
//rendering formattedData to UI based on typeahead
|
254
263
|
const renderNestedOptions = (items: { [key: string]: any }[]) => {
|
255
264
|
return (
|
@@ -346,7 +355,9 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
346
355
|
onChange={(e) => {
|
347
356
|
setFilterItem(e.target.value)
|
348
357
|
}}
|
349
|
-
placeholder=
|
358
|
+
placeholder={inputDisplay === "none" && itemsSelectedLength() ? (
|
359
|
+
`${itemsSelectedLength()} ${itemsSelectedLength() === 1 ? 'item' : 'items'} selected`
|
360
|
+
) : ("Start typing...")}
|
350
361
|
value={filterItem}
|
351
362
|
onClick={() => setIsClosed(false)}
|
352
363
|
/>
|
@@ -147,7 +147,7 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
147
147
|
let css = '';
|
148
148
|
if (!hover) return css;
|
149
149
|
css += hover.shadow ? `hover_shadow_${hover.shadow} ` : '';
|
150
|
-
css += hover.background ? `
|
150
|
+
css += hover.background ? `hover_background_${hover.background } ` : '';
|
151
151
|
css += hover.scale ? `hover_scale_${hover.scale} ` : '';
|
152
152
|
return css;
|
153
153
|
},
|