playbook_ui 13.30.0 → 13.31.0.pre.alpha.play1262iconstyles3172

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +59 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.md +6 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +4 -4
  6. data/app/pb_kits/playbook/pb_card/_card.tsx +4 -3
  7. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -1
  8. data/app/pb_kits/playbook/pb_collapsible/index.js +6 -1
  9. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default_swift.md +33 -0
  10. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_props_swift.md +18 -0
  11. data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +6 -1
  12. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +2 -4
  13. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +70 -50
  14. data/app/pb_kits/playbook/pb_draggable/context/types.ts +26 -0
  15. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +2 -1
  16. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +1 -1
  17. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +5 -1
  18. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +11 -4
  19. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md +4 -2
  20. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx +2 -2
  21. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +7 -1
  22. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx +6 -4
  23. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.md +7 -0
  24. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +142 -15
  25. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +6 -5
  26. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +18 -0
  27. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +228 -218
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +9 -0
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +34 -0
  30. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
  31. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -1
  32. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +14 -12
  33. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +7 -0
  34. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +17 -2
  35. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +9 -3
  36. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_custom_icon.html.erb +32 -0
  37. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_custom_icon.jsx +48 -0
  38. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  39. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  40. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +16 -11
  41. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +72 -0
  42. data/app/pb_kits/playbook/pb_icon/_icon.scss +211 -1
  43. data/app/pb_kits/playbook/pb_icon/_icon.tsx +136 -13
  44. data/app/pb_kits/playbook/pb_icon/docs/_icon_default.html.erb +1 -1
  45. data/app/pb_kits/playbook/pb_icon/docs/_icon_default.jsx +2 -3
  46. data/app/pb_kits/playbook/pb_icon/icon.rb +43 -17
  47. data/app/pb_kits/playbook/pb_icon/icon_aliases.json +39 -0
  48. data/app/pb_kits/playbook/pb_list/_list.tsx +4 -4
  49. data/app/pb_kits/playbook/pb_list/_list_item.tsx +7 -3
  50. data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +2 -2
  51. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.html.erb +1 -1
  52. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +1 -0
  53. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +3 -1
  54. data/app/pb_kits/playbook/pb_nav/item.html.erb +1 -1
  55. data/app/pb_kits/playbook/pb_nav/item.rb +1 -0
  56. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.html.erb +24 -0
  57. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +4 -4
  58. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.html.erb +11 -0
  59. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +4 -0
  60. data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +27 -0
  61. data/app/pb_kits/playbook/pb_overlay/overlay.rb +110 -0
  62. data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +7 -3
  63. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +3 -3
  64. data/app/pb_kits/playbook/pb_table/table_header.html.erb +16 -2
  65. data/app/pb_kits/playbook/pb_timeline/_item.tsx +11 -10
  66. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +8 -6
  67. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -0
  68. data/dist/menu.yml +2 -2
  69. data/dist/playbook-rails.js +7 -7
  70. data/lib/playbook/version.rb +2 -2
  71. metadata +21 -5
@@ -1,9 +1,16 @@
1
- import React, {useState} from "react"
2
- import { render, screen } from "../utilities/test-utils"
1
+ import React, { useState } from "react";
2
+ import { render, screen } from "../utilities/test-utils";
3
3
 
4
- import { Draggable, DraggableProvider, SelectableList } from '../'
4
+ import {
5
+ Draggable,
6
+ DraggableProvider,
7
+ SelectableList,
8
+ List,
9
+ ListItem,
10
+ Card,
11
+ } from "../";
5
12
 
6
- const testId = 'draggable'
13
+ const testId = "draggable";
7
14
 
8
15
  const data = [
9
16
  {
@@ -24,7 +31,6 @@ const data = [
24
31
  },
25
32
  ];
26
33
 
27
-
28
34
  const DefaultDraggableKit = () => {
29
35
  const [initialState, setInitialState] = useState(data);
30
36
 
@@ -33,13 +39,11 @@ const DefaultDraggableKit = () => {
33
39
  initialItems={data}
34
40
  onReorder={(items) => setInitialState(items)}
35
41
  >
36
- <Draggable
37
- data={{ testid: testId }}
38
- >
42
+ <Draggable data={{ testid: testId }}>
39
43
  <Draggable.Container>
40
44
  <SelectableList variant="checkbox">
41
45
  {initialState.map(({ id, text }) => (
42
- <Draggable.Item id={id}
46
+ <Draggable.Item dragId={id}
43
47
  key={id}
44
48
  >
45
49
  <SelectableList.Item label={text}
@@ -55,9 +59,132 @@ const DefaultDraggableKit = () => {
55
59
  );
56
60
  };
57
61
 
58
- test('generated default kit and classname', () => {
59
- render(<DefaultDraggableKit/>)
60
- const kit = screen.getByTestId(testId)
61
- expect(kit).toBeInTheDocument()
62
- expect(kit).toHaveClass('pb_draggable')
63
- })
62
+ const DraggableKitWithList = () => {
63
+ const [initialState, setInitialState] = useState(data);
64
+ return (
65
+ <div data-testid="draggable">
66
+ <DraggableProvider
67
+ initialItems={data}
68
+ onReorder={(items) => setInitialState(items)}
69
+ >
70
+ <List enableDrag>
71
+ {initialState.map(({ id, text }) => (
72
+ <ListItem dragId={id}
73
+ key={id}
74
+ >
75
+ {text}
76
+ </ListItem>
77
+ ))}
78
+ </List>
79
+ </DraggableProvider>
80
+ </div>
81
+ );
82
+ };
83
+
84
+ const DraggableKitWithSelectableList = () => {
85
+ const [initialState, setInitialState] = useState(data);
86
+ return (
87
+ <div data-testid="draggable">
88
+ <DraggableProvider
89
+ initialItems={data}
90
+ onReorder={(items) => setInitialState(items)}
91
+ >
92
+ <SelectableList enableDrag>
93
+ {initialState.map(({ id, text }) => (
94
+ <SelectableList.Item
95
+ dragId={id}
96
+ key={id}
97
+ label={text}
98
+ name={id}
99
+ value={id}
100
+ />
101
+ ))}
102
+ </SelectableList>
103
+ </DraggableProvider>
104
+ </div>
105
+ );
106
+ };
107
+
108
+ const DraggableKitWithCard = () => {
109
+ const [initialState, setInitialState] = useState(data);
110
+ return (
111
+ <div data-testid="draggable">
112
+ <DraggableProvider
113
+ initialItems={data}
114
+ onReorder={(items) => setInitialState(items)}
115
+ >
116
+ <Draggable.Container>
117
+ {initialState.map(({ id, text }) => (
118
+ <Card dragId={id}
119
+ draggableItem
120
+ key={id}
121
+ >
122
+ {text}
123
+ </Card>
124
+ ))}
125
+ </Draggable.Container>
126
+ </DraggableProvider>
127
+ </div>
128
+ );
129
+ };
130
+
131
+ test("generated default kit and classname", () => {
132
+ render(<DefaultDraggableKit />);
133
+ const kit = screen.getByTestId(testId);
134
+ expect(kit).toBeInTheDocument();
135
+ expect(kit).toHaveClass("pb_draggable");
136
+ });
137
+
138
+ test("generated Draggable Container", () => {
139
+ render(<DefaultDraggableKit />);
140
+ const kit = screen.getByTestId(testId);
141
+
142
+ const container = kit.querySelector(".pb_draggable_container");
143
+ expect(container).toBeInTheDocument();
144
+ });
145
+
146
+ test("generated Draggable Item", () => {
147
+ render(<DefaultDraggableKit />);
148
+ const kit = screen.getByTestId(testId);
149
+
150
+ const item = kit.querySelector(".pb_draggable_item");
151
+ expect(item).toBeInTheDocument();
152
+ });
153
+
154
+ test("Attached draggable HTML attributes", () => {
155
+ render(<DefaultDraggableKit />);
156
+ const kit = screen.getByTestId(testId);
157
+
158
+ const item = kit.querySelector(".pb_draggable_item");
159
+ expect(item).toHaveAttribute("draggable");
160
+ });
161
+
162
+ test("generated dragHandle with List", () => {
163
+ render(<DraggableKitWithList />);
164
+ const kit = screen.getByTestId(testId);
165
+
166
+ const list = kit.querySelector(".pb_list_kit");
167
+ expect(list).toBeInTheDocument();
168
+ const dragHandle = list.querySelector(".fa-grip-dots-vertical");
169
+ expect(dragHandle).toBeInTheDocument();
170
+ });
171
+
172
+ test("generated dragHandle with SelectableList", () => {
173
+ render(<DraggableKitWithSelectableList />);
174
+ const kit = screen.getByTestId(testId);
175
+
176
+ const selectabellist = kit.querySelector(".pb_selectable_list_kit");
177
+ expect(selectabellist).toBeInTheDocument();
178
+ const dragHandle = selectabellist.querySelector(".fa-grip-dots-vertical");
179
+ expect(dragHandle).toBeInTheDocument();
180
+ });
181
+
182
+ test("generated dragHandle with Card", () => {
183
+ render(<DraggableKitWithCard />);
184
+ const kit = screen.getByTestId(testId);
185
+
186
+ const card = kit.querySelector(".pb_card_kit_deselected_border_radius_md");
187
+ expect(card).toBeInTheDocument();
188
+ const dragHandle = card.querySelector(".fa-grip-dots-vertical");
189
+ expect(dragHandle).toBeInTheDocument();
190
+ });
@@ -17,10 +17,11 @@ type DraggableItemProps = {
17
17
  data?: { [key: string]: string };
18
18
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
19
19
  id?: string;
20
+ dragId?: string;
20
21
  };
21
22
 
22
23
  const DraggableItem = (props: DraggableItemProps) => {
23
- const { aria = {}, children, className, container, data = {}, htmlOptions = {}, id } = props;
24
+ const { aria = {}, children, className, container, data = {}, htmlOptions = {}, id, dragId } = props;
24
25
 
25
26
  const { isDragging, handleDragStart, handleDragEnter, handleDragEnd } =
26
27
  DraggableContext();
@@ -31,7 +32,7 @@ const DraggableItem = (props: DraggableItemProps) => {
31
32
 
32
33
  const classes = classnames(
33
34
  buildCss("pb_draggable_item"),
34
- `${isDragging === id ? "is_dragging" : ""}`,
35
+ `${isDragging === dragId ? "is_dragging" : ""}`,
35
36
  globalProps(props),
36
37
  className
37
38
  );
@@ -44,10 +45,10 @@ const DraggableItem = (props: DraggableItemProps) => {
44
45
  className={classes}
45
46
  draggable
46
47
  id={id}
47
- key={id}
48
+ key={dragId}
48
49
  onDragEnd={() => handleDragEnd()}
49
- onDragEnter={() => handleDragEnter(id, container)}
50
- onDragStart={() => handleDragStart(id, container)}
50
+ onDragEnter={() => handleDragEnter(dragId, container)}
51
+ onDragStart={() => handleDragStart(dragId, container)}
51
52
  >
52
53
  {children}
53
54
  </div>
@@ -96,6 +96,7 @@
96
96
  width: 100%;
97
97
  }
98
98
  }
99
+
99
100
  .close {
100
101
  display: none;
101
102
  animation-name: fadeOut;
@@ -111,6 +112,17 @@
111
112
  animation-timing-function: linear;
112
113
  animation-fill-mode: forwards;
113
114
  }
115
+
116
+ &.error {
117
+ [class*=pb_body_kit] {
118
+ margin-top: $space_xs / 2;
119
+ }
120
+
121
+ [class*="dropdown_trigger_wrapper"] {
122
+ border-color: $error;
123
+ box-shadow: none !important;
124
+ }
125
+ }
114
126
  }
115
127
 
116
128
  &.dark {
@@ -138,6 +150,12 @@
138
150
  color: $white;
139
151
  }
140
152
  }
153
+
154
+ &.error {
155
+ [class*="dropdown_trigger_wrapper"] {
156
+ border-color: $error_dark;
157
+ }
158
+ }
141
159
  }
142
160
  .pb_dropdown_container {
143
161
  background-color: $bg_dark !important;