playbook-ui 13.18.0-alpha.PBNTR191AdvancedTableFinalFixes2178 → 13.18.0-alpha.PBNTR191AdvancedTableFinalFixes2197

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.
package/dist/menu.yml ADDED
@@ -0,0 +1,459 @@
1
+ web: &web ["rails", "react"]
2
+ all: &all ["rails", "react", "swift"]
3
+ rails_swift: &rails_swift ["rails", "swift"]
4
+ react_swift: &react_swift ["swift", "react"]
5
+ rails_only: &rails_only ["rails"]
6
+ react_only: &react_only ["react"]
7
+ swift_only: &swift_only ["swift"]
8
+
9
+ kits:
10
+ - name: alerts_and_dialogs
11
+ description:
12
+ components:
13
+ - name: "dialog"
14
+ platforms: *web
15
+ description:
16
+ status: "stable"
17
+ - name: "fixed_confirmation_toast"
18
+ platforms: *web
19
+ description: Fixed Confirmation Toast is used as an alert. Success is used when a user successfully completes an action. Error is used when there is an error and the user cannot proceed. Neutral is used to display information to a user to complete a task.
20
+ status: "stable"
21
+ - name: "popover"
22
+ platforms: *web
23
+ description: A popover is a way to toggle content on top of other content. It can be used for small texts, small forms, or even dropdowns. By default, popover will toggle open/closed by simply clicking the trigger element.
24
+ status: "stable"
25
+ - name: "tooltip"
26
+ platforms: *web
27
+ description:
28
+ status: "stable"
29
+ - name: buttons
30
+ description: Buttons are used primarily for actions, such as “Save” and “Cancel”. Link Buttons are used for less important or less commonly used actions, such as “view shipping settings”.
31
+ components:
32
+ - name: "button"
33
+ platforms: *web
34
+ description:
35
+ status: "stable"
36
+ - name: "button_toolbar"
37
+ platforms: *web
38
+ description: This kit should primarily hold the most commonly used buttons.
39
+ status: "stable"
40
+ - name: "circle_icon_button"
41
+ platforms: *web
42
+ description: When using Icon Circle Button, the icon must be clear a clear indication of what the button does because there is no text.
43
+ status: "stable"
44
+ - name: data_visualization
45
+ description:
46
+ components:
47
+ - name: "map"
48
+ platforms: *react_only
49
+ description: This kit provides a wrapping class to place around the MapLibre library.
50
+ status: "stable"
51
+ - name: "table"
52
+ platforms: *web
53
+ description: Tables display a collection of structured data and typically have the ability to sort, filter, and paginate data.
54
+ status: "stable"
55
+ - name: "advanced_table"
56
+ platforms: *react_only
57
+ description: The Advanced Table can be used to display complex, nested data in a way that allows for expansion and/or sorting.
58
+ status: "beta"
59
+ - name: "list"
60
+ platforms: *web
61
+ description: Lists display a vertical set of related content.
62
+ status: "stable"
63
+ - name: "filter"
64
+ platforms: *web
65
+ description: This kit can be implemented in a variety of ways. To see examples of how to implement this kit in production visit the /dev_docs/search page in production.
66
+ status: "stable"
67
+ - name: "distribution_bar"
68
+ platforms: *web
69
+ description: Can be used in the same way a pie chart can be used. By default, Distribution Bar comparatively represents data without numbers.
70
+ status: "stable"
71
+ - name: "legend"
72
+ platforms: *web
73
+ description: A key used to compare the variables and their value in any given graph.
74
+ status: "stable"
75
+ - name: "gauge"
76
+ platforms: *web
77
+ description:
78
+ status: "stable"
79
+ - name: "bar_graph"
80
+ platforms: *web
81
+ description: Bar graphs are used to compare data. Bar graphs are not typically used to show percentages.
82
+ status: "stable"
83
+ - name: "circle_chart"
84
+ platforms: *web
85
+ description:
86
+ status: "stable"
87
+ - name: "line_graph"
88
+ platforms: *web
89
+ description: Line graphs are used to show changes in data over time.
90
+ status: "stable"
91
+ - name: "treemap_chart"
92
+ platforms: *web
93
+ description: Treemap charts are used to compare the relative size of groups of data. They can also use a nested data structure, allowing a user to drill down into a group to see its constituent data points.
94
+ status: "stable"
95
+ - name: date_and_time_text_patterns
96
+ description: ""
97
+ components:
98
+ - name: "date"
99
+ platforms: *web
100
+ description: Use to display the date. Year will not display if it is the current year.
101
+ status: "stable"
102
+ - name: "date_range_inline"
103
+ platforms: *web
104
+ description: Use to display a date range. Year will not show if it is the current year.
105
+ status: "stable"
106
+ - name: "date_range_stacked"
107
+ platforms: *web
108
+ description:
109
+ status: "stable"
110
+ - name: "date_stacked"
111
+ platforms: *web
112
+ description: Use to display the date, stacking month and day. Year will not show if it is the current year.
113
+ status: "stable"
114
+ - name: "date_time"
115
+ platforms: *web
116
+ description: Date Time is a composite kit that leverages the Date and Time kits. The Date Time kit is affected by time zones and defaults to "America/New_York".
117
+ - name: "date_time_stacked"
118
+ platforms: *web
119
+ description:
120
+ status: "stable"
121
+ - name: "date_year_stacked"
122
+ platforms: *web
123
+ description: This kit is a simple option for displaying dates in a month, day and the year format.
124
+ status: "stable"
125
+ - name: "time"
126
+ platforms: *web
127
+ description: This kit consist of large display and table display format. It includes and icon, and a time zone.
128
+ status: "stable"
129
+ - name: "time_range_inline"
130
+ platforms: *web
131
+ description:
132
+ status: "stable"
133
+ - name: "time_stacked"
134
+ platforms: *web
135
+ description:
136
+ status: "stable"
137
+ - name: "timestamp"
138
+ platforms: *all
139
+ description: This low profile kit displays time. Elapsed, current, future, or otherwise.
140
+ status: "stable"
141
+ - name: "weekday_stacked"
142
+ platforms: *web
143
+ description:
144
+ status: "stable"
145
+ - name: form_and_dashboard_text_patterns
146
+ description: ""
147
+ components:
148
+ - name: "contact"
149
+ platforms: *web
150
+ description: Use to display customer's or user's contact information.
151
+ status: "stable"
152
+ - name: "currency"
153
+ platforms: *web
154
+ description: Use to display monetary amounts, typically on dashboards or other layouts to show an overview or summary. User understanding increase when paired with labels.
155
+ status: "stable"
156
+ - name: "home_address_street"
157
+ platforms: *web
158
+ description: This kit can be used to display the address for a homeowner/project. It contains street address, APT format, City, state and zip. A Project hashtag can be used as a prop to link back to a project.
159
+ status: "stable"
160
+ - name: "label_pill"
161
+ platforms: *web
162
+ description: This kit combines the caption and pill kit with all its variants.
163
+ status: "stable"
164
+ - name: "label_value"
165
+ platforms: *web
166
+ description: This kit can be very versatile when used to display text data.
167
+ status: "stable"
168
+ - name: "person"
169
+ platforms: *web
170
+ description: This kit is broken down into a first name last name format with normal and bold weighted text.
171
+ status: "stable"
172
+ - name: "person_contact"
173
+ platforms: *web
174
+ description: This kit can be used to display a person contact information.
175
+ status: "stable"
176
+ - name: "source"
177
+ platforms: *web
178
+ description: General use is to describe the discovery of businesses, customers, etc. This kit can also be used for other purposes as well.
179
+ status: "stable"
180
+ - name: "dashboard_value"
181
+ platforms: *web
182
+ description: Use in dashboards to give the viewer a quick overview of important metrics. If want to show currency, use Currency Kit.
183
+ status: "stable"
184
+ - name: "stat_change"
185
+ platforms: *web
186
+ description: Displays the increase, decrease, or neutral change in data.
187
+ status: "stable"
188
+ - name: "stat_value"
189
+ platforms: *web
190
+ description: This kit was cerated for the main use as a dashboard display for numbers. A large label is an optional part if it needs more clarity.
191
+ status: "stable"
192
+ - name: "title_count"
193
+ platforms: *web
194
+ description: This kits consists of title kit and body text. It is used to display a title and a count (numbers). It has a base size and a large formation for dashboard use.
195
+ status: "stable"
196
+ - name: "title_detail"
197
+ platforms: *web
198
+ description: This kit can be used in many versatile ways. It consist of a title 4 and light body text kit.
199
+ status: "stable"
200
+ - name: form_elements
201
+ description:
202
+ components:
203
+ - name: "file_upload"
204
+ platforms: *web
205
+ description:
206
+ status: "stable"
207
+ - name: "toggle"
208
+ platforms: *web
209
+ description: Physical switch that allows users to turn things on or off. Used for applying system states, presenting binary options and activating a state.
210
+ status: "stable"
211
+ - name: "form_pill"
212
+ platforms: *web
213
+ description:
214
+ status: "stable"
215
+ - name: "form"
216
+ platforms: *rails_only
217
+ description: The form kit provides consumers with a convenient, consistently styled <form> wrapper.
218
+ status: "stable"
219
+ - name: "form_group"
220
+ platforms: *web
221
+ description:
222
+ status: "stable"
223
+ - name: form_input
224
+ description: ""
225
+ components:
226
+ - name: "passphrase"
227
+ platforms: *web
228
+ description:
229
+ status: "stable"
230
+ - name: "phone_number_input"
231
+ platforms: *web
232
+ description:
233
+ status: "stable"
234
+ - name: "text_input"
235
+ platforms: *web
236
+ description: Area where user can enter small amount of text. Commonly used in forms.
237
+ status: "stable"
238
+ - name: "rich_text_editor"
239
+ platforms: *web
240
+ description:
241
+ status: "stable"
242
+ - name: "textarea"
243
+ platforms: *web
244
+ description: Area where user can enter larger amounts of text. Commonly used in forms.
245
+ status: "stable"
246
+ - name: "typeahead"
247
+ platforms: *web
248
+ description: Typeahead is auto suggestion or completion based on what the user is starting to type, gets refined as the user types more.
249
+ status: "stable"
250
+ - name: form_selection
251
+ description:
252
+ components:
253
+ - name: "date_picker"
254
+ platforms: *web
255
+ description: Playbook's date picker is built using flatpickr, a vanilla js library. Common date picker use cases and features have been adapted into simple prop based configuration detailed in the docs below.
256
+ status: "stable"
257
+ - name: "multi_level_select"
258
+ platforms: *web
259
+ description: The MultiLevelSelect kit renders a multi leveled select dropdown based on data from the user.
260
+ status: "stable"
261
+ - name: "select"
262
+ platforms: *web
263
+ description: Select displays multiple options for a user to pick from in a dropdown menu. User selects one option.
264
+ status: "stable"
265
+ - name: "selectable_card"
266
+ platforms: *web
267
+ description: Cards for information/content that can be selected. There is design for unselected and selected states. Typically used as a form element.
268
+ status: "stable"
269
+ - name: "selectable_card_icon"
270
+ platforms: *web
271
+ description:
272
+ status: "stable"
273
+ - name: "selectable_icon"
274
+ platforms: *web
275
+ description:
276
+ status: "stable"
277
+ - name: "radio"
278
+ platforms: *all
279
+ description: Radio is a control that allows the user to only choose one predefined option.
280
+ status: "stable"
281
+ - name: "checkbox"
282
+ platforms: *web
283
+ description: Checkbox is used for a list of selections that are meant to have one or more options checked.
284
+ status: "stable"
285
+ - name: "selectable_list"
286
+ platforms: *web
287
+ description:
288
+ status: "stable"
289
+ - name: icons_and_images
290
+ description: ""
291
+ components:
292
+ - name: "icon"
293
+ platforms: *web
294
+ description: An icon is a graphic symbol that represents an object (ie a file) or a function. They can be used to give the user feedback.
295
+ status: "stable"
296
+ - name: "icon_circle"
297
+ platforms: *web
298
+ description: Similar to Icon, Icon Circle is a graphical symbol within a circle used to visually indicate an object or function.
299
+ status: "stable"
300
+ - name: "icon_stat_value"
301
+ platforms: *web
302
+ description:
303
+ status: "stable"
304
+ - name: "icon_value"
305
+ platforms: *web
306
+ description: Icon Value leverages our icon kit, to display a value of some sort in the interface. Typically, this includes a numerical value.
307
+ status: "stable"
308
+ - name: "user_badge"
309
+ platforms: *web
310
+ description: This kit was created to display employee icons related to a Nitro user. Currently there is the PVI logo and the Million Dollar Rep Icon.
311
+ status: "stable"
312
+ - name: "image"
313
+ platforms: *web
314
+ description: A responsive image component.
315
+ status: "stable"
316
+ - name: "lightbox"
317
+ platforms: *react_only
318
+ description: The Lightbox kit is a popup window overlay that will appear on top of your webpage and cover the entirety of the screen.
319
+ status: "stable"
320
+ - name: "star_rating"
321
+ platforms: *web
322
+ description: A component to view other people’s opinions and experiences. Use when you want to show evaluation or a quick quantitative rating. Most effective when paired with reviews.
323
+ status: "stable"
324
+ - name: layout_and_structure
325
+ description:
326
+ components:
327
+ - name: "flex"
328
+ platforms: *web
329
+ description: This kit is used to build most of the complex interfaces. The Flex Kit is used the same way flex box is used.
330
+ status: "stable"
331
+ - name: "layout"
332
+ platforms: *web
333
+ description: Layouts used for positioning content inside of pages, cards, or containers.
334
+ status: "stable"
335
+ - name: "card"
336
+ platforms: *all
337
+ description:
338
+ status: "stable"
339
+ - name: "section_separator"
340
+ platforms: *web
341
+ description: Section separator is a divider line that compartmentalizes content, typically used on cards or white backgrounds.
342
+ status: "stable"
343
+ - name: "background"
344
+ platforms: *web
345
+ description: The background kit is used for adding a background to a page or to any container.
346
+ status: "stable"
347
+ - name: "collapsible"
348
+ platforms: *web
349
+ description:
350
+ status: "stable"
351
+ - name: message_text_patterns
352
+ description:
353
+ components:
354
+ - name: "highlight"
355
+ platforms: *web
356
+ description: Highlight is used to pick out or emphasize content.
357
+ status: "stable"
358
+ - name: "message"
359
+ platforms: *web
360
+ description: This multi kit consist of a an avatar, a status, a caption, a body text, and a time stamp. All which can be optional.
361
+ status: "stable"
362
+ - name: navigation
363
+ description:
364
+ components:
365
+ - name: "bread_crumbs"
366
+ platforms: *web
367
+ description: BreadCrumbs can be used for keeping a user aware of their route location.
368
+ status: "stable"
369
+ - name: "nav"
370
+ platforms: *web
371
+ description: The nav is a grouped set of links that take the user to another page, or tab through parts of a page. It comes in horizontal or vertical with several different variants.
372
+ status: "stable"
373
+ - name: "pagination"
374
+ platforms: *rails_only
375
+ description:
376
+ status: "stable"
377
+ - name: state_and_progress_indicators
378
+ description:
379
+ components:
380
+ - name: "loading_inline"
381
+ platforms: *web
382
+ description: The loading kit is used to indicate to users that a page is still loading, or an action is still being processed.
383
+ status: "stable"
384
+ - name: "progress_pills"
385
+ platforms: *web
386
+ description: Progress pills indicate a specific point in time of a series of sequential steps. They are used to track progress of something over time.
387
+ status: "stable"
388
+ - name: "progress_simple"
389
+ platforms: *web
390
+ description: Displays the current progress of an operation flow. User understanding increases when paired with labels or numbers.
391
+ - name: "progress_step"
392
+ platforms: *web
393
+ description: "Progress step kit is used to show the progress of a process. There are three types of steps in this kit: completed, active, and inactive."
394
+ status: "stable"
395
+ - name: "walkthrough"
396
+ platforms: *web
397
+ description:
398
+ status: "stable"
399
+ - name: "timeline"
400
+ platforms: *web
401
+ description: The timeline kit can use two different line styles in the same timeline - solid and dotted line styles.
402
+ status: "stable"
403
+ - name: tags
404
+ description:
405
+ components:
406
+ - name: "badge"
407
+ platforms: *web
408
+ description: Badges can be used for notification, tags, and status. They are used for count and numbers.
409
+ status: "stable"
410
+ - name: "pill"
411
+ platforms: *all
412
+ description: A pill uses both a keyword and a specific color to categorize an item.
413
+ status: "stable"
414
+ - name: "hashtag"
415
+ platforms: *web
416
+ description: Hashtag is used to display home, project and other forms of IDs. They can be used as a link.
417
+ status: "stable"
418
+ - name: typography
419
+ description: ""
420
+ components:
421
+ - name: "body"
422
+ platforms: *web
423
+ description: Default text style for paragraphs. Follow hiearchy when using "light" or "lighter" variants to deemphasize text — default style should be followed by "light" followed by "lighter".
424
+ status: "stable"
425
+ - name: "caption"
426
+ platforms: *web
427
+ description: Use to provide supplementary context. Default size is best when providing supplementary context to a small section (i.e. label for a text input, label for a paragraph). Use large caption when supplementary text covers more content.
428
+ status: "stable"
429
+ - name: "detail"
430
+ platforms: *web
431
+ description: Used for tables or designs with large amounts of data or text.
432
+ status: "stable"
433
+ - name: "title"
434
+ platforms: *web
435
+ description: Typically used as headers. Follow semantic hierarchy — Title 1s should be followed by Title 2s followed by Title 3s and so on, without skipping any levels.
436
+ status: "stable"
437
+ - name: user
438
+ description:
439
+ components:
440
+ - name: "avatar"
441
+ platforms: *all
442
+ description: Avatar displays a user's picture. This helps aid easy recognition of the user. This kit is normally not used by itself, but rather used within other kits. The only time Avatar should be used instead of the User kit is when you are not going to display the user's name.
443
+ status: "stable"
444
+ - name: "avatar_action_button"
445
+ platforms: *web
446
+ description:
447
+ status: "stable"
448
+ - name: "multiple_users"
449
+ platforms: *web
450
+ description: The multiple users kit is used to show that more than one user is associated to an action or item.
451
+ status: "stable"
452
+ - name: "multiple_users_stacked"
453
+ platforms: *web
454
+ description: Multiple users stacked is used in tight spaces, where we need to indicate that multiple users are associated to a specific action or item.
455
+ status: "stable"
456
+ - name: "user"
457
+ platforms: *web
458
+ description: This kit was created for having a systematic way of displaying users with avatar, titles, name and territory. This is a versatile kit with features than can be added to display more info.
459
+ status: "stable"
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlaybookWebsite
4
+ module PbDocHelper
5
+ def pb_kit_title(title)
6
+ title.remove("pb_").titleize.tr("_", " ")
7
+ end
8
+
9
+ def pb_kit(kit: "", type: "rails", show_code: true, limit_examples: false, dark_mode: false)
10
+ examples = pb_doc_kit_examples(kit, type)
11
+ examples = examples.first(1) if limit_examples
12
+ examples.map do |example|
13
+ pb_rails "docs/kit_example", props: {
14
+ kit: kit,
15
+ example_title: example.values.first,
16
+ example_key: example.keys.first,
17
+ show_code: show_code,
18
+ type: type,
19
+ dark: dark_mode,
20
+ }
21
+ end.join.yield_self(&method(:raw))
22
+ end
23
+
24
+ def nav_hash_array(link)
25
+ link.first.last
26
+ end
27
+
28
+ # Deal with lists of kits, used in Playbook doc and Externally
29
+ # rubocop:disable Style/StringConcatenation
30
+ def pb_kits(type: "rails", limit_examples: false, dark_mode: false, method: get_kits)
31
+ display_kits = []
32
+ kits = method
33
+ kits.each do |kit|
34
+ if kit.is_a?(Hash)
35
+ nav_hash_array(kit).each do |sub_kit|
36
+ display_kits << render_pb_doc_kit(sub_kit[:name], type, limit_examples, false, dark_mode) if sub_kit[:status] != "beta" && pb_doc_has_kit_type?(sub_kit[:name], type)
37
+ end
38
+ elsif pb_doc_has_kit_type?(kit, type)
39
+ display_kits << render_pb_doc_kit(kit, type, limit_examples, false, dark_mode)
40
+ end
41
+ end
42
+ raw("<div class='pb--docItem'>" + display_kits.join("</div><div class='pb--docItem'>") + "</div>")
43
+ end
44
+ # rubocop:enable Style/StringConcatenation
45
+
46
+ # rubocop:disable Naming/AccessorMethodName
47
+ def get_kits(_type = "rails")
48
+ aggregate_kits_with_status || []
49
+ end
50
+
51
+ def get_kits_pb_website
52
+ menu = YAML.load_file(Rails.root.join("config/menu.yml"))
53
+ menu["kits"]
54
+ end
55
+ # rubocop:enable Naming/AccessorMethodName
56
+
57
+ # rubocop:disable Style/OptionalBooleanParameter
58
+ def render_pb_doc_kit(kit, type, limit_examples, code = true, dark_mode = false)
59
+ title = pb_doc_render_clickable_title(kit, type)
60
+ ui = raw("<div class='pb--docItem-ui'>
61
+ #{pb_kit(kit: kit, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}</div>")
62
+ title + ui
63
+ end
64
+ # rubocop:enable Style/OptionalBooleanParameter
65
+
66
+ private
67
+
68
+ def pb_doc_kit_path(kit, *args)
69
+ Playbook.kit_path(kit, "docs", *args)
70
+ end
71
+
72
+ def pb_doc_kit_examples(kit, type)
73
+ example_file = pb_doc_kit_path(kit, "example.yml")
74
+ if File.exist?(example_file)
75
+ examples_list = YAML.load_file(example_file)
76
+ .inject({}) { |item, (k, v)| item[k.to_sym] = v; item }
77
+ examples_list.dig(:examples, type) || []
78
+ else
79
+ []
80
+ end
81
+ end
82
+
83
+ def pb_doc_render_clickable_title(kit, type)
84
+ url = "#"
85
+ begin
86
+ url = case type
87
+ when "react"
88
+ kit_show_reacts_path(kit)
89
+ when "swift"
90
+ kit_show_swift_path(kit)
91
+ else
92
+ kit_show_path(kit)
93
+ end
94
+ # FIXME: this is here because this helper generates a link for playbook website,
95
+ # but shouldn't do anything when used elsewhere
96
+ rescue
97
+ puts "Kit Path Not Avaliable"
98
+ end
99
+ render inline: "<a href='#{url}'>#{pb_rails(:title, props: { text: pb_kit_title(kit), tag: 'h3', size: 2 })}</a>"
100
+ end
101
+ end
102
+ end