playbook_ui 12.16.0 → 12.17.0.pre.alpha.lightboxcurrentPhotoIndex582
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_body/_body.scss +10 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_styled.html.erb +12 -0
- data/app/pb_kits/playbook/pb_body/docs/_body_styled.jsx +14 -2
- data/app/pb_kits/playbook/pb_body/docs/_body_styled.md +1 -1
- data/app/pb_kits/playbook/pb_body/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +7 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +1 -1
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +1 -1
- data/app/pb_kits/playbook/pb_docs/kit_api.html.erb +295 -8
- data/app/pb_kits/playbook/pb_docs/kit_api.rb +42 -0
- data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +17 -0
- data/app/pb_kits/playbook/pb_docs/kit_example.rb +18 -1
- data/app/pb_kits/playbook/pb_image/docs/{_default_image.tsx → _default_image.jsx} +1 -1
- data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +8 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_current_photo.jsx +121 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/_lightbox_current_photo.md +1 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_lightbox/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_vertical_border.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_vertical_border.jsx +48 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +16 -0
- data/app/pb_kits/playbook/pb_table/table.rb +7 -1
- data/app/pb_kits/playbook/pb_timeline/{_item.jsx → _item.tsx} +10 -12
- data/app/pb_kits/playbook/pb_timeline/{_timeline.jsx → _timeline.tsx} +9 -9
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +88 -0
- data/app/pb_kits/playbook/utilities/_cursor.scss +36 -36
- data/lib/playbook/version.rb +2 -2
- metadata +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bed2313044d6ca33a9bb666afe1c6305e5d99b9f1de9d809d28b6978b45637a8
|
4
|
+
data.tar.gz: ca47d98d665b8112837f2e39f57ee39fc10cd3f3440e56e1c986d424bcb4bddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71e5a51e29e811bd4b5170728cf2bf8ee1dd80147d33697edd13a334206119fe9bae3ae9e16e107bdc557027208d6b17e46d4976e9a222582d72849a9ed917af
|
7
|
+
data.tar.gz: 5bf261e0aeaf57de2c6d6807b205302e0beedf6943f53d65d1338dff3ba81ff4e068cd51f574b122c292bda0bbe6ce6dda06476596e2c69f4e22cdb091a5859b
|
@@ -28,6 +28,16 @@
|
|
28
28
|
color: $text_lt_default;
|
29
29
|
}
|
30
30
|
}
|
31
|
+
|
32
|
+
em {
|
33
|
+
font-weight: $bold;
|
34
|
+
}
|
35
|
+
|
36
|
+
small {
|
37
|
+
font-size: $font_smaller;
|
38
|
+
letter-spacing: $lspace_loose;
|
39
|
+
}
|
40
|
+
|
31
41
|
@each $status_name, $status_value in $pb_body_status {
|
32
42
|
&[class*=#{$status_name}] {
|
33
43
|
@include pb_body($status_value);
|
@@ -6,4 +6,16 @@
|
|
6
6
|
<br />
|
7
7
|
<br />
|
8
8
|
<a href="#">This text is using the <%="<a>"%> tag</a>
|
9
|
+
<br />
|
10
|
+
<br />
|
11
|
+
<i>This text is using an <%="<i>"%> tag</i>
|
12
|
+
<br />
|
13
|
+
<br />
|
14
|
+
This <em>word</em> is using an <%="<em>"%> tag.
|
15
|
+
<br />
|
16
|
+
<br />
|
17
|
+
<small>This text is using a <%="<small>"%> tag.</small>
|
18
|
+
<br />
|
19
|
+
<br />
|
20
|
+
<u>This text is using a <%="<u>"%> tag.</u>
|
9
21
|
<% end %>
|
@@ -3,7 +3,7 @@ import { Body } from '../..'
|
|
3
3
|
|
4
4
|
const BodyStyled = (props) => {
|
5
5
|
return (
|
6
|
-
|
6
|
+
<>
|
7
7
|
<Body {...props}>
|
8
8
|
<b>{"This text is using the <b> tag"}</b>
|
9
9
|
<br />
|
@@ -12,8 +12,20 @@ const BodyStyled = (props) => {
|
|
12
12
|
<br />
|
13
13
|
<br />
|
14
14
|
<a href="#">{"This text is using the <a> tag"}</a>
|
15
|
+
<br />
|
16
|
+
<br />
|
17
|
+
<i>{"This text is using an <i> tag"}</i>
|
18
|
+
<br />
|
19
|
+
<br />
|
20
|
+
{"This "}<em>word</em>{" is using an <em> tag."}
|
21
|
+
<br />
|
22
|
+
<br />
|
23
|
+
<small>{"This text is using a <small> tag."}</small>
|
24
|
+
<br />
|
25
|
+
<br />
|
26
|
+
<u>{"This text is using a <u> tag."}</u>
|
15
27
|
</Body>
|
16
|
-
|
28
|
+
</>
|
17
29
|
)
|
18
30
|
}
|
19
31
|
|
@@ -1 +1 @@
|
|
1
|
-
Playbook styles the `b`, `strong` and `
|
1
|
+
Playbook styles the `b`, `strong`, `a`. `i`, `em`, `small` and `u` tags within the body kit to match Playbook's design system.
|
@@ -3,9 +3,9 @@ examples:
|
|
3
3
|
- body_light: Default
|
4
4
|
- body_block: Block
|
5
5
|
- body_articles: Best settings for articles
|
6
|
-
- body_styled: Styled
|
6
|
+
- body_styled: Styled tags
|
7
7
|
react:
|
8
8
|
- body_light: Default
|
9
9
|
- body_block: Block
|
10
10
|
- body_articles: Best settings for articles
|
11
|
-
- body_styled: Styled
|
11
|
+
- body_styled: Styled tags
|
@@ -134,10 +134,16 @@ $pb_button_border_width: 0px;
|
|
134
134
|
@mixin pb_button_disabled {
|
135
135
|
$disabled_color: rgba($charcoal, $opacity_5);
|
136
136
|
@include pb_button_variant(rgba($slate, $opacity_4), $disabled_color);
|
137
|
-
|
137
|
+
cursor: not-allowed;
|
138
138
|
&:focus {
|
139
139
|
outline: none;
|
140
140
|
}
|
141
|
+
&:hover {
|
142
|
+
@include pb_button_variant(rgba($slate, $opacity_4), $disabled_color);
|
143
|
+
}
|
144
|
+
&:active {
|
145
|
+
@include pb_button_variant(rgba($slate, $opacity_4), $disabled_color);
|
146
|
+
}
|
141
147
|
}
|
142
148
|
|
143
149
|
// Block =======================
|
@@ -1,12 +1,299 @@
|
|
1
|
-
|
1
|
+
<% if !local_prop_data.present? %>
|
2
|
+
<div data-action="toggle" data-togglable="prop_example" class="pb--propsTable">
|
2
3
|
<%= pb_rails("title", props: { text: "Available Props", size: 3, margin_bottom: "sm" }) %>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
<%= pb_rails("card", props: { padding: "none" }) do %>
|
5
|
+
<%= pb_rails("card/card_body", props: { padding: "sm" }) do %>
|
6
|
+
<%= pb_rails("nav", props: { orientation: "horizontal", variant: "subtle" }) do %>
|
7
|
+
<%= pb_rails("nav/item", props: { text: "Global Props", link: "#", active: true }) %>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<%= pb_rails("section_separator") %>
|
11
|
+
<%= pb_rails("card/card_body", props: {}) do %>
|
12
|
+
<%= pb_rails("table", props: {container: false, disable_hover: true }) do %>
|
13
|
+
<thead>
|
14
|
+
<tr>
|
15
|
+
<th>Props</th>
|
16
|
+
<th>Type</th>
|
17
|
+
<th>Values</th>
|
18
|
+
<th>Default</th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
<tbody>
|
22
|
+
<% global_prop_data.each do |key, value|%>
|
23
|
+
<tr>
|
24
|
+
<td>
|
25
|
+
<%= pb_rails("title", props: { text: key, tag: "h4", size: 4 }) %>
|
26
|
+
</td>
|
27
|
+
<td>
|
28
|
+
<%= pb_rails("card", props: {
|
29
|
+
classname: "card",
|
30
|
+
padding: "xxs",
|
31
|
+
background: "light",
|
32
|
+
border_none: true,
|
33
|
+
border_radius: "sm"
|
34
|
+
}) do %>
|
35
|
+
<%= pb_rails("body", props: {
|
36
|
+
classname: "kearning"
|
37
|
+
}) do %>
|
38
|
+
<%= value[:type].downcase %>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
41
|
+
</td>
|
42
|
+
<td>
|
43
|
+
<% if value[:values].present? %>
|
44
|
+
<% value[:values].each do |item| %>
|
45
|
+
<% if item != nil %>
|
46
|
+
<%= pb_rails("card", props: {
|
47
|
+
flex_direction: "row",
|
48
|
+
classname: "card",
|
49
|
+
padding: "xxs",
|
50
|
+
background: "light",
|
51
|
+
border_none: true,
|
52
|
+
border_radius: "sm",
|
53
|
+
margin: "xxs"
|
54
|
+
}) do %>
|
55
|
+
<%= pb_rails("body", props: {
|
56
|
+
classname: "kearning"
|
57
|
+
}) do %>
|
58
|
+
<%= item %>
|
59
|
+
<% end %>
|
60
|
+
<% end %>
|
61
|
+
<% end %>
|
62
|
+
<% end %>
|
63
|
+
<% end %>
|
64
|
+
</td>
|
65
|
+
<td>
|
66
|
+
<% if value[:default].present? || value[:default].is_a?(TrueClass) || value[:default].is_a?(FalseClass) %>
|
67
|
+
<%= pb_rails("card", props: {
|
68
|
+
classname: "card",
|
69
|
+
padding: "xxs",
|
70
|
+
background: "light",
|
71
|
+
border_none: true,
|
72
|
+
border_radius: "sm"
|
73
|
+
}) do %>
|
74
|
+
<%= pb_rails("body", props: {
|
75
|
+
classname: "kearning"
|
76
|
+
}) do %>
|
77
|
+
<%= value[:default] %>
|
78
|
+
<% end %>
|
79
|
+
<% end %>
|
80
|
+
<% end %>
|
81
|
+
</td>
|
82
|
+
</tr>
|
83
|
+
<% end %>
|
84
|
+
</tbody>
|
85
|
+
<% end %>
|
86
|
+
<% end %>
|
87
|
+
<% end %>
|
88
|
+
</div>
|
89
|
+
<% else %>
|
90
|
+
<div data-action="toggle" data-togglable="prop_example" class="pb--propsTable">
|
91
|
+
<%= pb_rails("title", props: { text: "Available Props", size: 3, margin_bottom: "sm" }) %>
|
92
|
+
<%= pb_rails("card", props: { padding: "none" }) do %>
|
93
|
+
<%= pb_rails("card/card_body", props: { padding: "sm" }) do %>
|
94
|
+
<%= pb_rails("nav", props: { orientation: "horizontal", variant: "subtle" }) do %>
|
95
|
+
<% if local_prop_data.present? %>
|
96
|
+
<%= pb_rails("nav/item", props: { text: "Kit Props", link: "#", active: true, id: "local-button-active", classname: "local-active" }) %>
|
97
|
+
<% end %>
|
98
|
+
<% if local_prop_data.present? %>
|
99
|
+
<%= pb_rails("nav/item", props: { text: "Kit Props", link: "#", id: "local-button", classname: "global-active" }) %>
|
100
|
+
<% end %>
|
101
|
+
<%= pb_rails("nav/item", props: { text: "Global Props", link: "#", active: true, id: "global-button-active", classname: "global-active" }) %>
|
102
|
+
<%= pb_rails("nav/item", props: { text: "Global Props", link: "#", id: "global-button", classname: "local-active" }) %>
|
103
|
+
<% end %>
|
104
|
+
<% end %>
|
105
|
+
<%= pb_rails("section_separator") %>
|
106
|
+
<%= pb_rails("card/card_body", props: {}) do %>
|
107
|
+
<%= pb_rails("table", props: {container: false, disable_hover: true, id: "global-prop-table", classname: "global-active"}) do %>
|
108
|
+
<thead>
|
109
|
+
<tr>
|
110
|
+
<th>Props</th>
|
111
|
+
<th>Type</th>
|
112
|
+
<th>Values</th>
|
113
|
+
<th>Default</th>
|
114
|
+
</tr>
|
115
|
+
</thead>
|
116
|
+
<tbody>
|
117
|
+
<% global_prop_data.each do |key, value|%>
|
118
|
+
<tr>
|
119
|
+
<td>
|
120
|
+
<%= pb_rails("title", props: { text: key, tag: "h4", size: 4 }) %>
|
121
|
+
</td>
|
122
|
+
<td>
|
123
|
+
<%= pb_rails("card", props: {
|
124
|
+
classname: "card",
|
125
|
+
padding: "xxs",
|
126
|
+
background: "light",
|
127
|
+
border_none: true,
|
128
|
+
border_radius: "sm"
|
129
|
+
}) do %>
|
130
|
+
<%= pb_rails("body", props: {
|
131
|
+
classname: "kearning"
|
132
|
+
}) do %>
|
133
|
+
<%= value[:type].downcase %>
|
134
|
+
<% end %>
|
135
|
+
<% end %>
|
136
|
+
</td>
|
137
|
+
<td>
|
138
|
+
<% if value[:values].present? %>
|
139
|
+
<% value[:values].each do |item| %>
|
140
|
+
<% if item != nil %>
|
141
|
+
<%= pb_rails("card", props: {
|
142
|
+
flex_direction: "row",
|
143
|
+
classname: "card",
|
144
|
+
padding: "xxs",
|
145
|
+
background: "light",
|
146
|
+
border_none: true,
|
147
|
+
border_radius: "sm",
|
148
|
+
margin: "xxs"
|
149
|
+
}) do %>
|
150
|
+
<%= pb_rails("body", props: {
|
151
|
+
classname: "kearning"
|
152
|
+
}) do %>
|
153
|
+
<%= item %>
|
154
|
+
<% end %>
|
155
|
+
<% end %>
|
156
|
+
<% end %>
|
157
|
+
<% end %>
|
158
|
+
<% end %>
|
159
|
+
</td>
|
160
|
+
<td>
|
161
|
+
<% if value[:default].present? || value[:default].is_a?(TrueClass) || value[:default].is_a?(FalseClass) %>
|
162
|
+
<%= pb_rails("card", props: {
|
163
|
+
classname: "card",
|
164
|
+
padding: "xxs",
|
165
|
+
background: "light",
|
166
|
+
border_none: true,
|
167
|
+
border_radius: "sm"
|
168
|
+
}) do %>
|
169
|
+
<%= pb_rails("body", props: {
|
170
|
+
classname: "kearning"
|
171
|
+
}) do %>
|
172
|
+
<%= value[:default] %>
|
173
|
+
<% end %>
|
174
|
+
<% end %>
|
175
|
+
<% end %>
|
176
|
+
</td>
|
177
|
+
</tr>
|
178
|
+
<% end %>
|
179
|
+
</tbody>
|
180
|
+
<% end %>
|
181
|
+
<%= pb_rails("table", props: {container: false, disable_hover: true, id: "local-prop-table", classname: "local-active"}) do %>
|
182
|
+
<thead>
|
183
|
+
<tr>
|
184
|
+
<th>Props</th>
|
185
|
+
<th>Type</th>
|
186
|
+
<th>Values</th>
|
187
|
+
<th>Default</th>
|
188
|
+
</tr>
|
189
|
+
</thead>
|
190
|
+
<tbody>
|
191
|
+
<% local_prop_data.each do |key, value|%>
|
192
|
+
<tr>
|
193
|
+
<td>
|
194
|
+
<%= pb_rails("title", props: { text: key, tag: "h4", size: 4 }) %>
|
195
|
+
</td>
|
196
|
+
<td>
|
197
|
+
<%= pb_rails("card", props: {
|
198
|
+
classname: "card",
|
199
|
+
padding: "xxs",
|
200
|
+
background: "light",
|
201
|
+
border_none: true,
|
202
|
+
border_radius: "sm"
|
203
|
+
}) do %>
|
204
|
+
<%= pb_rails("body", props: {
|
205
|
+
classname: "kearning"
|
206
|
+
}) do %>
|
207
|
+
<%= value[:type].downcase %>
|
208
|
+
<% end %>
|
209
|
+
<% end %>
|
210
|
+
</td>
|
211
|
+
<td>
|
212
|
+
<% if value[:values].present? %>
|
213
|
+
<% value[:values].each do |item| %>
|
214
|
+
<% if item != nil %>
|
215
|
+
<%= pb_rails("card", props: {
|
216
|
+
flex_direction: "row",
|
217
|
+
classname: "card",
|
218
|
+
padding: "xxs",
|
219
|
+
background: "light",
|
220
|
+
border_none: true,
|
221
|
+
border_radius: "sm",
|
222
|
+
margin: "xxs"
|
223
|
+
}) do %>
|
224
|
+
<%= pb_rails("body", props: {
|
225
|
+
classname: "kearning"
|
226
|
+
}) do %>
|
227
|
+
<%= item %>
|
228
|
+
<% end %>
|
229
|
+
<% end %>
|
230
|
+
<% end %>
|
231
|
+
<% end %>
|
232
|
+
<% end %>
|
233
|
+
</td>
|
234
|
+
<td>
|
235
|
+
<% if value[:default].present? || value[:default].is_a?(TrueClass) || value[:default].is_a?(FalseClass) %>
|
236
|
+
<%= pb_rails("card", props: {
|
237
|
+
classname: "card",
|
238
|
+
padding: "xxs",
|
239
|
+
background: "light",
|
240
|
+
border_none: true,
|
241
|
+
border_radius: "sm"
|
242
|
+
}) do %>
|
243
|
+
<%= pb_rails("body", props: {
|
244
|
+
classname: "kearning"
|
245
|
+
}) do %>
|
246
|
+
<%= value[:default] %>
|
247
|
+
<% end %>
|
248
|
+
<% end %>
|
249
|
+
<% end %>
|
250
|
+
</td>
|
251
|
+
</tr>
|
252
|
+
<% end %>
|
253
|
+
</tbody>
|
8
254
|
<% end %>
|
9
255
|
<% end %>
|
10
256
|
<% end %>
|
11
|
-
|
12
|
-
|
257
|
+
</div>
|
258
|
+
<% end %>
|
259
|
+
|
260
|
+
<script>
|
261
|
+
|
262
|
+
const globalNavAndTable = document.querySelectorAll('.global-active');
|
263
|
+
const localNavAndTable = document.querySelectorAll('.local-active');
|
264
|
+
|
265
|
+
globalNavAndTable.forEach(element => {
|
266
|
+
element.style.display = 'none';
|
267
|
+
});
|
268
|
+
|
269
|
+
const globalButton = document.getElementById("global-button");
|
270
|
+
if (globalButton) {
|
271
|
+
globalButton.addEventListener("click", showGlobal);
|
272
|
+
}
|
273
|
+
|
274
|
+
const localButton = document.getElementById("local-button");
|
275
|
+
if (localButton) {
|
276
|
+
localButton.addEventListener("click", showLocal);
|
277
|
+
}
|
278
|
+
|
279
|
+
function showGlobal() {
|
280
|
+
localNavAndTable.forEach(element => {
|
281
|
+
element.style.display = 'none';
|
282
|
+
});
|
283
|
+
|
284
|
+
globalNavAndTable.forEach(element => {
|
285
|
+
element.style.display = 'table';
|
286
|
+
});
|
287
|
+
}
|
288
|
+
|
289
|
+
function showLocal() {
|
290
|
+
localNavAndTable.forEach(element => {
|
291
|
+
element.style.display = 'table';
|
292
|
+
});
|
293
|
+
|
294
|
+
globalNavAndTable.forEach(element => {
|
295
|
+
element.style.display = 'none';
|
296
|
+
});
|
297
|
+
}
|
298
|
+
|
299
|
+
</script>
|
@@ -5,6 +5,48 @@ module Playbook
|
|
5
5
|
class KitApi < Playbook::KitBase
|
6
6
|
prop :kit, type: Playbook::Props::String, required: true
|
7
7
|
|
8
|
+
def kit_local_props
|
9
|
+
local = []
|
10
|
+
kit_props.each do |key, value|
|
11
|
+
value.kit != Playbook::KitBase && local.push({ key: key, value: value })
|
12
|
+
end
|
13
|
+
local
|
14
|
+
end
|
15
|
+
|
16
|
+
def local_prop_data
|
17
|
+
local_props = {}
|
18
|
+
|
19
|
+
kit_local_props.each do |key, _value|
|
20
|
+
name = key[:value].instance_variable_get(:@name)
|
21
|
+
type = key[:value].class.to_s.split("::").last
|
22
|
+
default = key[:value].instance_variable_get(:@default)
|
23
|
+
values = key[:value].instance_variable_get(:@values)
|
24
|
+
local_props[name.to_sym] = { "type": type, "default": default, "values": values }
|
25
|
+
end
|
26
|
+
local_props
|
27
|
+
end
|
28
|
+
|
29
|
+
def kit_global_props
|
30
|
+
global = []
|
31
|
+
kit_props.each do |key, value|
|
32
|
+
value.kit == Playbook::KitBase && global.push({ key: key, value: value })
|
33
|
+
end
|
34
|
+
global
|
35
|
+
end
|
36
|
+
|
37
|
+
def global_prop_data
|
38
|
+
global_props = {}
|
39
|
+
|
40
|
+
kit_global_props.each do |key, _value|
|
41
|
+
name = key[:value].instance_variable_get(:@name)
|
42
|
+
type = key[:value].class.to_s.split("::").last
|
43
|
+
default = key[:value].instance_variable_get(:@default)
|
44
|
+
values = key[:value].instance_variable_get(:@values)
|
45
|
+
global_props[name.to_sym] = { "type": type, "default": default, "values": values }
|
46
|
+
end
|
47
|
+
global_props
|
48
|
+
end
|
49
|
+
|
8
50
|
def kit_props
|
9
51
|
kit_class.props
|
10
52
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
<% example_html = ERB.new(example).result %>
|
2
|
+
|
1
3
|
<%= pb_rails("card", props: { classname: "pb--doc", padding: "none", dark: dark }) do %>
|
2
4
|
<div class="pb--kit-example">
|
3
5
|
<%= pb_rails("caption", props: { text: example_title, dark: dark }) %>
|
@@ -13,6 +15,13 @@
|
|
13
15
|
<div id="code-wrapper">
|
14
16
|
<div class="pb--codeControls">
|
15
17
|
<ul>
|
18
|
+
<% if type == "rails" %>
|
19
|
+
<li>
|
20
|
+
<a href="#" id="copy-<%= example_key %>-trigger" onclick="copyOnClick(`<%= example_html %>`, `copy-<%= example_key %>`)">
|
21
|
+
Copy HTML
|
22
|
+
</a>
|
23
|
+
</li>
|
24
|
+
<% end %>
|
16
25
|
<li>
|
17
26
|
<a href="#" id="toggle-open" data-toggle="code_example">Code Example</a>
|
18
27
|
</li>
|
@@ -26,3 +35,11 @@
|
|
26
35
|
</div>
|
27
36
|
<% end %>
|
28
37
|
<% end %>
|
38
|
+
|
39
|
+
<script>
|
40
|
+
function copyOnClick(content, elementID) {
|
41
|
+
copyContent(content)
|
42
|
+
}
|
43
|
+
|
44
|
+
</script>
|
45
|
+
|
@@ -33,12 +33,29 @@ module Playbook
|
|
33
33
|
def source
|
34
34
|
@source ||= begin
|
35
35
|
extension = type == "react" ? "jsx" : "html.erb"
|
36
|
-
read_kit_file("_#{example_key}.#{extension}")
|
36
|
+
stringified_code = read_kit_file("_#{example_key}.#{extension}")
|
37
|
+
sanitize_code(stringified_code)
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
41
|
private
|
41
42
|
|
43
|
+
def sanitize_code(stringified_code)
|
44
|
+
stringified_code = stringified_code.gsub('"../.."', '"playbook-ui"')
|
45
|
+
.gsub('"../../"', '"playbook-ui"')
|
46
|
+
.gsub("'../../'", "'playbook-ui'")
|
47
|
+
.gsub("'../..'", "'playbook-ui'")
|
48
|
+
.gsub(%r{from "../.*}, "from 'playbook-ui'")
|
49
|
+
.gsub(%r{from '../.*}, "from 'playbook-ui'")
|
50
|
+
stringified_code = dark ? stringified_code.gsub("{...props}", "dark") : stringified_code.gsub(/\s*{...props}\s*\n/, "\n")
|
51
|
+
if stringified_code.include?("props: { ")
|
52
|
+
stringified_code = stringified_code.gsub("props: {", "props: {dark: true,") if type == "rails" && dark
|
53
|
+
elsif type == "rails" && dark
|
54
|
+
stringified_code = stringified_code.gsub("props: {", "props: {\n dark: true,")
|
55
|
+
end
|
56
|
+
stringified_code
|
57
|
+
end
|
58
|
+
|
42
59
|
def read_kit_file(*args)
|
43
60
|
path = ::Playbook.kit_path(kit, "docs", *args)
|
44
61
|
path.exist? ? path.read : ""
|
@@ -12,6 +12,7 @@ type LightboxType = {
|
|
12
12
|
aria?: {[key: string]: string},
|
13
13
|
children: React.ReactNode[] | React.ReactNode | string,
|
14
14
|
className?: string,
|
15
|
+
currentPhotoIndex?: number,
|
15
16
|
data?: {[key: string]: string | number},
|
16
17
|
description?: string | any,
|
17
18
|
id?: string,
|
@@ -31,6 +32,7 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
|
|
31
32
|
aria = {},
|
32
33
|
children,
|
33
34
|
className,
|
35
|
+
currentPhotoIndex,
|
34
36
|
data = {},
|
35
37
|
description,
|
36
38
|
id = '',
|
@@ -50,6 +52,12 @@ const Lightbox = (props: LightboxType): React.ReactNode => {
|
|
50
52
|
onChange(activePhoto)
|
51
53
|
},[activePhoto])
|
52
54
|
|
55
|
+
useEffect(() => {
|
56
|
+
currentPhotoIndex !== undefined && currentPhotoIndex !== null && (
|
57
|
+
setActivePhoto(currentPhotoIndex)
|
58
|
+
)
|
59
|
+
},[currentPhotoIndex])
|
60
|
+
|
53
61
|
const ariaProps = buildAriaProps(aria)
|
54
62
|
const dataProps = buildDataProps(data)
|
55
63
|
const classes = classnames(
|