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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +1 -1
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +7 -0
- data/app/pb_kits/playbook/pb_file_upload/docs/_description.md +0 -7
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom.html.erb +7 -0
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom.md +1 -0
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_default.html.erb +3 -0
- data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_file_upload/docs/test.html +25 -0
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +17 -0
- data/app/pb_kits/playbook/pb_file_upload/file_upload.rb +34 -0
- data/app/pb_kits/playbook/pb_kit/dateTime.ts +55 -48
- data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +16 -14
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +86 -115
- data/app/pb_kits/playbook/pb_nav/_collapsible_trail_mixin.scss +16 -0
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +58 -58
- data/app/pb_kits/playbook/pb_nav/_item.tsx +242 -138
- data/app/pb_kits/playbook/pb_nav/_nav.scss +38 -0
- data/app/pb_kits/playbook/pb_nav/_nav.tsx +17 -1
- data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +9 -11
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +50 -59
- data/app/pb_kits/playbook/pb_nav/docs/_block_no_title_nav.jsx +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_borderless_nav.jsx +4 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.html.erb +4 -4
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +4 -10
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +6 -1
- data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_emphasize.jsx → _collapsible_nav_item_spacing.jsx} +18 -17
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_item_spacing.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_with_all_options.html.erb +23 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_with_all_options.jsx +55 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_with_all_options.md +4 -0
- data/app/pb_kits/playbook/pb_nav/docs/_nav_with_font_control.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_nav_with_font_control.jsx +46 -0
- data/app/pb_kits/playbook/pb_nav/docs/_nav_with_font_control.md +4 -0
- data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.html.erb +6 -0
- data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.jsx +47 -0
- data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_no_highlight_nav.jsx +4 -1
- data/app/pb_kits/playbook/pb_nav/docs/_subtle_nav.jsx +4 -1
- data/app/pb_kits/playbook/pb_nav/docs/_subtle_with_icons_nav.jsx +4 -1
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +10 -5
- data/app/pb_kits/playbook/pb_nav/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +19 -12
- data/app/pb_kits/playbook/pb_nav/item.rb +55 -14
- data/app/pb_kits/playbook/pb_nav/nav.html.erb +3 -1
- data/app/pb_kits/playbook/pb_nav/navTypes.ts +25 -0
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +0 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_multiple.md +1 -1
- data/app/pb_kits/playbook/pb_time/_time.tsx +1 -1
- data/dist/playbook-rails.js +5 -5
- data/lib/playbook/version.rb +2 -2
- metadata +21 -6
- data/app/pb_kits/playbook/pb_nav/_mixins.scss +0 -5
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +0 -23
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c03b530a4b2b16b5dcf7ea348a4aa6a66db48f68359fed8469e47746c6fad2c
|
4
|
+
data.tar.gz: 5695a441ba55870888683da55c49814c94de842a952614d711325bfd1813fe35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
107
|
+
<div className={classnames(mainCSS, mainSpacing, className)}>
|
108
108
|
<div onClick={handleCollapsibleClick}>
|
109
109
|
<Flex
|
110
110
|
spacing="between"
|
@@ -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 @@
|
|
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,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(
|
22
|
+
return date.toLocaleTimeString("en-US", { timeZone, hour: "2-digit", minute: "2-digit" }).slice(3, 5);
|
22
23
|
} else {
|
23
|
-
return date.toLocaleTimeString(
|
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(
|
32
|
+
return date.toLocaleTimeString("en-US", { timeZone, hour: "numeric" }).split(' ')[0];
|
31
33
|
} else {
|
32
|
-
return date.toLocaleTimeString(
|
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
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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.
|
50
|
+
return ABBR_DAYS[date.getDay()]
|
49
51
|
}
|
50
52
|
|
51
53
|
export const toWeekday = (newDate: Date | string): string => {
|
52
|
-
|
53
|
-
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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.
|
70
|
+
return date.getMonth() + 1
|
69
71
|
}
|
70
72
|
|
71
73
|
export const toYear = (newDate: Date | string, timeZone?: string): number => {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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(
|
87
|
+
return date.toLocaleTimeString("en-US", { timeZone, timeStyle: "short" }).split(' ')[0];
|
85
88
|
} else {
|
86
|
-
return date.toLocaleTimeString(
|
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
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
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
|
-
|
115
|
-
|
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
|
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 /
|
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(
|
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*=
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
18
|
-
font-weight: $bolder;
|
19
|
-
}
|
20
|
-
}
|
22
|
+
}
|
21
23
|
}
|
22
24
|
}
|