playbook_ui 14.10.0.pre.alpha.PBNTR662stickyrightcolumnreact5160 → 14.10.0.pre.alpha.play1465attempt25272
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +11 -16
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +8 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.html.erb +43 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.html.erb +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +143 -95
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +50 -8
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +17 -14
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +78 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -3
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +7 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +2 -6
- data/app/pb_kits/playbook/pb_card/_card.scss +21 -3
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +18 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +40 -0
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +1 -13
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +64 -1
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +3 -1
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.html.erb +10 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.jsx +42 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.md +3 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_section_separator/section_separator.rb +4 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +2 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_description.md +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.html.erb +9 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius_rails.md +1 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.html.erb +7 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.html.erb +119 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.jsx +10 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.html.erb +15 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +6 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width_rails.md +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.html.erb +3 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.html.erb +63 -0
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.jsx +11 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +7 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +8 -12
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +48 -1
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +20 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +8 -1
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +23 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -2
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +12 -4
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +5 -1
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +8 -3
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +6 -1
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +21 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +13 -6
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +4 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +5 -5
- data/dist/chunks/{_typeahead-aym7Ky_O.js → _typeahead-BhT5aXCY.js} +2 -2
- data/dist/chunks/{_weekday_stacked-BZj1pop-.js → _weekday_stacked-DJOTNDSY.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +20 -6
- /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_border_radius.md → _skeleton_loading_border_radius_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_height_width.md → _skeleton_loading_height_width_react.md} +0 -0
@@ -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
|
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
|
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,63 @@
|
|
1
|
+
<%= pb_rails("button", props: { id: "toggle-user-button", margin_bottom: "md", text: "Show User", variant: "secondary" }) %>
|
2
|
+
|
3
|
+
<div id="skeleton-loading-user-content">
|
4
|
+
<%= pb_rails("flex", props: { align_items: "center" }) do %>
|
5
|
+
<%= pb_rails("skeleton_loading", props: { border_radius: "rounded", height: "38px", padding_right: "sm", width: "38px"}) %>
|
6
|
+
<%= pb_rails("skeleton_loading", props: { gap: "xxs", height: "18px", stack: 2, width: "161px"}) %>
|
7
|
+
<% end %>
|
8
|
+
<%= pb_rails("flex", props: { align_items: "start", padding_top: "md" }) do %>
|
9
|
+
<%= pb_rails("flex", props: { align_items: "center", flex_direction: "column" }) do %>
|
10
|
+
<%= pb_rails("skeleton_loading", props: { border_radius: "rounded", height: "100px", padding_bottom: "xs", width: "100px"}) %>
|
11
|
+
<%= pb_rails("skeleton_loading", props: { height: "32px", padding_bottom: "xxs", width: "144px"}) %>
|
12
|
+
<%= pb_rails("skeleton_loading", props: { height: "21px", width: "164px"}) %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div id="user-content" style="display: none;">
|
18
|
+
<div>
|
19
|
+
<%= pb_rails("user", props: {
|
20
|
+
name: "Anna Black",
|
21
|
+
title: "Remodeling Consultant",
|
22
|
+
orientation: "horizontal",
|
23
|
+
align: "left",
|
24
|
+
avatar_url: "https://randomuser.me/api/portraits/women/44.jpg"
|
25
|
+
}) %>
|
26
|
+
</div>
|
27
|
+
<div>
|
28
|
+
<%= pb_rails("flex", props: { align_items: "start", padding_top: "md" }) do %>
|
29
|
+
<%= pb_rails("user", props: {
|
30
|
+
name: "Anna Black",
|
31
|
+
title: "Remodeling Consultant",
|
32
|
+
orientation: "vertical",
|
33
|
+
align: "center",
|
34
|
+
size: "lg",
|
35
|
+
avatar_url: "https://randomuser.me/api/portraits/women/44.jpg"
|
36
|
+
}) %>
|
37
|
+
<% end %>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<script>
|
42
|
+
document.addEventListener("DOMContentLoaded", function() {
|
43
|
+
const toggleButton = document.getElementById('toggle-user-button')
|
44
|
+
const skeletonUserContentDiv = document.getElementById('skeleton-loading-user-content')
|
45
|
+
const userContentDiv = document.getElementById('user-content')
|
46
|
+
|
47
|
+
let isLoading = true
|
48
|
+
|
49
|
+
toggleButton.addEventListener('click', function() {
|
50
|
+
isLoading = !isLoading
|
51
|
+
|
52
|
+
if (isLoading) {
|
53
|
+
skeletonUserContentDiv.style.display = 'block'
|
54
|
+
userContentDiv.style.display = 'none'
|
55
|
+
toggleButton.textContent = 'Show User'
|
56
|
+
} else {
|
57
|
+
skeletonUserContentDiv.style.display = 'none'
|
58
|
+
userContentDiv.style.display = 'block'
|
59
|
+
toggleButton.textContent = 'Show Skeleton Loading'
|
60
|
+
}
|
61
|
+
})
|
62
|
+
})
|
63
|
+
</script>
|
@@ -1,11 +1,19 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { Flex, SkeletonLoading, User } from "playbook-ui";
|
1
|
+
import React, { useState } from 'react';
|
2
|
+
import { Button, Flex, SkeletonLoading, User } from "playbook-ui";
|
3
3
|
|
4
4
|
const SkeletonLoadingUser = (props) => {
|
5
|
-
const isLoading = true
|
5
|
+
const [isLoading, setIsLoading] = useState(true)
|
6
|
+
const toggleLoading = () => setIsLoading((prev) => !prev)
|
6
7
|
|
7
8
|
return (
|
8
9
|
<div>
|
10
|
+
<Button
|
11
|
+
marginBottom="md"
|
12
|
+
onClick={toggleLoading}
|
13
|
+
variant="secondary"
|
14
|
+
>
|
15
|
+
{isLoading ? "Show User" : "Show Skeleton Loading"}
|
16
|
+
</Button>
|
9
17
|
<div>
|
10
18
|
{isLoading ? (
|
11
19
|
<Flex alignItems="center">
|
@@ -1,8 +1,13 @@
|
|
1
1
|
examples:
|
2
2
|
|
3
3
|
rails:
|
4
|
-
|
5
|
-
|
4
|
+
- skeleton_loading_default: Default
|
5
|
+
- skeleton_loading_color: Color
|
6
|
+
- skeleton_loading_layout: Layout
|
7
|
+
- skeleton_loading_border_radius: Border Radius
|
8
|
+
- skeleton_loading_height_width: Height & Width
|
9
|
+
- skeleton_loading_user: User Component Example
|
10
|
+
- skeleton_loading_filter: Filter Component Example
|
6
11
|
|
7
12
|
react:
|
8
13
|
- skeleton_loading_default: Default
|
@@ -1,12 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# **combined_html_options
|
10
|
-
) do %>
|
11
|
-
<span>SKELETON_LOADING CONTENT</span>
|
12
|
-
<% end %>
|
1
|
+
<%= pb_content_tag do %>
|
2
|
+
<% stack.times do |index| %>
|
3
|
+
<div
|
4
|
+
class="<%= item_classname(index) %>"
|
5
|
+
style="<%= item_inline_styles %>"
|
6
|
+
></div>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
@@ -2,7 +2,54 @@
|
|
2
2
|
|
3
3
|
module Playbook
|
4
4
|
module PbSkeletonLoading
|
5
|
-
class SkeletonLoading <
|
5
|
+
class SkeletonLoading < Playbook::KitBase
|
6
|
+
prop :height, type: Playbook::Props::String,
|
7
|
+
default: "16px"
|
8
|
+
prop :width, type: Playbook::Props::String,
|
9
|
+
default: "100%"
|
10
|
+
prop :border_radius, type: Playbook::Props::Enum,
|
11
|
+
values: %w[none xs sm md lg xl rounded],
|
12
|
+
default: "sm"
|
13
|
+
prop :gap, type: Playbook::Props::Enum,
|
14
|
+
values: %w[none xxs xs sm md lg xl xxl],
|
15
|
+
default: "xxs"
|
16
|
+
prop :stack, type: Playbook::Props::Number,
|
17
|
+
default: 1
|
18
|
+
prop :color, type: Playbook::Props::Enum,
|
19
|
+
values: %w[default white],
|
20
|
+
default: "default"
|
21
|
+
prop :dark, type: Playbook::Props::Boolean,
|
22
|
+
default: false
|
23
|
+
|
24
|
+
def classname
|
25
|
+
generate_classname("pb_skeleton_loading")
|
26
|
+
end
|
27
|
+
|
28
|
+
def global_inline_props
|
29
|
+
{}
|
30
|
+
end
|
31
|
+
|
32
|
+
def item_classname(index = nil)
|
33
|
+
classes = [
|
34
|
+
"pb_skeleton_loading_item",
|
35
|
+
"border_radius_#{border_radius}",
|
36
|
+
"color_#{color}",
|
37
|
+
("dark" if dark),
|
38
|
+
gap_class(index),
|
39
|
+
]
|
40
|
+
classes.compact.join(" ")
|
41
|
+
end
|
42
|
+
|
43
|
+
def item_inline_styles
|
44
|
+
styles = []
|
45
|
+
styles << "height: #{height}"
|
46
|
+
styles << "width: #{width}"
|
47
|
+
styles.join("; ")
|
48
|
+
end
|
49
|
+
|
50
|
+
def gap_class(index = nil)
|
51
|
+
stack > 1 && index.to_i.positive? && gap != "none" ? "gap_#{gap}" : nil
|
52
|
+
end
|
6
53
|
end
|
7
54
|
end
|
8
55
|
end
|
@@ -4,6 +4,26 @@
|
|
4
4
|
display: block;
|
5
5
|
overflow-x: scroll;
|
6
6
|
|
7
|
+
// hides duplicate scroll bar for those that see two (byproduct of repeated table-responsive-scroll class
|
8
|
+
// hides outer scroll bar in chrome and safari
|
9
|
+
&:not(.table-responsive-scroll .table-responsive-scroll) {
|
10
|
+
&::-webkit-scrollbar {
|
11
|
+
height: 0px;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
// hides outer scroll bar in firefox
|
15
|
+
@supports (scrollbar-width: none) {
|
16
|
+
scrollbar-width: none;
|
17
|
+
.pb_table {
|
18
|
+
overflow-x: auto;
|
19
|
+
scrollbar-width: auto;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
// ensures visible inner scroll bar can scroll
|
23
|
+
.pb_table {
|
24
|
+
overflow-x: auto;
|
25
|
+
}
|
26
|
+
|
7
27
|
// Responsive Styles
|
8
28
|
@media (max-width: 1600px) {
|
9
29
|
&[class*="table-responsive-scroll"] {
|
@@ -123,6 +123,13 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
123
123
|
|
124
124
|
const childInput = children ? children.type === "input" : undefined
|
125
125
|
|
126
|
+
let formattedValue;
|
127
|
+
if (isMaskedInput && value) {
|
128
|
+
formattedValue = INPUTMASKS[mask].formatDefaultValue(value.toString())
|
129
|
+
} else {
|
130
|
+
formattedValue = value
|
131
|
+
}
|
132
|
+
|
126
133
|
const textInput = (
|
127
134
|
childInput ? React.cloneElement(children, { className: "text_input" }) :
|
128
135
|
(<input
|
@@ -138,7 +145,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
138
145
|
ref={ref}
|
139
146
|
required={required}
|
140
147
|
type={type}
|
141
|
-
value={
|
148
|
+
value={formattedValue}
|
142
149
|
/>)
|
143
150
|
)
|
144
151
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
type InputMask = {
|
2
2
|
format: (value: string) => string
|
3
|
+
formatDefaultValue: (value: string) => string
|
3
4
|
pattern: string
|
4
5
|
placeholder: string
|
5
6
|
}
|
@@ -8,6 +9,24 @@ type InputMaskDictionary = {
|
|
8
9
|
[key in 'currency' | 'zipCode' | 'postalCode' | 'ssn']: InputMask
|
9
10
|
}
|
10
11
|
|
12
|
+
const formatCurrencyDefaultValue = (value: string): string => {
|
13
|
+
// Remove non-numeric characters except for the decimal point
|
14
|
+
const numericValue = value.replace(/[^0-9.]/g, '')
|
15
|
+
|
16
|
+
if (!numericValue) return ''
|
17
|
+
|
18
|
+
// Parse the numeric value as a float to handle decimals
|
19
|
+
const dollars = parseFloat(numericValue)
|
20
|
+
if (isNaN(dollars) || dollars === 0) return ''
|
21
|
+
|
22
|
+
// Format as currency
|
23
|
+
return new Intl.NumberFormat('en-US', {
|
24
|
+
style: 'currency',
|
25
|
+
currency: 'USD',
|
26
|
+
maximumFractionDigits: 2,
|
27
|
+
}).format(dollars)
|
28
|
+
}
|
29
|
+
|
11
30
|
const formatCurrency = (value: string): string => {
|
12
31
|
const numericValue = value.replace(/[^0-9]/g, '').slice(0, 15)
|
13
32
|
|
@@ -42,22 +61,26 @@ const formatSSN = (value: string): string => {
|
|
42
61
|
export const INPUTMASKS: InputMaskDictionary = {
|
43
62
|
currency: {
|
44
63
|
format: formatCurrency,
|
64
|
+
formatDefaultValue: formatCurrencyDefaultValue,
|
45
65
|
// eslint-disable-next-line no-useless-escape
|
46
66
|
pattern: '^\\$\\d{1,3}(?:,\\d{3})*(?:\\.\\d{2})?$',
|
47
67
|
placeholder: '$0.00',
|
48
68
|
},
|
49
69
|
zipCode: {
|
50
70
|
format: formatBasicPostal,
|
71
|
+
formatDefaultValue: formatBasicPostal,
|
51
72
|
pattern: '\\d{5}',
|
52
73
|
placeholder: '12345',
|
53
74
|
},
|
54
75
|
postalCode: {
|
55
76
|
format: formatExtendedPostal,
|
77
|
+
formatDefaultValue: formatExtendedPostal,
|
56
78
|
pattern: '\\d{5}-\\d{4}',
|
57
79
|
placeholder: '12345-6789',
|
58
80
|
},
|
59
81
|
ssn: {
|
60
82
|
format: formatSSN,
|
83
|
+
formatDefaultValue: formatSSN,
|
61
84
|
pattern: '\\d{3}-\\d{2}-\\d{4}',
|
62
85
|
placeholder: '123-45-6789',
|
63
86
|
},
|
@@ -42,8 +42,8 @@ type TypeaheadProps = {
|
|
42
42
|
id?: string,
|
43
43
|
label?: string,
|
44
44
|
loadOptions?: string | Noop,
|
45
|
-
getOptionLabel?: string | (() =>
|
46
|
-
getOptionValue?: string | (() =>
|
45
|
+
getOptionLabel?: string | (() => string),
|
46
|
+
getOptionValue?: string | (() => string),
|
47
47
|
name?: string,
|
48
48
|
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
49
49
|
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
@@ -109,6 +109,7 @@ const Typeahead = ({
|
|
109
109
|
multiKit: '',
|
110
110
|
onCreateOption: null as null,
|
111
111
|
plusIcon: false,
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
112
113
|
onMultiValueClick: (_option: SelectValueType): any => undefined,
|
113
114
|
pillColor: pillColor,
|
114
115
|
...props,
|
@@ -1,16 +1,24 @@
|
|
1
1
|
import React, { useEffect } from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type ClearContainerProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
selectProps?: {
|
7
|
+
id: string,
|
8
|
+
},
|
9
|
+
clearValue: () => void,
|
10
|
+
}
|
11
|
+
|
12
|
+
const ClearContainer = (props: ClearContainerProps): React.ReactElement => {
|
5
13
|
const { selectProps, clearValue } = props
|
6
14
|
useEffect(() => {
|
7
15
|
document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, clearValue)
|
8
|
-
}, [
|
16
|
+
}, [clearValue, selectProps.id])
|
9
17
|
|
10
18
|
return (
|
11
19
|
<components.ClearIndicator
|
12
|
-
|
13
|
-
|
20
|
+
className="clear_indicator"
|
21
|
+
{...props}
|
14
22
|
/>
|
15
23
|
)
|
16
24
|
}
|
@@ -5,7 +5,11 @@ import Flex from '../../pb_flex/_flex'
|
|
5
5
|
import TextInput from '../../pb_text_input/_text_input'
|
6
6
|
|
7
7
|
type Props = {
|
8
|
-
|
8
|
+
selectProps: {
|
9
|
+
dark?: boolean,
|
10
|
+
label: string,
|
11
|
+
error?: string,
|
12
|
+
},
|
9
13
|
}
|
10
14
|
|
11
15
|
const TypeaheadControl = (props: Props) => (
|
@@ -1,10 +1,15 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type IndicatorsContainerProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
}
|
7
|
+
|
8
|
+
|
9
|
+
const IndicatorsContainer = (props: IndicatorsContainerProps): React.ReactElement => (
|
5
10
|
<components.IndicatorsContainer
|
6
|
-
|
7
|
-
|
11
|
+
className="text_input_indicators"
|
12
|
+
{...props}
|
8
13
|
/>
|
9
14
|
)
|
10
15
|
|
@@ -1,7 +1,12 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
4
|
+
type MenuListProps = {
|
5
|
+
children: React.ReactNode,
|
6
|
+
footer: React.ReactNode,
|
7
|
+
}
|
8
|
+
|
9
|
+
const MenuList = (props: MenuListProps): React.ReactElement => {
|
5
10
|
return (
|
6
11
|
<components.MenuList {...props}>
|
7
12
|
{props.children}
|
@@ -3,7 +3,22 @@ import { components } from 'react-select'
|
|
3
3
|
|
4
4
|
import User from '../../pb_user/_user'
|
5
5
|
|
6
|
-
|
6
|
+
type OptionProps = {
|
7
|
+
children: React.ReactNode,
|
8
|
+
label?: string,
|
9
|
+
data: {
|
10
|
+
imageUrl?: string,
|
11
|
+
},
|
12
|
+
selectProps: {
|
13
|
+
dark?: boolean,
|
14
|
+
valueComponent?: (data: {
|
15
|
+
imageUrl?: string,
|
16
|
+
}) => React.ReactNode,
|
17
|
+
},
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
const Option = (props: OptionProps): React.ReactElement => {
|
7
22
|
const {
|
8
23
|
imageUrl,
|
9
24
|
} = props.data
|
@@ -14,11 +29,11 @@ const Option = (props: any) => {
|
|
14
29
|
<>
|
15
30
|
{!valueComponent && imageUrl &&
|
16
31
|
<User
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
32
|
+
align="left"
|
33
|
+
avatarUrl={imageUrl}
|
34
|
+
dark={props.selectProps.dark}
|
35
|
+
name={props.label}
|
36
|
+
orientation="horizontal"
|
22
37
|
/>
|
23
38
|
}
|
24
39
|
|
@@ -4,19 +4,26 @@ import { components } from 'react-select'
|
|
4
4
|
import Flex from '../../pb_flex/_flex'
|
5
5
|
import Icon from '../../pb_icon/_icon'
|
6
6
|
|
7
|
-
|
7
|
+
type PlaceholderProps = {
|
8
|
+
children: React.ReactNode,
|
9
|
+
selectProps: {
|
10
|
+
plusIcon?: boolean,
|
11
|
+
},
|
12
|
+
}
|
13
|
+
|
14
|
+
const Placeholder = (props: PlaceholderProps): React.ReactElement => (
|
8
15
|
<>
|
9
16
|
<Flex
|
10
|
-
|
11
|
-
|
17
|
+
align="center"
|
18
|
+
className="placeholder"
|
12
19
|
>
|
13
20
|
<components.IndicatorsContainer
|
14
|
-
|
21
|
+
{...props}
|
15
22
|
/>
|
16
23
|
{props.selectProps.plusIcon &&
|
17
24
|
<Icon
|
18
|
-
|
19
|
-
|
25
|
+
className="typeahead-plus-icon"
|
26
|
+
icon="plus"
|
20
27
|
/>
|
21
28
|
}
|
22
29
|
</Flex>
|