playbook_ui 13.0.0 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +1 -1
  3. data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +7 -0
  4. data/app/pb_kits/playbook/pb_file_upload/docs/_description.md +0 -7
  5. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom.html.erb +7 -0
  6. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom.md +1 -0
  7. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_default.html.erb +3 -0
  8. data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +2 -0
  9. data/app/pb_kits/playbook/pb_file_upload/docs/test.html +25 -0
  10. data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +17 -0
  11. data/app/pb_kits/playbook/pb_file_upload/file_upload.rb +34 -0
  12. data/app/pb_kits/playbook/pb_kit/dateTime.ts +55 -48
  13. data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +16 -14
  14. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +86 -115
  15. data/app/pb_kits/playbook/pb_nav/_collapsible_trail_mixin.scss +16 -0
  16. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +58 -58
  17. data/app/pb_kits/playbook/pb_nav/_item.tsx +242 -138
  18. data/app/pb_kits/playbook/pb_nav/_nav.scss +38 -0
  19. data/app/pb_kits/playbook/pb_nav/_nav.tsx +17 -1
  20. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +9 -11
  21. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +50 -59
  22. data/app/pb_kits/playbook/pb_nav/docs/_block_no_title_nav.jsx +1 -1
  23. data/app/pb_kits/playbook/pb_nav/docs/_borderless_nav.jsx +4 -1
  24. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.html.erb +4 -4
  25. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +4 -10
  26. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -1
  27. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +6 -1
  28. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_emphasize.jsx → _collapsible_nav_item_spacing.jsx} +18 -17
  29. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_item_spacing.md +1 -0
  30. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_with_all_options.html.erb +23 -0
  31. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_with_all_options.jsx +55 -0
  32. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_with_all_options.md +4 -0
  33. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_font_control.html.erb +6 -0
  34. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_font_control.jsx +46 -0
  35. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_font_control.md +4 -0
  36. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.html.erb +6 -0
  37. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.jsx +47 -0
  38. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.md +1 -0
  39. data/app/pb_kits/playbook/pb_nav/docs/_no_highlight_nav.jsx +4 -1
  40. data/app/pb_kits/playbook/pb_nav/docs/_subtle_nav.jsx +4 -1
  41. data/app/pb_kits/playbook/pb_nav/docs/_subtle_with_icons_nav.jsx +4 -1
  42. data/app/pb_kits/playbook/pb_nav/docs/example.yml +10 -5
  43. data/app/pb_kits/playbook/pb_nav/docs/index.js +4 -1
  44. data/app/pb_kits/playbook/pb_nav/item.html.erb +19 -12
  45. data/app/pb_kits/playbook/pb_nav/item.rb +55 -14
  46. data/app/pb_kits/playbook/pb_nav/nav.html.erb +3 -1
  47. data/app/pb_kits/playbook/pb_nav/navTypes.ts +25 -0
  48. data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +0 -1
  49. data/app/pb_kits/playbook/pb_select/docs/_select_multiple.md +1 -1
  50. data/app/pb_kits/playbook/pb_time/_time.tsx +1 -1
  51. data/dist/playbook-rails.js +5 -5
  52. data/lib/playbook/version.rb +2 -2
  53. metadata +21 -6
  54. data/app/pb_kits/playbook/pb_nav/_mixins.scss +0 -5
  55. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +0 -23
  56. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68b8019423c98f0b17cb991be96ff5eaf31f5ec127a81e1079f1d30d89bf2f8a
4
- data.tar.gz: 266d1ba7ec9735ab40b632b590b448742429e780ef5635f92bd9e74b0e0fc6df
3
+ metadata.gz: 6c03b530a4b2b16b5dcf7ea348a4aa6a66db48f68359fed8469e47746c6fad2c
4
+ data.tar.gz: 5695a441ba55870888683da55c49814c94de842a952614d711325bfd1813fe35
5
5
  SHA512:
6
- metadata.gz: b2a9a36c332c8f6cf8ced66861d01e6bccaf17d6ace709c3c1e3a180f89a145d8d4d98beecf8ba52cbdde6d41129238df73b0c364e9997ae4f225587a6d85c11
7
- data.tar.gz: 4f42ad5ca624705aa6139ebf6b698ede8350fe94dd30fafbce662a433c6a898fd16ee47d22710ca648999c4bbd4ef9457458acc44c9c35f0d22823e84276d2bd
6
+ metadata.gz: cb2dd83ad7e0030f750adb29cab24f33d979922ac9763e35de399c8df427053ae501e0b24a168116c6fccf876885bf7fc9e7e0356b94bae6ef7ccb14cf7bf45c
7
+ data.tar.gz: 51fa2673e72139fdfce189b16a2364430eb8518fb9480d5b8c203bd66956478654506a20e358fbd6e6de955c97270503ed69f92857fe51789ddc30595daff9b3
@@ -104,7 +104,7 @@ const CollapsibleMain = ({
104
104
  }
105
105
 
106
106
  return (
107
- <div className={classnames(mainCSS, className, mainSpacing)}>
107
+ <div className={classnames(mainCSS, mainSpacing, className)}>
108
108
  <div onClick={handleCollapsibleClick}>
109
109
  <Flex
110
110
  spacing="between"
@@ -3,4 +3,11 @@
3
3
  border: 1px #ccc dashed;
4
4
  text-align: center;
5
5
  }
6
+ ::file-selector-button {
7
+ visibility: hidden;
8
+ padding: 0;
9
+ border: none;
10
+ width: 0;
11
+ }
6
12
  }
13
+
@@ -1,7 +0,0 @@
1
- This kit provides a drag and drop interface for file uploads. Currently, the kit leverages [react-dropzone](https://github.com/react-dropzone/react-dropzone).
2
-
3
- ### Props
4
-
5
- `accept: [String]` Use this prop to set the list of valid file types
6
- `customMessage: [String]` Use this prop to set a custom message, replacing the default text
7
- `onFilesAccepted: Function` The callback function, providing the list of dropped files
@@ -0,0 +1,7 @@
1
+ <%= pb_rails("file_upload", props: {id: "import_file"}) do %>
2
+ <input
3
+ id="import_file"
4
+ type="file"
5
+ name="import_file"
6
+ />
7
+ <% end %>
@@ -0,0 +1 @@
1
+ The `id` for the File Upload and the existing input you are choosing to wrap with our Kit with must match each other. This will ensure that the click on the button a.k.a, the underlying label's `for`, triggers the File Upload.
@@ -0,0 +1,3 @@
1
+ <%= pb_rails("file_upload") %>
2
+
3
+
@@ -1,6 +1,8 @@
1
1
  examples:
2
2
 
3
3
  rails:
4
+ - file_upload_default: File Upload
5
+ - file_upload_custom: Custom
4
6
 
5
7
  react:
6
8
  - file_upload_default: Default List of files to upload
@@ -0,0 +1,25 @@
1
+
2
+ <div class="pb_file_upload_kit" id="import_file">
3
+ <div class="pb_form_group_kit cursor_pointer">
4
+ <label for="import_file" class="pb_button_kit_secondary_inline_enabled">Upload File</label>
5
+ <div class="pb_text_input_kit">
6
+ <div class=" text_input_wrapper">
7
+ <input placeholder="custom-placeholder" id="import_file" type="file">
8
+ </div>
9
+ </div>
10
+ </div>
11
+ </div>
12
+
13
+ <h1>not custom</h1>
14
+
15
+ <div class="pb_file_upload_kit" id="test">
16
+ <div class="pb_form_group_kit cursor_pointer">
17
+ <label for="upload-test" class="pb_button_kit_secondary_inline_enabled">Upload File</label>
18
+ <div class="pb_text_input_kit">
19
+ <div class=" text_input_wrapper">
20
+ <input class="text_input cursor_pointer" id="upload-test" type="file" classname="cursor_pointer">
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </div>
25
+
@@ -0,0 +1,17 @@
1
+ <%= content_tag("div",
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id) do %>
6
+ <%= pb_rails("form_group", props: {cursor: "pointer", full_width: object.full_width}) do %>
7
+ <label for="upload-<%= object.id %>" class="pb_button_kit_secondary_inline_enabled"><%= "#{object.label}" %></label>
8
+ <%= pb_rails("text_input", props: {
9
+ type: "file",
10
+ input_options: {
11
+ id: "upload-#{object.id}",
12
+ classname: "cursor_pointer",
13
+ }.merge(object.input_options)
14
+ }) %>
15
+ <% end %>
16
+ </label>
17
+ <% end %>
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbFileUpload
5
+ class FileUpload < Playbook::KitBase
6
+ prop :accept, type: Playbook::Props::String,
7
+ default: ""
8
+
9
+ prop :files, type: Playbook::Props::Array,
10
+ default: []
11
+
12
+ prop :label, type: Playbook::Props::String,
13
+ default: "Upload File"
14
+
15
+ prop :placeholder, type: Playbook::Props::String,
16
+ default: "No file"
17
+
18
+ prop :full_width, type: Playbook::Props::Boolean,
19
+ default: false
20
+
21
+ prop :input_options, type: Playbook::Props::Hash,
22
+ default: {}
23
+
24
+ def classname
25
+ file_upload_class = generate_classname("pb_file_upload_kit")
26
+ file_upload_class + full_width_class
27
+ end
28
+
29
+ def full_width_class
30
+ full_width ? " full_width" : ""
31
+ end
32
+ end
33
+ end
34
+ end
@@ -17,92 +17,97 @@ const formatDate = (newDate: Date | string) => {
17
17
 
18
18
  export const toMinute = (newDate: Date | string, timeZone?: string): string => {
19
19
  const date = formatDate(newDate)
20
+
20
21
  if (timeZone) {
21
- return date.toLocaleTimeString(undefined, { timeZone, hour: "2-digit", minute: "2-digit" }).slice(3, 5);
22
+ return date.toLocaleTimeString("en-US", { timeZone, hour: "2-digit", minute: "2-digit" }).slice(3, 5);
22
23
  } else {
23
- return date.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" }).slice(3, 5);
24
+ return date.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" }).slice(3, 5);
24
25
  }
25
26
  }
26
27
 
27
28
  export const toHour = (newDate: Date | string, timeZone?: string): string => {
28
29
  const date = formatDate(newDate)
30
+
29
31
  if (timeZone) {
30
- return date.toLocaleTimeString(undefined, { timeZone, hour: "numeric" }).split(' ')[0];
32
+ return date.toLocaleTimeString("en-US", { timeZone, hour: "numeric" }).split(' ')[0];
31
33
  } else {
32
- return date.toLocaleTimeString(undefined, { hour: "numeric" }).split(' ')[0];
34
+ return date.toLocaleTimeString("en-US", { hour: "numeric" }).split(' ')[0];
33
35
  }
34
36
  }
35
37
 
36
38
  export const toDay = (newDate: Date | string, timeZone?: string): number => {
37
- if (timeZone) {
38
- const date = new Date(formatDate(newDate).toLocaleString(undefined, { timeZone }));
39
- return date.getDate()
40
- } else {
41
- const date = formatDate(newDate)
42
- return date.getDate()
43
- }
39
+ if (timeZone) {
40
+ const date = new Date(formatDate(newDate).toLocaleString("en-US", { timeZone }));
41
+ return date.getDate()
42
+ } else {
43
+ const date = formatDate(newDate)
44
+ return date.getDate()
45
+ }
44
46
  }
45
47
 
46
48
  export const toDayAbbr = (newDate: Date | string): string => {
47
49
  const date = formatDate(newDate)
48
- return ABBR_DAYS[date.getUTCDay()]
50
+ return ABBR_DAYS[date.getDay()]
49
51
  }
50
52
 
51
53
  export const toWeekday = (newDate: Date | string): string => {
52
- const date = formatDate(newDate)
53
- return days[date.getUTCDay()]
54
+ const date = formatDate(newDate)
55
+ return days[date.getDay()]
54
56
  }
55
57
 
56
58
  export const toMonth = (newDate: Date | string, timeZone?: string): string => {
57
- if (timeZone) {
58
- const date = new Date(formatDate(newDate).toLocaleString(undefined, { timeZone }));
59
- return months[date.getUTCMonth()]
60
- } else {
61
- const date = formatDate(newDate)
62
- return months[date.getUTCMonth()]
63
- }
59
+ if (timeZone) {
60
+ const date = new Date(formatDate(newDate).toLocaleString("en-US", { timeZone }));
61
+ return months[date.getMonth()]
62
+ } else {
63
+ const date = formatDate(newDate)
64
+ return months[date.getMonth()]
65
+ }
64
66
  }
65
67
 
66
68
  export const toMonthNum = (newDate: Date | string): number => {
67
69
  const date = formatDate(newDate)
68
- return date.getUTCMonth() +1
70
+ return date.getMonth() + 1
69
71
  }
70
72
 
71
73
  export const toYear = (newDate: Date | string, timeZone?: string): number => {
72
- if (timeZone) {
73
- const date = new Date(newDate.toLocaleString(undefined, { timeZone }));
74
- return date.getUTCFullYear()
75
- } else {
76
- const date = new Date(newDate)
77
- return date.getUTCFullYear()
78
- }
74
+ if (timeZone) {
75
+ const date = new Date(formatDate(newDate).toLocaleString("en-US", { timeZone }));
76
+ return date.getFullYear()
77
+ } else {
78
+ const date = formatDate(newDate)
79
+ return date.getFullYear()
80
+ }
79
81
  }
80
82
 
81
83
  export const toTime = (newDate: Date | string, timeZone?: string): string => {
82
84
  const date = formatDate(newDate)
85
+
83
86
  if (timeZone) {
84
- return date.toLocaleTimeString(undefined, { timeZone, timeStyle: "short" }).split(' ')[0];
87
+ return date.toLocaleTimeString("en-US", { timeZone, timeStyle: "short" }).split(' ')[0];
85
88
  } else {
86
- return date.toLocaleTimeString(undefined, { timeStyle: "short" }).split(' ')[0];
89
+ return date.toLocaleTimeString("en-US", { timeStyle: "short" }).split(' ')[0];
87
90
  }
88
91
  }
89
92
 
90
93
  export const toMeridiem = (newDate: Date | string, timeZone?: string): string => {
91
- const date = formatDate(newDate)
92
- if (timeZone) {
93
- return date.toLocaleString(undefined, { timeZone, hour12: true }).slice(-2).charAt(0).toLocaleLowerCase();
94
- } else {
95
- return date.toLocaleString(undefined, { hour12: true }).slice(-2).charAt(0).toLocaleLowerCase();
96
- }
94
+ const date = formatDate(newDate)
95
+
96
+ if (timeZone) {
97
+ return date.toLocaleString("en-US", { timeZone, hour12: true }).slice(-2).charAt(0).toLocaleLowerCase();
98
+ } else {
99
+ return date.toLocaleString("en-US", { hour12: true }).slice(-2).charAt(0).toLocaleLowerCase();
100
+ }
97
101
  }
98
102
 
99
103
  export const toTimeZone = (newDate: Date | string, timeZone?: string): string => {
100
- const date = formatDate(newDate)
101
- if (timeZone) {
102
- return date.toLocaleString(undefined, { timeZone, timeZoneName: "short" }).split(' ')[3];
103
- } else {
104
- return date.toLocaleString(undefined, { timeZoneName: "short" }).split(' ')[3];
105
- }
104
+ const date = formatDate(newDate)
105
+
106
+ if (timeZone) {
107
+ return date.toLocaleString("en-US", { timeZone, timeZoneName: "short" }).split(' ')[3];
108
+ } else {
109
+ return date.toLocaleString("en-US", { timeZoneName: "short" }).split(' ')[3];
110
+ }
106
111
  }
107
112
 
108
113
  export const toTimeWithMeridiem = (newDate: Date | string, timeZone: string): string => {
@@ -111,15 +116,17 @@ export const toTimeWithMeridiem = (newDate: Date | string, timeZone: string): st
111
116
  }
112
117
 
113
118
  export const toIso = (newDate: Date | string): string => {
114
- const date = formatDate(newDate)
115
- return date.toISOString()
119
+ const date = formatDate(newDate)
120
+ return date.toISOString()
116
121
  }
117
122
 
118
123
  export const fromNow = (newDate: Date | string): string => {
119
124
  const startDate = formatDate(newDate).getTime()
120
125
  const endDate = new Date().getTime()
121
126
  const elapsedTime = endDate - startDate
122
- let elapsedTimeString = `${Math.round(elapsedTime / (365.25 * 24 * 60 * 60 * 1000))} years ago.`; // 730+ days
127
+ let elapsedTimeString = `${Math.round(elapsedTime / (365.25 * 24 * 60 * 60 * 1000))} years ago`; // 730+ days
128
+
129
+ const MILLISECONDS_IN_A_MONTH = 30.44 * 24 * 60 * 60 * 1000
123
130
 
124
131
  const elapsedTimeData = [
125
132
  { min: 0, max: 44999, value: "a few seconds ago" }, // 0-44 seconds
@@ -130,7 +137,7 @@ export const fromNow = (newDate: Date | string): string => {
130
137
  { min: 75700000, max: 172899999, value: "a day ago" }, // 22-48 hours
131
138
  { min: 172900000, max: 2169999999, value: `${Math.round(elapsedTime / 86400000)} days ago`}, // 2-25 days
132
139
  { min: 2170000000, max: 5184999999, value: "a month ago"}, // 26-60 days
133
- { min: 5185000000, max: 27561699999, value: `${Math.round(elapsedTime / 30.44 * 24 * 60 * 60 * 1000)} months ago`}, // 60-319 days
140
+ { min: 5185000000, max: 27561699999, value: `${Math.round(elapsedTime / MILLISECONDS_IN_A_MONTH)} months ago`}, // 60-319 days
134
141
  { min: 27561700000, max: 63072999999, value: "a year ago"}, // 320-730 days
135
142
  ];
136
143
 
@@ -149,7 +156,7 @@ export const toCustomFormat = (newDate: Date | string, format = 'month_day'): st
149
156
  if (format == "month_day") {
150
157
  return `${toMonthNum(date)}/${toDay(date)}`
151
158
  } else {
152
- return `${date.toLocaleString(undefined, { month: "short" })} ${toDay(date)}`
159
+ return `${date.toLocaleString("en-US", { month: "short" })} ${toDay(date)}`
153
160
  }
154
161
  }
155
162
 
@@ -1,22 +1,24 @@
1
1
  @mixin bold {
2
2
  @include subtle;
3
3
 
4
- [class*=pb_nav_list_kit_item] {
5
- &[class*=_active] [class*=_link] {
6
- background-color: $primary;
7
- color: $white;
8
- box-shadow: $shadow_deep;
9
- @media (hover:hover) {
10
- &:hover {
11
- background-color: darken($primary, 4%);
12
- [class*=_text],[class*=_icon] {
13
- color: $white;
4
+ [class*=pb_nav_list_kit_item][class*=pb_nav_list_item]{
5
+ &[class*=_link] {
6
+ &[class*=_active] {
7
+ background-color: $primary;
8
+ color: $white;
9
+ box-shadow: $shadow_deep;
10
+ @media (hover:hover) {
11
+ &:hover {
12
+ background-color: darken($primary, 4%);
13
+ [class*=_text],[class*=_icon] {
14
+ color: $white;
15
+ }
14
16
  }
15
17
  }
18
+ [class*=_text],[class*=_icon] {
19
+ font-weight: $bolder;
20
+ }
16
21
  }
17
- [class*=_text],[class*=_icon] {
18
- font-weight: $bolder;
19
- }
20
- }
22
+ }
21
23
  }
22
24
  }