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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_button/docs/_button_hover.html.erb +3 -0
  3. data/app/pb_kits/playbook/pb_button/docs/example.yml +1 -0
  4. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -1
  5. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +37 -31
  6. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +28 -19
  7. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.html.erb +17 -0
  8. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.jsx +33 -0
  9. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.md +3 -0
  10. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  11. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  12. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +8 -2
  13. data/app/pb_kits/playbook/pb_message/docs/_message_hover.html.erb +25 -0
  14. data/app/pb_kits/playbook/pb_message/docs/example.yml +1 -0
  15. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +1 -0
  16. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +12 -1
  17. data/app/pb_kits/playbook/utilities/_hover.scss +1 -1
  18. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
  19. data/dist/playbook-rails.js +4 -4
  20. data/lib/playbook/border_radius.rb +29 -0
  21. data/lib/playbook/classnames.rb +2 -0
  22. data/lib/playbook/hover.rb +60 -0
  23. data/lib/playbook/kit_base.rb +4 -0
  24. data/lib/playbook/version.rb +2 -2
  25. metadata +9 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39c902d86406eacebfff3d633131660ecfdaf57e1d7b0f9480e1e9090e958501
4
- data.tar.gz: a617f4fda7d3e3ed0b6de62504710c4962cdb70c3d59877057fe082262aec1f6
3
+ metadata.gz: a79955ccab5fc9bbdbb96a5a4d10cd3f65f6e85801573552c171032bae82ca4b
4
+ data.tar.gz: bb3d6b87543fbfce6c0ce0d1d006d73b670d239ae77acde85be73effcb5af1a9
5
5
  SHA512:
6
- metadata.gz: 00f0e49f95ed90f0e6a1567cb4ff0448c48e77580f3c7ee02dcdbb060e3a472527007f9026f5486508c7ab3bb12d2a3b5d189605549ee1803c91c377a81ec671
7
- data.tar.gz: b37a1a86dc19ff217a582a712161b34b6e4f7875c0b35a040b2c55030c61aa7076ee909555a9df9d4100e2441b9459ea0b391d0dabfec25cd89b191e96148d55
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" }) %>
@@ -10,6 +10,7 @@ examples:
10
10
  - button_options: Button Additional Options
11
11
  - button_size: Button Size
12
12
  - button_form: Button Form Attribute
13
+
13
14
  react:
14
15
  - button_default: Button Variants
15
16
  - button_full_width: Button Full Width
@@ -53,7 +53,7 @@ $pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors)
53
53
  };
54
54
 
55
55
  @each $name, $shadow in $box_shadows {
56
- &[class*=_#{$name}] {
56
+ &[class^=_#{$name}] {
57
57
  box-shadow: $shadow;
58
58
  }
59
59
  }
@@ -71,13 +71,42 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
71
71
  }
72
72
  }
73
73
  const disabledParser = () => {
74
- if (disableDate && disableDate.length > 0) {
75
- return disableDate
76
- } else if (disableRange && disableRange.length > 0) {
77
- return disableRange
78
- } else {
79
- return []
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: disableWeekdays && disableWeekdays.length > 0 ? [
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
- className?: string;
19
- closeable?: boolean;
20
- data?: string;
21
- horizontal?: "right" | "left" | "center";
22
- id?: string;
23
- multiLine?: boolean;
24
- onClose?: () => void;
25
- open?: boolean;
26
- status?: "success" | "error" | "neutral" | "tip";
27
- text: string;
28
- vertical?: "top" | "bottom";
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
- <Title
79
- className="pb_fixed_confirmation_toast_text"
80
- size={4}
81
- text={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 %>
@@ -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
@@ -0,0 +1,3 @@
1
+ Pass anything (including any of our kits) to the `children` prop to customize the content of the fixed confirmation toast.
2
+
3
+ **NOTE:** passing `children` overrides any content passed to `text`
@@ -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
- <%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_fixed_confirmation_toast_text" }) if object.show_text? %>
8
- <%= pb_rails("icon", props: { icon: "times", classname: "pb_icon" }) if object.closeable %>
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>
@@ -3,6 +3,7 @@ examples:
3
3
  rails:
4
4
  - message_default: Default
5
5
  - message_timestamp: With Timestamp Hover
6
+ - message_hover: Hover
6
7
 
7
8
 
8
9
  react:
@@ -36,6 +36,7 @@
36
36
  input {
37
37
  border: none;
38
38
  font-family: $font_family_base;
39
+ font-size: $font_base;
39
40
  &:focus {
40
41
  outline: none;
41
42
  }
@@ -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='Start typing...'
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
  />
@@ -2,7 +2,7 @@
2
2
 
3
3
  @mixin hover-color-classes($colors-list) {
4
4
  @each $name, $color in $colors-list {
5
- .bg-hover-#{$name}:hover {
5
+ .hover_background_#{$name}:hover {
6
6
  background-color: $color !important;
7
7
  transition: background-color $transition-speed ease;
8
8
  }
@@ -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 ? `bg-hover-${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
  },