playbook_ui 14.15.0.pre.rc.4 → 14.16.0.pre.rc.0
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +127 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +55 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +275 -0
- data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +143 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +66 -0
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +195 -0
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +45 -99
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +73 -0
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +52 -0
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +80 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +123 -7
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +153 -299
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +50 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_infinite_scroll.json +152002 -0
- data/app/pb_kits/playbook/pb_card/_card.tsx +2 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +4 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +2 -0
- data/app/pb_kits/playbook/pb_date_picker/index.ts +38 -0
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +5 -6
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +2 -0
- data/app/pb_kits/playbook/pb_dialog/index.js +75 -0
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +19 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +3 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +20 -37
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +6 -6
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +5 -4
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +9 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +4 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.html.erb +40 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +50 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.md +3 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +7 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +7 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +13 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +6 -0
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +85 -74
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +60 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.md +1 -0
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_radio/radio.test.js +16 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +58 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.md +1 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_select/select.html.erb +3 -5
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -5
- data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +1 -4
- data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +1 -5
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +2 -2
- data/app/pb_kits/playbook/pb_title/_title.scss +32 -0
- data/app/pb_kits/playbook/pb_title/_title.tsx +10 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_default.html.erb +1 -2
- data/app/pb_kits/playbook/pb_title/docs/_title_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.html.erb +7 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.jsx +54 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.md +1 -0
- data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_title/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_title/title.rb +10 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +25 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +69 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.md +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +2 -1
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +5 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +4 -1
- data/app/pb_kits/playbook/utilities/object.test.js +99 -0
- data/app/pb_kits/playbook/utilities/object.ts +29 -1
- data/dist/chunks/_typeahead-RfKdit7E.js +36 -0
- data/dist/chunks/_weekday_stacked-RWsNWtMH.js +45 -0
- data/dist/chunks/{lib-Dmay5Z6U.js → lib-5OzNgeeu.js} +2 -2
- data/dist/chunks/{pb_form_validation-DdP7BnVX.js → pb_form_validation-DGhKbZtO.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +34 -6
- data/dist/chunks/_typeahead-NXKDTf__.js +0 -36
- data/dist/chunks/_weekday_stacked-DtCYkCXM.js +0 -45
@@ -1,7 +1,8 @@
|
|
1
1
|
/* eslint-disable react/no-multi-comp */
|
2
2
|
|
3
3
|
import React from 'react'
|
4
|
-
import { get } from '
|
4
|
+
import { get } from '../utilities/object'
|
5
|
+
|
5
6
|
import classnames from 'classnames'
|
6
7
|
|
7
8
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
@@ -1,5 +1,8 @@
|
|
1
1
|
<%= pb_content_tag(:div,
|
2
|
-
class: object.classname + object.error_class
|
2
|
+
class: object.classname + object.error_class,
|
3
|
+
'data-pb-date-picker' => true,
|
4
|
+
'data-validation-message' => object.validation_message,
|
5
|
+
) do %>
|
3
6
|
<div class="input_wrapper">
|
4
7
|
<% if content.present? %>
|
5
8
|
<%= content %>
|
@@ -75,6 +75,8 @@ module Playbook
|
|
75
75
|
default: [1900, 2100]
|
76
76
|
prop :custom_event_type, type: Playbook::Props::String,
|
77
77
|
default: ""
|
78
|
+
prop :validation_message, type: Playbook::Props::String,
|
79
|
+
default: ""
|
78
80
|
|
79
81
|
def classname
|
80
82
|
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element";
|
2
|
+
|
3
|
+
const DATE_PICKER_WRAPPER_SELECTOR = '[data-pb-date-picker]';
|
4
|
+
const SELECT_VALIDATION_MESSAGE_CLASS = '.pb_body_kit_negative';
|
5
|
+
|
6
|
+
export default class PbDatePicker extends PbEnhancedElement {
|
7
|
+
static get selector() {
|
8
|
+
return DATE_PICKER_WRAPPER_SELECTOR;
|
9
|
+
}
|
10
|
+
|
11
|
+
connect() {
|
12
|
+
this.setValidationMessage();
|
13
|
+
}
|
14
|
+
|
15
|
+
setValidationMessage() {
|
16
|
+
const validationMessage = this.element.dataset?.validationMessage;
|
17
|
+
const inputElement = this.element.querySelector("input");
|
18
|
+
|
19
|
+
if (validationMessage) {
|
20
|
+
const setErrorTextContent = (text, timeout) => {
|
21
|
+
setTimeout(() => {
|
22
|
+
const errorMessageElement = this.element.querySelector(SELECT_VALIDATION_MESSAGE_CLASS);
|
23
|
+
if (errorMessageElement) {
|
24
|
+
errorMessageElement.textContent = text;
|
25
|
+
} else {
|
26
|
+
setErrorTextContent(text, 100);
|
27
|
+
}
|
28
|
+
}, timeout);
|
29
|
+
};
|
30
|
+
|
31
|
+
inputElement.addEventListener("change", (e) => {
|
32
|
+
if (!e.target.checkValidity()) {
|
33
|
+
setErrorTextContent(validationMessage, 300);
|
34
|
+
}
|
35
|
+
});
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
@@ -1,4 +1,8 @@
|
|
1
|
-
<div
|
1
|
+
<div
|
2
|
+
class="pb_dialog_wrapper_rails <%= object.full_height_style %>"
|
3
|
+
data-pb-dialog-wrapper="true"
|
4
|
+
data-overlay-click= <%= object.overlay_close %>
|
5
|
+
>
|
2
6
|
<%= pb_content_tag(:dialog) do %>
|
3
7
|
<% if object.status === "" && object.title %>
|
4
8
|
<%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id }) %>
|
@@ -33,8 +37,3 @@
|
|
33
37
|
<%= content %>
|
34
38
|
<% end %>
|
35
39
|
</div>
|
36
|
-
|
37
|
-
<%= javascript_tag do %>
|
38
|
-
window.addEventListener("DOMContentLoaded", () => dialogHelper())
|
39
|
-
window.addEventListener("turbo:frame-load", () => dialogHelper())
|
40
|
-
<% end %>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
// Three places in Nitro depend on this function inside the window scope.
|
2
|
+
// We will keep this file until we remove this dependency from Nitro.
|
1
3
|
const dialogHelper = () => {
|
2
4
|
const openTrigger = document.querySelectorAll("[data-open-dialog]");
|
3
5
|
const closeTrigger = document.querySelectorAll("[data-close-dialog]");
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element";
|
2
|
+
|
3
|
+
const DIALOG_WRAPPER_SELECTOR = "[data-pb-dialog-wrapper]";
|
4
|
+
|
5
|
+
export default class PbDialog extends PbEnhancedElement {
|
6
|
+
static get selector() {
|
7
|
+
return DIALOG_WRAPPER_SELECTOR;
|
8
|
+
}
|
9
|
+
|
10
|
+
connect() {
|
11
|
+
window.addEventListener("DOMContentLoaded", () => this.setupDialog())
|
12
|
+
window.addEventListener("turbo:frame-load", () => this.setupDialog())
|
13
|
+
}
|
14
|
+
|
15
|
+
setupDialog() {
|
16
|
+
const openTrigger = document.querySelectorAll("[data-open-dialog]");
|
17
|
+
const closeTrigger = document.querySelectorAll("[data-close-dialog]");
|
18
|
+
const dialogs = document.querySelectorAll(".pb_dialog_rails")
|
19
|
+
|
20
|
+
const loadingButton = document.querySelector('[data-disable-with="Loading"]');
|
21
|
+
if (loadingButton) {
|
22
|
+
loadingButton.addEventListener("click", function () {
|
23
|
+
const okayLoadingButton = document.querySelector('[data-disable-with="Loading"]');
|
24
|
+
const cancelButton = document.querySelector('[data-disable-cancel-with="Loading"]');
|
25
|
+
let currentClass = okayLoadingButton.className;
|
26
|
+
let cancelClass = cancelButton ? cancelButton.className : "";
|
27
|
+
|
28
|
+
let newClass = currentClass.replace("_enabled", "_disabled_loading");
|
29
|
+
let newCancelClass = cancelClass.replace("_enabled", "_disabled");
|
30
|
+
|
31
|
+
// Disable the buttons
|
32
|
+
okayLoadingButton.disabled = true;
|
33
|
+
if (cancelButton) cancelButton.disabled = true;
|
34
|
+
|
35
|
+
okayLoadingButton.className = newClass;
|
36
|
+
if (cancelButton) cancelButton.className = newCancelClass;
|
37
|
+
});
|
38
|
+
}
|
39
|
+
|
40
|
+
openTrigger.forEach((open) => {
|
41
|
+
open.addEventListener("click", () => {
|
42
|
+
var openTriggerData = open.dataset.openDialog;
|
43
|
+
var targetDialog = document.getElementById(openTriggerData)
|
44
|
+
if (targetDialog.open) return;
|
45
|
+
targetDialog.showModal();
|
46
|
+
});
|
47
|
+
});
|
48
|
+
|
49
|
+
closeTrigger.forEach((close) => {
|
50
|
+
close.addEventListener("click", () => {
|
51
|
+
var closeTriggerData = close.dataset.closeDialog;
|
52
|
+
document.getElementById(closeTriggerData).close();
|
53
|
+
});
|
54
|
+
});
|
55
|
+
|
56
|
+
// Close dialog box on outside click
|
57
|
+
dialogs.forEach((dialogElement) => {
|
58
|
+
dialogElement.addEventListener("mousedown", (event) => {
|
59
|
+
const dialogParentDataset = dialogElement.parentElement.dataset
|
60
|
+
if (dialogParentDataset.overlayClick === "overlay_close") return
|
61
|
+
|
62
|
+
const dialogModal = event.target.getBoundingClientRect()
|
63
|
+
const clickedOutsideDialogModal = event.clientX < dialogModal.left ||
|
64
|
+
event.clientX > dialogModal.right ||
|
65
|
+
event.clientY < dialogModal.top ||
|
66
|
+
event.clientY > dialogModal.bottom
|
67
|
+
|
68
|
+
if (clickedOutsideDialogModal) {
|
69
|
+
dialogElement.close()
|
70
|
+
event.stopPropagation()
|
71
|
+
}
|
72
|
+
})
|
73
|
+
})
|
74
|
+
}
|
75
|
+
}
|
@@ -134,6 +134,14 @@ body.PBDrawer__Body--close {
|
|
134
134
|
transition: margin-left $animation-duration ease-out, margin-right $animation-duration ease-out;
|
135
135
|
}
|
136
136
|
|
137
|
+
.pb_drawer_lg_left .pb_drawer {
|
138
|
+
transform: translateX(-100%);
|
139
|
+
}
|
140
|
+
|
141
|
+
.pb_drawer_lg_right .pb_drawer {
|
142
|
+
transform: translateX(100%);
|
143
|
+
}
|
144
|
+
|
137
145
|
.pb_drawer.pb_drawer_after_open {
|
138
146
|
pointer-events: auto;
|
139
147
|
transform: translate3d(0, 0, 0);
|
@@ -317,7 +325,6 @@ body.PBDrawer__Body--close {
|
|
317
325
|
display: flex;
|
318
326
|
background-color: rgba($bg_dark, $opacity_4);
|
319
327
|
z-index: $z-index;
|
320
|
-
opacity: 0;
|
321
328
|
animation: overlayFade $animation-duration ease-in-out forwards;
|
322
329
|
|
323
330
|
&[class*="_left"]{
|
@@ -345,12 +352,21 @@ body.PBDrawer__Body--close {
|
|
345
352
|
left: 0;
|
346
353
|
right: 0;
|
347
354
|
bottom: 0;
|
355
|
+
display: flex;
|
348
356
|
z-index: $z-index;
|
349
357
|
opacity: 1;
|
350
358
|
pointer-events: none;
|
351
359
|
|
352
|
-
&
|
353
|
-
|
360
|
+
&[class*="_right"]{
|
361
|
+
justify-content: flex-end;
|
362
|
+
}
|
363
|
+
|
364
|
+
&[class*="_left"]{
|
365
|
+
justify-content: flex-start;
|
366
|
+
}
|
367
|
+
|
368
|
+
&[class*="_center"]{
|
369
|
+
justify-content: center;
|
354
370
|
}
|
355
371
|
|
356
372
|
&_before_close {
|
@@ -41,7 +41,7 @@ const DrawerBorders = () => {
|
|
41
41
|
onClose={toggleBRightDrawer}
|
42
42
|
opened={openedBRightDrawer}
|
43
43
|
overlay={false}
|
44
|
-
placement="
|
44
|
+
placement="right"
|
45
45
|
size="lg"
|
46
46
|
>
|
47
47
|
This is a Drawer with border right
|
@@ -52,7 +52,7 @@ const DrawerBorders = () => {
|
|
52
52
|
onClose={toggleBLeftDrawer}
|
53
53
|
opened={openedBLeftDrawer}
|
54
54
|
overlay={false}
|
55
|
-
placement="
|
55
|
+
placement="right"
|
56
56
|
size="lg"
|
57
57
|
>
|
58
58
|
This is a Drawer with border left
|
@@ -63,7 +63,7 @@ const DrawerBorders = () => {
|
|
63
63
|
onClose={toggleBFullDrawer}
|
64
64
|
opened={openedBFullDrawer}
|
65
65
|
overlay={false}
|
66
|
-
placement="
|
66
|
+
placement="right"
|
67
67
|
size="lg"
|
68
68
|
>
|
69
69
|
This is a Drawer with border full
|
@@ -1,42 +1,25 @@
|
|
1
|
-
import React
|
2
|
-
import { Button,
|
3
|
-
|
4
|
-
const useDrawer = (visible = false) => {
|
5
|
-
const [opened, setOpened] = useState(visible);
|
6
|
-
const toggle = () => setOpened(!opened);
|
7
|
-
|
8
|
-
return [opened, toggle];
|
9
|
-
};
|
10
|
-
|
11
|
-
const DrawerBreakpoints = () => {
|
12
|
-
const [smallDrawerOpened, toggleSmallDrawer] = useDrawer();
|
1
|
+
import React from "react"
|
2
|
+
import { Button, Body } from "playbook-ui"
|
13
3
|
|
4
|
+
const DrawerMenu = () => {
|
14
5
|
return (
|
15
6
|
<>
|
16
|
-
<
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
opened={smallDrawerOpened}
|
31
|
-
overlay={false}
|
32
|
-
placement={"right"}
|
33
|
-
size={"lg"}
|
34
|
-
>
|
35
|
-
Open because small breakpoint
|
36
|
-
</Drawer>
|
37
|
-
</Flex>
|
7
|
+
<Body>
|
8
|
+
The breakpoint prop determines when the Drawer is always visible. Above
|
9
|
+
the specified breakpoint, the Drawer remains open on the page. Below it,
|
10
|
+
only the trigger element is shown, allowing you to toggle the drawer
|
11
|
+
open and closed. To see this in action, click the button below and
|
12
|
+
resize your window.
|
13
|
+
</Body>
|
14
|
+
<Button
|
15
|
+
link='https://8njdkc.csb.app/'
|
16
|
+
marginTop='md'
|
17
|
+
newWindow
|
18
|
+
>
|
19
|
+
Open Doc Example in New Tab
|
20
|
+
</Button>
|
38
21
|
</>
|
39
|
-
)
|
40
|
-
}
|
22
|
+
)
|
23
|
+
}
|
41
24
|
|
42
|
-
export default
|
25
|
+
export default DrawerMenu
|
@@ -8,8 +8,8 @@ const DrawerMenu = () => {
|
|
8
8
|
const mediaQuery = window.matchMedia("(max-width: 600px)")
|
9
9
|
setIsSmallScreen(mediaQuery.matches)
|
10
10
|
const handler = (e) => setIsSmallScreen(e.matches)
|
11
|
-
mediaQuery.addEventListener(
|
12
|
-
return () => mediaQuery.removeEventListener(
|
11
|
+
mediaQuery.addEventListener("change", handler)
|
12
|
+
return () => mediaQuery.removeEventListener("change", handler)
|
13
13
|
}, [])
|
14
14
|
|
15
15
|
return (
|
@@ -22,17 +22,17 @@ const DrawerMenu = () => {
|
|
22
22
|
/>
|
23
23
|
</Button>
|
24
24
|
<Drawer
|
25
|
-
breakpoint=
|
25
|
+
breakpoint='md'
|
26
26
|
placement='bottom'
|
27
27
|
size='full'
|
28
28
|
triggerId='menuButton'
|
29
29
|
withinElement
|
30
30
|
>
|
31
|
-
<Nav
|
31
|
+
<Nav
|
32
32
|
highlight={false}
|
33
33
|
link='#'
|
34
|
-
orientation={isSmallScreen ?
|
35
|
-
padding={isSmallScreen ?
|
34
|
+
orientation={isSmallScreen ? "vertical" : "horizontal"}
|
35
|
+
padding={isSmallScreen ? "none" : "sm"}
|
36
36
|
>
|
37
37
|
<NavItem link='#'
|
38
38
|
text='About'
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import {
|
2
|
+
import { map } from 'lodash'
|
3
|
+
import { isEmpty, omitBy } from '../../utilities/object'
|
3
4
|
|
4
5
|
import Body from '../../pb_body/_body'
|
5
6
|
import Caption from '../../pb_caption/_caption'
|
@@ -40,13 +41,13 @@ const CurrentFilters = ({ dark, filters }: CurrentFiltersProps): React.ReactElem
|
|
40
41
|
className="filter"
|
41
42
|
key={`filter-${name}`}
|
42
43
|
>
|
43
|
-
{ value === true ?
|
44
|
+
{ value === true ?
|
44
45
|
<Title
|
45
46
|
dark={dark}
|
46
47
|
size={4}
|
47
48
|
tag="h4"
|
48
49
|
text={name}
|
49
|
-
/> :
|
50
|
+
/> :
|
50
51
|
<div>
|
51
52
|
<Caption
|
52
53
|
dark={dark}
|
@@ -58,7 +59,7 @@ const CurrentFilters = ({ dark, filters }: CurrentFiltersProps): React.ReactElem
|
|
58
59
|
tag="h4"
|
59
60
|
text={value}
|
60
61
|
/>
|
61
|
-
</div>
|
62
|
+
</div>
|
62
63
|
}
|
63
64
|
</div>
|
64
65
|
))}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import { isEmpty } from '
|
2
|
+
import { isEmpty } from '../../utilities/object'
|
3
3
|
|
4
4
|
import Flex from '../../pb_flex/_flex'
|
5
5
|
|
@@ -46,7 +46,7 @@ const FilterSingle = ({
|
|
46
46
|
paddingRight="lg"
|
47
47
|
vertical="center"
|
48
48
|
>
|
49
|
-
{ children &&
|
49
|
+
{ children &&
|
50
50
|
<>
|
51
51
|
<FiltersPopover
|
52
52
|
dark={dark}
|
@@ -35,7 +35,7 @@
|
|
35
35
|
<%= form.select :example_select_validation, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true, validation_message: "Please, select an option." } %>
|
36
36
|
<%= form.collection_select :example_collection_select_validation, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
|
37
37
|
<%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
|
38
|
-
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true } %>
|
38
|
+
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true, validation_message: "Please, select a date.", allow_input: true } %>
|
39
39
|
<%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
|
40
40
|
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true, blank_selection: "Select a Time Zone...", required: true } %>
|
41
41
|
|
@@ -23,6 +23,13 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
23
23
|
.pb_form_pill_text, .pb_form_pill_close, .pb_form_pill_tag{
|
24
24
|
font-size: $font_small !important;
|
25
25
|
}
|
26
|
+
|
27
|
+
&[class*=wrapped] {
|
28
|
+
height: max-content;
|
29
|
+
padding-top: $space-xxs;
|
30
|
+
padding-bottom: $space-xxs;
|
31
|
+
}
|
32
|
+
|
26
33
|
@each $color_name, $color_value in $form_pill_colors {
|
27
34
|
&[class*=_#{$color_name}] {
|
28
35
|
background-color: mix($color_value, $card_light, 10%);
|
@@ -142,7 +149,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
142
149
|
height: 12px !important;
|
143
150
|
width: 12px !important;
|
144
151
|
padding-right: $space_xs;
|
145
|
-
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
152
|
+
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
146
153
|
+ .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
|
147
154
|
+ div .pb_form_pill_text, + div .pb_form_pill_tag {
|
148
155
|
padding-left: 0;
|
@@ -171,7 +178,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
171
178
|
}
|
172
179
|
.pb_form_pill_icon {
|
173
180
|
padding-right: $space_xxs;
|
174
|
-
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
181
|
+
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
175
182
|
+ .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
|
176
183
|
+ div .pb_form_pill_text, + div .pb_form_pill_tag {
|
177
184
|
padding-left: 0;
|
@@ -22,6 +22,7 @@ type FormPillProps = {
|
|
22
22
|
data?: {[key: string]: string},
|
23
23
|
tabIndex?: number,
|
24
24
|
icon?: string,
|
25
|
+
wrapped?: boolean,
|
25
26
|
closeProps?: {
|
26
27
|
onClick?: React.MouseEventHandler<HTMLSpanElement>,
|
27
28
|
onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
|
@@ -38,6 +39,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
38
39
|
onClick = () => undefined,
|
39
40
|
avatarUrl,
|
40
41
|
closeProps = {},
|
42
|
+
wrapped,
|
41
43
|
size = '',
|
42
44
|
textTransform = 'none',
|
43
45
|
color = "primary",
|
@@ -48,6 +50,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
48
50
|
|
49
51
|
const iconClass = icon ? "_icon" : ""
|
50
52
|
const closeIconSize = size === "small" ? "xs" : "sm"
|
53
|
+
const wrappedClass = wrapped ? "wrapped" : ""
|
51
54
|
|
52
55
|
const filteredProps: FormPillProps = {...props}
|
53
56
|
delete filteredProps.truncate
|
@@ -55,6 +58,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
55
58
|
const css = classnames(
|
56
59
|
`pb_form_pill_kit_${color}${iconClass}`,
|
57
60
|
globalProps(filteredProps),
|
61
|
+
wrappedClass,
|
58
62
|
className,
|
59
63
|
size === 'small' ? 'small' : null,
|
60
64
|
textTransform,
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
names = [
|
3
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
4
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
5
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
6
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
7
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
8
|
+
]
|
9
|
+
%>
|
10
|
+
|
11
|
+
<%= pb_rails("typeahead", props: {
|
12
|
+
html_options: { style: { maxWidth: "240px" }},
|
13
|
+
id: "typeahead-form-pill",
|
14
|
+
is_multi: true,
|
15
|
+
options: names,
|
16
|
+
label: "Wrapped Within Typeahead",
|
17
|
+
pills: true,
|
18
|
+
wrapped: true,
|
19
|
+
}) %>
|
20
|
+
|
21
|
+
<%= pb_rails("caption", props: { text: "Form Pill Wrapped Text" }) %>
|
22
|
+
<%= pb_rails("card", props: { max_width: "xs" }) do %>
|
23
|
+
<%= pb_rails("form_pill", props: {
|
24
|
+
name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo",
|
25
|
+
avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
|
26
|
+
tabindex: 0,
|
27
|
+
wrapped: true,
|
28
|
+
}) %>
|
29
|
+
<%= pb_rails("form_pill", props: {
|
30
|
+
icon: "badge-check",
|
31
|
+
text: "icon and a very long tag to show wrapped text",
|
32
|
+
tabindex: 0,
|
33
|
+
wrapped: true,
|
34
|
+
}) %>
|
35
|
+
<%= pb_rails("form_pill", props: {
|
36
|
+
text: "form pill long tag no tooltip show wrapped text",
|
37
|
+
tabindex: 0,
|
38
|
+
wrapped: true,
|
39
|
+
}) %>
|
40
|
+
<% end %>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Card, Caption, FormPill, Typeahead } from 'playbook-ui'
|
3
|
+
|
4
|
+
const names = [
|
5
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
6
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
7
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
8
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
9
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
10
|
+
]
|
11
|
+
|
12
|
+
const FormPillWrapped = (props) => {
|
13
|
+
return (
|
14
|
+
<>
|
15
|
+
<Typeahead
|
16
|
+
htmlOptions={{ style: { maxWidth: "240px" } }}
|
17
|
+
isMulti
|
18
|
+
label="Wrapped Within Typeahead"
|
19
|
+
options={names}
|
20
|
+
wrapped
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
<Caption text="Form Pill Wrapped Text"/>
|
24
|
+
<Card maxWidth="xs">
|
25
|
+
<FormPill
|
26
|
+
avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
|
27
|
+
name="Princess Amelia Mignonette Grimaldi Thermopolis Renaldo"
|
28
|
+
onClick={() => alert('Click!')}
|
29
|
+
tabIndex={0}
|
30
|
+
wrapped
|
31
|
+
/>
|
32
|
+
<FormPill
|
33
|
+
icon="badge-check"
|
34
|
+
onClick={() => {alert('Click!')}}
|
35
|
+
tabIndex={0}
|
36
|
+
text="icon and a very long tag to show wrapped text"
|
37
|
+
wrapped
|
38
|
+
/>
|
39
|
+
<FormPill
|
40
|
+
onClick={() => {alert('Click!')}}
|
41
|
+
tabIndex={0}
|
42
|
+
text="form pill with a very long tag to show wrapped text"
|
43
|
+
wrapped
|
44
|
+
/>
|
45
|
+
</Card>
|
46
|
+
</>
|
47
|
+
)
|
48
|
+
}
|
49
|
+
|
50
|
+
export default FormPillWrapped
|
@@ -4,6 +4,7 @@ examples:
|
|
4
4
|
- form_pill_user: Form Pill User
|
5
5
|
- form_pill_size: Form Pill Size
|
6
6
|
- form_pill_truncated_text: Truncated Text
|
7
|
+
- form_pill_wrapped: Wrapped Text
|
7
8
|
- form_pill_tag: Form Pill Tag
|
8
9
|
- form_pill_example: Example
|
9
10
|
- form_pill_icon: Form Pill Icon
|
@@ -13,6 +14,7 @@ examples:
|
|
13
14
|
- form_pill_user: Form Pill User
|
14
15
|
- form_pill_size: Form Pill Size
|
15
16
|
- form_pill_truncated_text: Truncated Text
|
17
|
+
- form_pill_wrapped: Wrapped Text
|
16
18
|
- form_pill_tag: Form Pill Tag
|
17
19
|
- form_pill_example: Example
|
18
20
|
- form_pill_icon: Form Pill Icon
|
@@ -5,3 +5,4 @@ export { default as FormPillExample } from './_form_pill_example.jsx'
|
|
5
5
|
export { default as FormPillIcon } from './_form_pill_icon.jsx'
|
6
6
|
export { default as FormPillColors } from './_form_pill_colors.jsx'
|
7
7
|
export { default as FormPillTruncatedText } from './_form_pill_truncated_text.jsx'
|
8
|
+
export { default as FormPillWrapped } from './_form_pill_wrapped.jsx'
|
@@ -16,9 +16,11 @@ module Playbook
|
|
16
16
|
default: "primary"
|
17
17
|
prop :tabindex
|
18
18
|
prop :icon
|
19
|
+
prop :wrapped, type: Playbook::Props::Boolean,
|
20
|
+
default: false
|
19
21
|
|
20
22
|
def classname
|
21
|
-
generate_classname("pb_form_pill_kit", color, icon_class, name, text, text_transform)
|
23
|
+
generate_classname("pb_form_pill_kit", color, icon_class, name, text, text_transform, wrapped_class)
|
22
24
|
end
|
23
25
|
|
24
26
|
def display_text
|
@@ -36,6 +38,10 @@ module Playbook
|
|
36
38
|
def close_icon_size
|
37
39
|
size == "small" ? "xs" : "sm"
|
38
40
|
end
|
41
|
+
|
42
|
+
def wrapped_class
|
43
|
+
wrapped ? "wrapped" : nil
|
44
|
+
end
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|