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.
@@ -0,0 +1,87 @@
1
+ import React from "react";
2
+ import MultiLevelSelect from "../_multi_level_select";
3
+
4
+ const treeData = [
5
+ {
6
+ label: "Power Home Remodeling",
7
+ value: "Power Home Remodeling",
8
+ id: "powerhome2",
9
+ expanded: true,
10
+ children: [
11
+ {
12
+ label: "People",
13
+ value: "People",
14
+ id: "people2",
15
+ expanded: true,
16
+ children: [
17
+ {
18
+ label: "Talent Acquisition",
19
+ value: "Talent Acquisition",
20
+ id: "talent2",
21
+ },
22
+ {
23
+ label: "Business Affairs",
24
+ value: "Business Affairs",
25
+ id: "business2",
26
+ children: [
27
+ {
28
+ label: "Initiatives",
29
+ value: "Initiatives",
30
+ id: "initiative2",
31
+ },
32
+ {
33
+ label: "Learning & Development",
34
+ value: "Learning & Development",
35
+ id: "development2",
36
+ },
37
+ ],
38
+ },
39
+ {
40
+ label: "People Experience",
41
+ value: "People Experience",
42
+ id: "experience2",
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ label: "Contact Center",
48
+ value: "Contact Center",
49
+ id: "contact2",
50
+ children: [
51
+ {
52
+ label: "Appointment Management",
53
+ value: "Appointment Management",
54
+ id: "appointment2",
55
+ },
56
+ {
57
+ label: "Customer Service",
58
+ value: "Customer Service",
59
+ id: "customer2",
60
+ },
61
+ {
62
+ label: "Energy",
63
+ value: "Energy",
64
+ id: "energy2",
65
+ },
66
+ ],
67
+ },
68
+ ],
69
+ },
70
+ ];
71
+
72
+ const MultiLevelSelectSingle = (props) => {
73
+ return (
74
+ <div>
75
+ <MultiLevelSelect
76
+ id="multiselect-single"
77
+ inputName="Power"
78
+ onSelect={(selectedNode) => console.log("Selected Node", selectedNode)}
79
+ treeData={treeData}
80
+ variant="single"
81
+ {...props}
82
+ />
83
+ </div>
84
+ )
85
+ };
86
+
87
+ export default MultiLevelSelectSingle;
@@ -1,12 +1,13 @@
1
1
  examples:
2
2
  rails:
3
3
  - multi_level_select_default: Default
4
+ - multi_level_select_single: Single Select
4
5
  - multi_level_select_return_all_selected: Return All Selected
5
6
  - multi_level_select_selected_ids: Selected Ids
6
7
  - multi_level_select_with_form: With Form
7
-
8
+
8
9
  react:
9
10
  - multi_level_select_default: Default
11
+ - multi_level_select_single: Single Select
10
12
  - multi_level_select_return_all_selected: Return All Selected
11
13
  - multi_level_select_selected_ids: Selected Ids
12
-
@@ -1,3 +1,4 @@
1
1
  export { default as MultiLevelSelectDefault } from './_multi_level_select_default.jsx'
2
+ export { default as MultiLevelSelectSingle } from './_multi_level_select_single.jsx'
2
3
  export { default as MultiLevelSelectReturnAllSelected } from './_multi_level_select_return_all_selected.jsx'
3
- export { default as MultiLevelSelectSelectedIds } from "./_multi_level_select_selected_ids.jsx"
4
+ export { default as MultiLevelSelectSelectedIds } from "./_multi_level_select_selected_ids.jsx"
@@ -14,6 +14,11 @@ module Playbook
14
14
  prop :input_display, type: Playbook::Props::Enum,
15
15
  values: %w[pills none],
16
16
  default: "pills"
17
+ prop :input_name, type: Playbook::Props::String,
18
+ default: ""
19
+ prop :variant, type: Playbook::Props::Enum,
20
+ values: %w[multi single],
21
+ default: "multi"
17
22
 
18
23
  def classname
19
24
  generate_classname("pb_multi_level_select")
@@ -27,6 +32,8 @@ module Playbook
27
32
  treeData: tree_data,
28
33
  returnAllSelected: return_all_selected,
29
34
  selectedIds: selected_ids,
35
+ input_name: input_name,
36
+ variant: variant,
30
37
  }
31
38
  end
32
39
  end
@@ -0,0 +1,6 @@
1
+ export const isValidEmoji = (emoji: string) => {
2
+ // Using regular expression to check if the string is a valid emoji/emoji Unicode
3
+ const emojiRegex = /^(\p{Emoji}|\uFE0F|\u200D|\u20E3)+$/u;
4
+ return emojiRegex.test(emoji);
5
+ };
6
+