playbook_ui 14.10.0.pre.alpha.PBNTR662stickyrightcolumnreact5160 → 14.10.0.pre.alpha.PLAY1750pbcontenttagkitbutton5308

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 (92) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +11 -16
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +8 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -3
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +1 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.html.erb +43 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.html.erb +58 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/index.js +185 -92
  13. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
  14. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +55 -8
  15. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +17 -14
  16. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +78 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -3
  18. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +13 -2
  19. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +2 -6
  20. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +6 -4
  21. data/app/pb_kits/playbook/pb_button/button.html.erb +2 -3
  22. data/app/pb_kits/playbook/pb_card/_card.scss +21 -3
  23. data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +18 -0
  24. data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +40 -0
  25. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +1 -6
  26. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -6
  27. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +7 -12
  28. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +9 -14
  29. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +6 -11
  30. data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +8 -14
  31. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +24 -15
  32. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx +3 -1
  33. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx +4 -1
  34. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx +1 -1
  35. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +1 -13
  36. data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +64 -1
  37. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +3 -1
  38. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.html.erb +10 -0
  39. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.jsx +42 -0
  40. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.md +3 -0
  41. data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +2 -0
  42. data/app/pb_kits/playbook/pb_section_separator/docs/index.js +1 -0
  43. data/app/pb_kits/playbook/pb_section_separator/section_separator.rb +4 -1
  44. data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +2 -2
  45. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_description.md +3 -0
  46. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.html.erb +9 -0
  47. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius_rails.md +1 -0
  48. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.html.erb +7 -0
  49. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -1
  50. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.html.erb +119 -0
  51. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.jsx +10 -2
  52. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.html.erb +15 -0
  53. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +6 -2
  54. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width_rails.md +3 -0
  55. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.html.erb +3 -0
  56. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.html.erb +63 -0
  57. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.jsx +11 -3
  58. data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +7 -2
  59. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +8 -12
  60. data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +48 -1
  61. data/app/pb_kits/playbook/pb_table/_table.tsx +8 -1
  62. data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
  63. data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
  64. data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +20 -0
  65. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +8 -1
  66. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +18 -0
  67. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +45 -1
  68. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +80 -0
  69. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +5 -5
  70. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.html.erb +4 -5
  71. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.jsx +4 -4
  72. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_gap.md +1 -1
  73. data/app/pb_kits/playbook/pb_timeline/timeline.rb +6 -6
  74. data/app/pb_kits/playbook/utilities/_gap.scss +29 -0
  75. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +1 -0
  76. data/app/pb_kits/playbook/utilities/globalProps.ts +18 -9
  77. data/dist/chunks/_typeahead-C2iCBqxQ.js +36 -0
  78. data/dist/chunks/_weekday_stacked-CWnbnW7m.js +45 -0
  79. data/dist/chunks/vendor.js +1 -1
  80. data/dist/menu.yml +1 -1
  81. data/dist/playbook-doc.js +1 -1
  82. data/dist/playbook-rails-react-bindings.js +1 -1
  83. data/dist/playbook-rails.js +1 -1
  84. data/dist/playbook.css +1 -1
  85. data/lib/playbook/classnames.rb +1 -0
  86. data/lib/playbook/spacing.rb +21 -0
  87. data/lib/playbook/version.rb +1 -1
  88. metadata +21 -6
  89. data/dist/chunks/_typeahead-aym7Ky_O.js +0 -22
  90. data/dist/chunks/_weekday_stacked-BZj1pop-.js +0 -45
  91. /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_border_radius.md → _skeleton_loading_border_radius_react.md} +0 -0
  92. /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_height_width.md → _skeleton_loading_height_width_react.md} +0 -0
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useCallback, useRef } from 'react'
2
- import { useDropzone, DropzoneInputProps, DropzoneRootProps } from 'react-dropzone'
2
+ import { useDropzone, DropzoneInputProps, DropzoneRootProps, FileRejection } from 'react-dropzone'
3
3
  import classnames from 'classnames'
4
4
 
5
5
  import { buildCss, buildDataProps, noop, buildHtmlProps } from '../utilities/props'
@@ -9,8 +9,10 @@ import type { Callback } from '../types'
9
9
  import Body from '../pb_body/_body'
10
10
  import Card from '../pb_card/_card'
11
11
 
12
+ import { isEmpty } from '../utilities/object'
13
+
12
14
  type FileUploadProps = {
13
- accept?: string[],
15
+ accept?: Record<string, string[]>,
14
16
  className?: string,
15
17
  customMessage?: string,
16
18
  dark?: boolean,
@@ -19,7 +21,7 @@ type FileUploadProps = {
19
21
  acceptedFilesDescription?: string,
20
22
  maxSize?: number,
21
23
  onFilesAccepted: Callback<File, File>,
22
- onFilesRejected: (error: string, files: File[]) => void,
24
+ onFilesRejected: (error: string, files: readonly FileRejection[]) => void,
23
25
  }
24
26
 
25
27
  const getFormattedFileSize = (fileSize: number): string => {
@@ -28,7 +30,7 @@ const getFormattedFileSize = (fileSize: number): string => {
28
30
 
29
31
  const FileUpload = (props: FileUploadProps): React.ReactElement => {
30
32
  const {
31
- accept = null,
33
+ accept = {},
32
34
  acceptedFilesDescription = '',
33
35
  className,
34
36
  customMessage,
@@ -48,30 +50,37 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
48
50
  getRootProps: () => DropzoneRootProps & any;
49
51
  getInputProps: () => DropzoneInputProps & any;
50
52
  isDragActive: boolean;
51
- rejectedFiles: File[];
53
+ fileRejections: readonly FileRejection[];
52
54
  }
53
55
 
54
- const { getRootProps, getInputProps, isDragActive, rejectedFiles }: DropZoneProps = useDropzone({
56
+ const { getRootProps, getInputProps, isDragActive, fileRejections }: DropZoneProps = useDropzone({
55
57
  accept,
56
58
  maxSize,
57
59
  onDrop,
58
60
  })
59
61
 
60
- const prevRejected = useRef<File[] | null>(null);
62
+ const prevRejected = useRef<readonly FileRejection[] | null>(null);
61
63
 
62
- const maxFileSizeText = `Max file size is ${getFormattedFileSize(maxSize)}.`
64
+ let maxFileSizeText = ''
65
+ if (maxSize !== undefined) {
66
+ maxFileSizeText = `Max file size is ${getFormattedFileSize(maxSize)}.`
67
+ }
63
68
 
64
69
  useEffect(() => {
65
- if (rejectedFiles === prevRejected.current) return
66
- const isFileTooLarge = maxSize && rejectedFiles.length > 0 && rejectedFiles[0].size > maxSize;
70
+ if (fileRejections === prevRejected.current) return
71
+ const isFileTooLarge = maxSize && fileRejections.length > 0 && fileRejections[0].file.size > maxSize;
67
72
  if (isFileTooLarge) {
68
- onFilesRejected(`File size is too large! ${maxFileSizeText}`, rejectedFiles)
73
+ onFilesRejected(`File size is too large! ${maxFileSizeText}`, fileRejections)
69
74
  }
70
- prevRejected.current = rejectedFiles
71
- }, [maxFileSizeText, maxSize, onFilesRejected, rejectedFiles])
75
+ prevRejected.current = fileRejections
76
+ }, [maxFileSizeText, maxSize, onFilesRejected, fileRejections])
72
77
 
73
78
  const acceptedFileTypes = () => {
74
- return accept.map((fileType) => {
79
+ if (!accept) {
80
+ return []
81
+ }
82
+
83
+ return Object.keys(accept).map((fileType) => {
75
84
  if (fileType.startsWith('image/')) {
76
85
  return fileType.replace('image/', ' ')
77
86
  } else {
@@ -86,7 +95,7 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
86
95
  const getDescription = () => {
87
96
  return customMessage
88
97
  ? customMessage
89
- : `Choose a file or drag it here.${accept === null ? '' : ` The accepted file types are: ${acceptedFilesDescription || acceptedFileTypes()}.`}${maxSize ? ` ${maxFileSizeText}` : ''}`;
98
+ : `Choose a file or drag it here.${isEmpty(accept) ? '' : ` The accepted file types are: ${acceptedFilesDescription || acceptedFileTypes()}.`}${maxSize ? ` ${maxFileSizeText}` : ''}`;
90
99
  }
91
100
 
92
101
  return (
@@ -28,7 +28,9 @@ const FileUploadAccept = (props) => {
28
28
  {...props}
29
29
  />
30
30
  <FileUpload
31
- accept={['image/svg+xml']}
31
+ accept={{
32
+ "image/svg+xml": [".svg", ".xml"],
33
+ }}
32
34
  onFilesAccepted={handleOnFilesAccepted}
33
35
  {...props}
34
36
  />
@@ -25,7 +25,10 @@ const FileUploadCustomDescription = (props) => {
25
25
  {...props}
26
26
  />
27
27
  <FileUpload
28
- accept={['application/pdf','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']}
28
+ accept={{
29
+ "application/pdf": [".pdf"],
30
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
31
+ }}
29
32
  acceptedFilesDescription="Adobe (.pdf) and Microsoft (.xslx)"
30
33
  onFilesAccepted={handleOnFilesAccepted}
31
34
  {...props}
@@ -18,7 +18,7 @@ const AcceptedFilesList = ({ files }) => (
18
18
  const RejectedFilesList = ({ files }) => (
19
19
  <List>
20
20
  {files.map((file) => (
21
- <ListItem key={file.name}><Body color="error">{`${file.name} (file too large)`}</Body></ListItem>
21
+ <ListItem key={file.file.name}><Body color="error">{`${file.file.name} (file too large)`}</Body></ListItem>
22
22
  ))}
23
23
  </List>
24
24
  )
@@ -14,16 +14,6 @@ $pb_icon_circle_sizes: (
14
14
  "xl": 100px,
15
15
  );
16
16
 
17
- @mixin svg_size($name, $match, $adjust) {
18
- @if $name == $match {
19
- $svg_xy: $adjust;
20
- & > svg {
21
- width: #{$svg_xy};
22
- height: #{$svg_xy};
23
- }
24
- }
25
- }
26
-
27
17
  [class^=pb_icon_circle_kit] {
28
18
  display: flex;
29
19
  justify-content: center;
@@ -57,13 +47,11 @@ $pb_icon_circle_sizes: (
57
47
  border-radius: $size/2;
58
48
  background: $silver;
59
49
  color: $text_lt_light;
60
- font-size: $size * 0.38;
50
+ font-size: if($name == "xxs", $size - 6px, $size * 0.38);
61
51
  line-height: $size;
62
52
  flex-shrink: 0;
63
53
  flex-grow: 0;
64
54
  flex-basis: $size;
65
-
66
- @include svg_size($name, "xxs", $size - 6px);
67
55
  }
68
56
  }
69
57
 
@@ -3,6 +3,11 @@
3
3
  @import "../tokens/opacity";
4
4
  @import "./section_separator_mixin";
5
5
 
6
+ $merge_kits1: map-merge($status_colors, $category_colors);
7
+ $merge_kits2: map-merge($merge_kits1, $product_colors);
8
+ $merge_kits3: map-merge($merge_kits2, $text_colors);
9
+ $section_selector_colors: map-merge($merge_kits3, $data_colors);
10
+
6
11
  $section_colors_light: (
7
12
  background: $bg_light,
8
13
  card: $card_light,
@@ -19,8 +24,11 @@ $section_colors_dark: (
19
24
  align-items: center;
20
25
  position: relative;
21
26
  span {
22
- padding: 0 $space_xs;
27
+ padding: 0;
23
28
  display: flex;
29
+ [class*="pb_caption_kit"] {
30
+ padding: 0 $space_xs;
31
+ }
24
32
  }
25
33
  &::before {
26
34
  content: "";
@@ -34,12 +42,40 @@ $section_colors_dark: (
34
42
  flex: 1;
35
43
  @include section_separator_horizontal;
36
44
  }
45
+ @each $color_name, $color_value in $section_selector_colors {
46
+ &[class*="color_#{$color_name}"] {
47
+ &::before, &::after {
48
+ background: $color_value;
49
+ }
50
+
51
+ &[class*=_vertical] {
52
+ &::after {
53
+ background: $color_value;
54
+ }
55
+ }
56
+ &[class*=_dashed] {
57
+ &::before, &::after {
58
+ border: 1px dashed $color_value;
59
+ }
60
+ &[class*=_vertical] {
61
+ &::after {
62
+ border: 1px dashed $color_value;
63
+ background: none;
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+
37
70
  &[class*=_horizontal] {
38
71
  justify-content: center;
39
72
  }
40
73
  &[class*=_vertical] {
41
74
  margin-left: $space_xs;
42
75
  margin-right: $space_xs;
76
+ &::before {
77
+ display: none;
78
+ }
43
79
  &::after {
44
80
  @include section_separator_vertical(false);
45
81
  }
@@ -54,6 +90,33 @@ $section_colors_dark: (
54
90
  // Dark =========================
55
91
 
56
92
  &.dark {
93
+ @each $color_name, $color_value in $section_selector_colors {
94
+ &[class*="color_#{$color_name}"] {
95
+ &::before, &::after {
96
+ background: $color_value;
97
+ }
98
+
99
+ &[class*=_vertical] {
100
+ &::after {
101
+ @include section_separator_vertical(false);
102
+ background: $color_value;
103
+ }
104
+ }
105
+
106
+ &[class*=_dashed] {
107
+ &::before, &::after {
108
+ border: 1px dashed $color_value;
109
+ background: none;
110
+ }
111
+ &[class*=_vertical] {
112
+ &::after {
113
+ border: 1px dashed $color_value;
114
+ background: none;
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
57
120
  &::before {
58
121
  @include section_separator_horizontal(true);
59
122
  }
@@ -10,6 +10,7 @@ type SectionSeparatorProps = {
10
10
  aria?: { [key: string]: string; },
11
11
  children?: React.ReactChild[] | React.ReactChild,
12
12
  className?: string,
13
+ color?: "default" | "primary",
13
14
  dark?: boolean,
14
15
  data?: { [key: string]: string; },
15
16
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -25,6 +26,7 @@ const SectionSeparator = (props: SectionSeparatorProps): React.ReactElement => {
25
26
  aria = {},
26
27
  children,
27
28
  className,
29
+ color ="default",
28
30
  data = {},
29
31
  htmlOptions = {},
30
32
  id,
@@ -37,7 +39,7 @@ const SectionSeparator = (props: SectionSeparatorProps): React.ReactElement => {
37
39
  const ariaProps = buildAriaProps(aria)
38
40
  const dataProps = buildDataProps(data)
39
41
  const htmlProps = buildHtmlProps(htmlOptions)
40
- const classes = classnames(buildCss('pb_section_separator_kit', variant, orientation, lineStyle === "dashed" ? lineStyle : ""), globalProps(props), className)
42
+ const classes = classnames(buildCss('pb_section_separator_kit', variant, orientation, lineStyle === "dashed" ? lineStyle : "", color !== "default" ? `color_${color}` : ''), globalProps(props), className)
41
43
  const dynamicInlineProps = globalInlineProps(props)
42
44
 
43
45
  return (
@@ -0,0 +1,10 @@
1
+ <%= pb_rails("section_separator", props: { text: "Default Separator" }) %>
2
+ <%= pb_rails("section_separator", props: { color: "primary", text: "Primary Separator" }) %>
3
+ <%= pb_rails("section_separator", props: { color: "primary", line_style: "dashed", text: "Primary Dashed Separator" }) %>
4
+ <%= pb_rails("section_separator", props: { color: "primary" }) do %>
5
+ <%= pb_rails("flex", props: { padding: "xs" }) do %>
6
+ <%= pb_rails("icon", props: { color: "primary", icon: "arrow-down" }) %>
7
+ <%= pb_rails("detail", props: { text: "Children", size: "sm", color: "link" }) %>
8
+ <% end %>
9
+ <% end %>
10
+
@@ -0,0 +1,42 @@
1
+ import React from "react"
2
+ import { SectionSeparator, Flex, Detail, Icon } from "playbook-ui"
3
+
4
+ const children = (
5
+ <Flex padding="xs">
6
+ <Icon color="primary"
7
+ icon="arrow-down"
8
+ />
9
+ <Detail
10
+ color="link"
11
+ size="sm"
12
+ text="Children"
13
+ />
14
+ </Flex>
15
+ )
16
+
17
+ const SectionSeparatorColor = (props) => {
18
+ return (
19
+ <div>
20
+ <SectionSeparator text="Default Separator"
21
+ {...props}
22
+ />
23
+ <SectionSeparator color="primary"
24
+ text="Primary Separator"
25
+ {...props}
26
+ />
27
+ <SectionSeparator
28
+ color="primary"
29
+ lineStyle="dashed"
30
+ text="Primary Dashed Separator"
31
+ {...props}
32
+ />
33
+ <SectionSeparator color="primary"
34
+ {...props}
35
+ >
36
+ {children}
37
+ </SectionSeparator>
38
+ </div>
39
+ )
40
+ }
41
+
42
+ export default SectionSeparatorColor
@@ -0,0 +1,3 @@
1
+ Pass "primary" to the `color` prop to change any section separator color.
2
+
3
+ **NOTE:** Passing `children` overrides any content provided via the `text` prop. The `color` prop does not affect the `text` prop's color, and the color of `children` is determined by the children's individual props. For greater control over text color customization, consider using a separator with `children`.
@@ -6,6 +6,7 @@ examples:
6
6
  - section_separator_text: Text Separator
7
7
  - section_separator_vertical: Vertical
8
8
  - section_separator_children: Children
9
+ - section_separator_color: Color
9
10
 
10
11
  react:
11
12
  - section_separator_line: Line Separator
@@ -13,6 +14,7 @@ examples:
13
14
  - section_separator_text: Text Separator
14
15
  - section_separator_vertical: Vertical
15
16
  - section_separator_children: Children
17
+ - section_separator_color: Color
16
18
 
17
19
  swift:
18
20
  - section_separator_line_swift: Line Separator
@@ -3,3 +3,4 @@ export { default as SectionSeparatorText } from './_section_separator_text.jsx'
3
3
  export { default as SectionSeparatorVertical } from './_section_separator_vertical.jsx'
4
4
  export { default as SectionSeparatorDashed } from './_section_separator_dashed.jsx'
5
5
  export { default as SectionSeparatorChildren } from './_section_separator_children.jsx'
6
+ export { default as SectionSeparatorColor } from './_section_separator_color.jsx'
@@ -3,6 +3,9 @@
3
3
  module Playbook
4
4
  module PbSectionSeparator
5
5
  class SectionSeparator < Playbook::KitBase
6
+ prop :color, type: Playbook::Props::Enum,
7
+ values: %w[default primary],
8
+ default: "default"
6
9
  prop :text
7
10
  prop :variant, type: Playbook::Props::Enum,
8
11
  values: %w[card background],
@@ -17,7 +20,7 @@ module Playbook
17
20
  default: "solid"
18
21
 
19
22
  def classname
20
- generate_classname("pb_section_separator_kit", variant, orientation, line_style == "dashed" ? "dashed" : nil)
23
+ generate_classname("pb_section_separator_kit", variant, orientation, line_style == "dashed" ? "dashed" : nil, color != "default" ? "color_#{color}" : nil)
21
24
  end
22
25
 
23
26
  private
@@ -1,8 +1,8 @@
1
1
  @import 'skeleton_loading_mixins';
2
2
 
3
3
  .pb_skeleton_loading {
4
- display: "flex";
5
- flex-direction: "column";
4
+ display: flex;
5
+ flex-direction: column;
6
6
  height: 100%;
7
7
  .color_default {
8
8
  @include skeleton-shimmer($silver);
@@ -0,0 +1,3 @@
1
+ The Skeleton Loading kit can be used an intermediate loading state to give users a visual indication that content is loading.
2
+
3
+ **Please Note**: this kit is not meant to be integrated interally within other Playbook kits as a loading prop; rather, it can be used to create a composite of the section/kit/page with loading intermediataries, as demonstrated in the the "example component" doc examples.
@@ -0,0 +1,9 @@
1
+ <%= pb_rails("flex", props: { justify: "evenly" }) do %>
2
+ <%= pb_rails("skeleton_loading", props: { border_radius: "rounded", height: "50px", width: "100px"}) %>
3
+ <%= pb_rails("skeleton_loading", props: { border_radius: "xl", height: "50px", width: "100px"}) %>
4
+ <%= pb_rails("skeleton_loading", props: { border_radius: "lg", height: "50px", width: "100px"}) %>
5
+ <%= pb_rails("skeleton_loading", props: { border_radius: "md", height: "50px", width: "100px"}) %>
6
+ <%= pb_rails("skeleton_loading", props: { height: "50px", width: "100px"}) %>
7
+ <%= pb_rails("skeleton_loading", props: { border_radius: "xs", height: "50px", width: "100px"}) %>
8
+ <%= pb_rails("skeleton_loading", props: { border_radius: "none", height: "50px", width: "100px"}) %>
9
+ <% end %>
@@ -0,0 +1 @@
1
+ The `border_radius` prop accepts all of our [BorderRadius](https://playbook.powerapp.cloud/visual_guidelines/border_radius) tokens, with `sm` as default.
@@ -0,0 +1,7 @@
1
+ <%= pb_rails("card", props: { border_none: true }) do %>
2
+ <%= pb_rails("skeleton_loading") %>
3
+ <% end %>
4
+
5
+ <%= pb_rails("card", props: { background: "light", border_none: true }) do %>
6
+ <%= pb_rails("skeleton_loading", props: { color: "white" }) %>
7
+ <% end %>
@@ -1 +1 @@
1
- <%= pb_rails("skeleton_loading") %>
1
+ <%= pb_rails("skeleton_loading") %>
@@ -0,0 +1,119 @@
1
+ <%= pb_rails("button", props: { id: "toggle-filter-button", margin_bottom: "md", text: "Show Filter", variant: "secondary" }) %>
2
+
3
+ <div id="skeleton-loading-filter-content">
4
+ <%= pb_rails("card", props: { margin_bottom: "lg" }) do %>
5
+ <%= pb_rails("flex", props: { align_items: "center", justify: "between", orientation: "row" }) do %>
6
+ <%= pb_rails("flex", props: { align_items: "center", justify: "start", orientation: "row" }) do %>
7
+ <%= pb_rails("skeleton_loading", props: { border_radius: "rounded", height: "40px", margin_right: "sm", width: "40px" }) %>
8
+ <%= pb_rails("skeleton_loading", props: { height: "16px", margin_right: "md", width: "80px" }) %>
9
+ <% end %>
10
+ <%= pb_rails("flex", props: { align_items: "center", justify: "end", orientation: "row" }) do %>
11
+ <%= pb_rails("skeleton_loading", props: { height: "18px", width: "120px" }) %>
12
+ <% end %>
13
+ <% end %>
14
+ <% end %>
15
+
16
+ <%= pb_rails("skeleton_loading", props: { height: "127px", width: "100%" }) %>
17
+ </div>
18
+
19
+ <div id="filter-content" style="display: none;">
20
+ <%= pb_rails("filter", props: {
21
+ margin_bottom: "xl",
22
+ min_width: "360px",
23
+ id: "2",
24
+ filters: [
25
+ { name: "name", value: "John Wick" }
26
+ ],
27
+ sort_menu: [
28
+ { item: "Popularity", link: "?q[sorts]=managers_popularity+asc", active: true, direction: "desc" },
29
+ { item: "Mananger's Title", link: "?q[sorts]=managers_title+asc", active: false },
30
+ { item: "Manager's Name", link: "?q[sorts]=managers_name+asc", active: false },
31
+ ],
32
+ results: 546,
33
+ template: "single"
34
+ }) do %>
35
+ <% example_collection = [
36
+ OpenStruct.new(name: "USA", value: 1),
37
+ OpenStruct.new(name: "Canada", value: 2),
38
+ OpenStruct.new(name: "Brazil", value: 3),
39
+ OpenStruct.new(name: "Philippines", value: 4),
40
+ OpenStruct.new(name: "A galaxy far far away...", value: 5)
41
+ ] %>
42
+
43
+ <%= pb_rails("form", props: { form_system_options: { scope: :example, method: :get } }) do |form| %>
44
+ <%= form.text_field :example_text_field, props: { label: true } %>
45
+ <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
46
+
47
+ <%= form.actions do |action| %>
48
+ <%= action.submit props: {
49
+ text: "Apply",
50
+ data: {
51
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
52
+ },}%>
53
+ <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
54
+ <% end %>
55
+ <% end %>
56
+ <% end %>
57
+
58
+ <%= pb_rails("filter", props: {
59
+ min_width: "360px",
60
+ id: "1",
61
+ filters: [
62
+ { name: "name", value: "John Wick" },
63
+ { name: "city", value: "San Francisco"}
64
+ ],
65
+ sort_menu: [
66
+ { item: "Popularity", link: "?q[sorts]=managers_popularity+asc", active: true, direction: "desc" },
67
+ { item: "Mananger's Title", link: "?q[sorts]=managers_title+asc", active: false },
68
+ { item: "Manager's Name", link: "?q[sorts]=managers_name+asc", active: false },
69
+ ],
70
+ template: "default",
71
+ results: 1,
72
+ }) do %>
73
+ <% example_collection = [
74
+ OpenStruct.new(name: "USA", value: 1),
75
+ OpenStruct.new(name: "Canada", value: 2),
76
+ OpenStruct.new(name: "Brazil", value: 3),
77
+ OpenStruct.new(name: "Philippines", value: 4),
78
+ OpenStruct.new(name: "A galaxy far far away...", value: 5)
79
+ ] %>
80
+ <%= pb_rails("form", props: { form_system_options: { scope: :example, method: :get } }) do |form| %>
81
+ <%= form.text_field :example_text_field, props: { label: true } %>
82
+ <%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
83
+
84
+ <%= form.actions do |action| %>
85
+ <%= action.submit props: {
86
+ text: "Apply",
87
+ data: {
88
+ disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
89
+ },}%>
90
+ <%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
91
+ <% end %>
92
+ <% end %>
93
+ <% end %>
94
+ </div>
95
+
96
+ <script>
97
+ document.addEventListener("DOMContentLoaded", function() {
98
+ const toggleButton = document.getElementById('toggle-filter-button')
99
+ const skeletonFilterContentDiv = document.getElementById('skeleton-loading-filter-content')
100
+ const filterContentDiv = document.getElementById('filter-content')
101
+ const secondFilterContentDiv = document.getElementById('second-filter-content')
102
+
103
+ let isLoading = true
104
+
105
+ toggleButton.addEventListener('click', function() {
106
+ isLoading = !isLoading
107
+
108
+ if (isLoading) {
109
+ skeletonFilterContentDiv.style.display = 'block'
110
+ filterContentDiv.style.display = 'none'
111
+ toggleButton.textContent = 'Show Filter'
112
+ } else {
113
+ skeletonFilterContentDiv.style.display = 'none'
114
+ filterContentDiv.style.display = 'block'
115
+ toggleButton.textContent = 'Show Skeleton Loading'
116
+ }
117
+ })
118
+ })
119
+ </script>
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { Button, Card, Filter, Flex, Select, SkeletonLoading, TextInput } from "playbook-ui";
3
3
 
4
4
  const SortingChangeCallback = (sortOptions) => {
@@ -6,7 +6,8 @@ const SortingChangeCallback = (sortOptions) => {
6
6
  }
7
7
 
8
8
  const SkeletonLoadingFilter = (props) => {
9
- const isLoading = true
9
+ const [isLoading, setIsLoading] = useState(true)
10
+ const toggleLoading = () => setIsLoading((prev) => !prev)
10
11
 
11
12
  const options = [
12
13
  { value: 'USA' },
@@ -18,6 +19,13 @@ const SkeletonLoadingFilter = (props) => {
18
19
 
19
20
  return (
20
21
  <div>
22
+ <Button
23
+ marginBottom="md"
24
+ onClick={toggleLoading}
25
+ variant="secondary"
26
+ >
27
+ {isLoading ? "Show Filter" : "Show Skeleton Loading"}
28
+ </Button>
21
29
  <div>
22
30
  {isLoading ? (
23
31
  <Card
@@ -0,0 +1,15 @@
1
+ <%= pb_rails("skeleton_loading", props: { height: "100px", width: "50%" }) %>
2
+
3
+ <%= pb_rails("skeleton_loading", props: { gap: "md", height: "20px", margin_y: "md", stack: 3, width: "50px" }) %>
4
+
5
+ <%= pb_rails("card", props: { height: "200px", margin_bottom: "md", padding: "none", width: "100%" }) do %>
6
+ <%= pb_rails("skeleton_loading", props: { border_radius: "md", gap: "xl", height: "50%", width: "300px" }) %>
7
+ <% end %>
8
+
9
+ <%= pb_rails("card", props: { height: "200px", margin_bottom: "md", padding: "none", width: "100%" }) do %>
10
+ <%= pb_rails("skeleton_loading", props: { border_radius: "md", gap: "xl", height: "30%", stack: 2, width: "70%" }) %>
11
+ <% end %>
12
+
13
+ <%= pb_rails("skeleton_loading", props: { height: "150px", margin_y: "md", width: "150px" }) %>
14
+
15
+ <%= pb_rails("skeleton_loading", props: { border_radius: "rounded", height: "150px", width: "150px" }) %>
@@ -17,9 +17,11 @@ const SkeletonLoadingHeightWidth = (props) => (
17
17
  width="50px"
18
18
  {...props}
19
19
  />
20
- <Card htmlOptions={{ style: { height: '200px', width: '100%' }}}
20
+ <Card
21
+ height='200px'
21
22
  marginBottom="md"
22
23
  padding="none"
24
+ width='100%'
23
25
  {...props}
24
26
  >
25
27
  <SkeletonLoading
@@ -30,8 +32,10 @@ const SkeletonLoadingHeightWidth = (props) => (
30
32
  {...props}
31
33
  />
32
34
  </Card>
33
- <Card htmlOptions={{ style: { height: '200px', width: '100%' }}}
35
+ <Card
36
+ height='200px'
34
37
  padding="none"
38
+ width='100%'
35
39
  {...props}
36
40
  >
37
41
  <SkeletonLoading
@@ -0,0 +1,3 @@
1
+ The `height` and `width` props accept pixel and percentage values. If using a percentage for `height`, the parent container must have a set height.
2
+
3
+ Set the `height` and `width` props to the same value to make a square. A `rounded` border_radius will make a square a circle. If using percentages to make a square, your parent container must also be a square.
@@ -0,0 +1,3 @@
1
+ <%= pb_rails("skeleton_loading", props: { stack: 5 }) %>
2
+
3
+ <%= pb_rails("skeleton_loading", props: { gap: "md", padding_top: "xl", stack: 3 }) %>