playbook_ui 13.8.0 → 13.9.0.pre.alpha.PLAY962SingleSelect1261
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_button/_button.tsx +1 -6
- data/app/pb_kits/playbook/pb_button/docs/_button_reaction.html.erb +1 -1
- data/app/pb_kits/playbook/pb_button/docs/_button_reaction.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -7
- data/app/pb_kits/playbook/pb_message/_message_mixins.scss +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +27 -22
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +2 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +258 -111
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.html.erb +6 -7
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.jsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.html.erb +73 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.jsx +87 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +3 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +7 -0
- data/app/pb_kits/playbook/utilities/validEmojiChecker.ts +6 -0
- data/dist/playbook-rails.js +6 -6
- data/lib/playbook/version.rb +2 -2
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbbb7405fff8ba7bff61edf5ab1b7a454b62f10fbf0ce7373a053dd7e938fd41
|
4
|
+
data.tar.gz: 88cf1a1646d62f2633ff8b49905dfb7ffab11faea0466627d644016892be5b73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27dd8117514678def0ba2ae25d01e52dd731af744bfeaafc13ae53166604ec41403b513943ea2f9217e3c72c63d23b7b9b8c625dfe2180837ec86c01586be4c0
|
7
|
+
data.tar.gz: 84fd12d4ed1dd1e67a6bb3a8dc4e9f96fd2f67272048a6f7d0ed686fc1caac9851f254686391b2abae25237e5f6cdd4bf49520c46a424a253a766d1d98b402c5
|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
4
4
|
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
5
|
+
import { isValidEmoji } from '../utilities/validEmojiChecker'
|
5
6
|
|
6
7
|
import Icon from '../pb_icon/_icon'
|
7
8
|
import Caption from "../pb_caption/_caption"
|
@@ -38,12 +39,6 @@ type ButtonPropTypes = {
|
|
38
39
|
wrapperClass?: string,
|
39
40
|
} & GlobalProps
|
40
41
|
|
41
|
-
const isValidEmoji = (emoji: string) => {
|
42
|
-
// Using regular expression to check if the string is a valid emoji/emoji Unicode
|
43
|
-
const emojiRegex = /^(\p{Emoji}|\uFE0F)+$/u;
|
44
|
-
return emojiRegex.test(emoji);
|
45
|
-
};
|
46
|
-
|
47
42
|
const buttonClassName = (props: ButtonPropTypes) => {
|
48
43
|
const {
|
49
44
|
disabled = false,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= pb_rails("button", props: { count: 153, highlight: false, icon: "🎉", classname: "count", id: "reaction-button-highlight", variant: "reaction" }) %>
|
2
|
-
<%= pb_rails("button", props: { count: 5, icon: "
|
2
|
+
<%= pb_rails("button", props: { count: 5, icon: "1️⃣", variant: "reaction", margin_left: "lg" }) %>
|
3
3
|
<%= pb_rails("button", props: { variant: "reaction", margin_left: "lg" }) %>
|
4
4
|
<%= pb_rails("button", props: { icon: "user", variant: "reaction", margin_left: "lg" }) %>
|
5
5
|
|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
4
4
|
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
5
|
+
import { isValidEmoji } from '../utilities/validEmojiChecker'
|
5
6
|
|
6
7
|
export type IconSizes = "lg"
|
7
8
|
| "xs"
|
@@ -104,13 +105,6 @@ const Icon = (props: IconProps) => {
|
|
104
105
|
const ariaProps: {[key: string]: any} = buildAriaProps(aria)
|
105
106
|
const dataProps: {[key: string]: any} = buildDataProps(data)
|
106
107
|
|
107
|
-
const isValidEmoji = (emoji: string) => {
|
108
|
-
// Using regular expression to check if the string is a valid emoji/emoji Unicode
|
109
|
-
const emojiRegex = /^(\p{Emoji}|\uFE0F)+$/u;
|
110
|
-
return emojiRegex.test(emoji);
|
111
|
-
};
|
112
|
-
|
113
|
-
|
114
108
|
// Add a conditional here to show only the SVG if custom
|
115
109
|
const displaySVG = (customIcon: any) => {
|
116
110
|
if (customIcon)
|
@@ -1,22 +1,9 @@
|
|
1
|
-
//
|
2
|
-
|
3
|
-
data: { [key: string]: any }[],
|
4
|
-
item: { [key: string]: any }
|
5
|
-
) => {
|
6
|
-
if (item.parent_id) {
|
7
|
-
const ancestor = filterFormattedDataById(data, item.parent_id);
|
8
|
-
ancestor[0].checked = false;
|
9
|
-
ancestor[0].parent_id && getAncestorsOfUnchecked(data, ancestor[0]);
|
10
|
-
}
|
11
|
-
return data;
|
12
|
-
};
|
13
|
-
|
14
|
-
//function is going over formattedData and returning all objects that match the
|
15
|
-
//id of the clicked item from the dropdown
|
1
|
+
// Function is going over formattedData and returning all objects that match the
|
2
|
+
// ID of the clicked item from the dropdown
|
16
3
|
export const filterFormattedDataById = (
|
17
4
|
formattedData: { [key: string]: any }[],
|
18
5
|
id: string
|
19
|
-
) => {
|
6
|
+
): { [key: string]: any }[] => {
|
20
7
|
const matched: { [key: string]: any }[] = [];
|
21
8
|
const recursiveSearch = (data: { [key: string]: any }[], term: string) => {
|
22
9
|
for (const item of data) {
|
@@ -38,7 +25,7 @@ export const filterFormattedDataById = (
|
|
38
25
|
export const findByFilter = (
|
39
26
|
formattedData: { [key: string]: any }[],
|
40
27
|
searchTerm: string
|
41
|
-
) => {
|
28
|
+
): { [key: string]: any }[] => {
|
42
29
|
const matchedItems: { [key: string]: any }[] = [];
|
43
30
|
const recursiveSearch = (data: { [key: string]: any }[], term: string) => {
|
44
31
|
for (const item of data) {
|
@@ -56,7 +43,20 @@ export const findByFilter = (
|
|
56
43
|
return matchedItems;
|
57
44
|
};
|
58
45
|
|
59
|
-
//
|
46
|
+
// Function to retrieve all ancestors of unchecked item and set checked to false
|
47
|
+
export const getAncestorsOfUnchecked = (
|
48
|
+
data: { [key: string]: any }[],
|
49
|
+
item: { [key: string]: any }
|
50
|
+
): { [key: string]: any }[] => {
|
51
|
+
if (item.parent_id) {
|
52
|
+
const ancestor = filterFormattedDataById(data, item.parent_id);
|
53
|
+
ancestor[0].checked = false;
|
54
|
+
ancestor[0].parent_id && getAncestorsOfUnchecked(data, ancestor[0]);
|
55
|
+
}
|
56
|
+
return data;
|
57
|
+
};
|
58
|
+
|
59
|
+
// Function to get all items with checked = true
|
60
60
|
export const getCheckedItems = (
|
61
61
|
data: { [key: string]: any }[]
|
62
62
|
): { [key: string]: any }[] => {
|
@@ -76,7 +76,9 @@ export const getCheckedItems = (
|
|
76
76
|
return checkedItems;
|
77
77
|
};
|
78
78
|
|
79
|
-
export const getDefaultCheckedItems = (
|
79
|
+
export const getDefaultCheckedItems = (
|
80
|
+
treeData: { [key: string]: any }[]
|
81
|
+
): { [key: string]: any }[] => {
|
80
82
|
const checkedDefault: { [key: string]: any }[] = [];
|
81
83
|
|
82
84
|
const traverseTree = (items: { [key: string]: any }[]) => {
|
@@ -118,7 +120,7 @@ export const getDefaultCheckedItems = (treeData: { [key: string]: any }[]) => {
|
|
118
120
|
export const recursiveCheckParent = (
|
119
121
|
item: { [key: string]: any },
|
120
122
|
data: any
|
121
|
-
) => {
|
123
|
+
): any => {
|
122
124
|
if (item.parent_id !== null) {
|
123
125
|
const parent = filterFormattedDataById(data, item.parent_id);
|
124
126
|
const allChildrenChecked = parent[0].children.every(
|
@@ -135,8 +137,11 @@ export const recursiveCheckParent = (
|
|
135
137
|
return data;
|
136
138
|
};
|
137
139
|
|
138
|
-
export const getExpandedItems = (
|
139
|
-
|
140
|
+
export const getExpandedItems = (
|
141
|
+
treeData: { [key: string]: string }[],
|
142
|
+
selectedIds: string[]
|
143
|
+
): any[] => {
|
144
|
+
const expandedItems: any[] = [];
|
140
145
|
|
141
146
|
const traverse = (items: string | any[], ancestors: any[] = []) => {
|
142
147
|
for (let i = 0; i < items.length; i++) {
|