playbook_ui 14.6.0.pre.alpha.play1586datearea4218 → 14.6.0.pre.rc.0
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_advanced_table/_advanced_table.tsx +7 -25
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +9 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +9 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +7 -30
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.md +2 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +3 -84
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +5 -28
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +0 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +1 -10
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +2 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.tsx +0 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +0 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx +1 -4
- data/app/pb_kits/playbook/pb_filter/Filter/ResultsCount.tsx +2 -4
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_filter/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +2 -2
- data/app/pb_kits/playbook/pb_filter/filter.rb +0 -2
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +1 -3
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +2 -8
- data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +6 -3
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -7
- data/app/pb_kits/playbook/pb_form/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_form/form.rb +0 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -9
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +227 -211
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +65 -169
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js +5 -5
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +9 -15
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -28
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb +1 -31
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +18 -86
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +6 -15
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/intlTelInput.scss +931 -849
- data/app/pb_kits/playbook/pb_phone_number_input/types.d.ts +1 -4
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +2 -6
- data/app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_popover/popover.rb +1 -3
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +23 -59
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +0 -8
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +21 -17
- data/app/pb_kits/playbook/pb_timeline/item.rb +0 -4
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +0 -84
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -4
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -3
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -3
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -3
- data/app/pb_kits/playbook/utilities/globalProps.ts +2 -39
- data/dist/chunks/_typeahead-BYw0HEgO.js +22 -0
- data/dist/chunks/_weekday_stacked-DumiyWjh.js +45 -0
- data/dist/chunks/{lib-D-mTv-kp.js → lib-CEpcaI8y.js} +1 -1
- data/dist/chunks/{pb_form_validation-BkWGwJsl.js → pb_form_validation-D9zkwt2b.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/kit_base.rb +1 -21
- data/lib/playbook/pb_doc_helper.rb +5 -5
- data/lib/playbook/pb_forms_helper.rb +1 -3
- data/lib/playbook/version.rb +2 -2
- metadata +6 -48
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +0 -72
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.md +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +0 -45
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +0 -9
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +0 -33
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +0 -34
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +0 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.html.erb +0 -41
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.jsx +0 -71
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_rails.md +0 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_react.md +0 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +0 -39
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.md +0 -1
- data/app/pb_kits/playbook/pb_form/formHelper.js +0 -27
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +0 -19
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +0 -27
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/context/index.tsx +0 -5
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.html.erb +0 -93
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +0 -105
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +0 -106
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +0 -149
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.html.erb +0 -336
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.jsx +0 -97
- data/app/pb_kits/playbook/pb_timeline/date_area.html.erb +0 -12
- data/app/pb_kits/playbook/pb_timeline/date_area.rb +0 -13
- data/app/pb_kits/playbook/pb_timeline/detail_area.html.erb +0 -3
- data/app/pb_kits/playbook/pb_timeline/detail_area.rb +0 -11
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +0 -43
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +0 -68
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md +0 -4
- data/app/pb_kits/playbook/pb_timeline/node_area.html.erb +0 -14
- data/app/pb_kits/playbook/pb_timeline/node_area.rb +0 -16
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Detail.tsx +0 -29
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +0 -38
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Step.tsx +0 -42
- data/app/pb_kits/playbook/pb_timeline/subcomponents/index.tsx +0 -3
- data/dist/chunks/_typeahead-BhHnXJjy.js +0 -22
- data/dist/chunks/_weekday_stacked-C-VEa5Ar.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d642516d659410a6a6143c4f1511481020a8cf8c14179ea0aff3d4a8e83d8780
|
4
|
+
data.tar.gz: 5aa325d5b25798fac84ea63c76c49cfd06fca93a1c03b7806098edf019b29524
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbaaa769fe00fa458fb70c7cfe7a6594b9d72973b701bcdb71a91bec271b47020312eb7c1000c74369b1e96de77652f490b0ebacc3bba584409f63bd6ce75672
|
7
|
+
data.tar.gz: d638415f5ca989bb3ca0b39ab3fd80b2d8896382e69a7ffa273dd7c449b1d34496be14a8cef6b35de11a4c92408b9c0ad0b020071517cf9c0d04b15e60e30515
|
@@ -91,7 +91,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
91
91
|
const columnHelper = createColumnHelper()
|
92
92
|
|
93
93
|
//Create cells for first columns
|
94
|
-
const createCellFunction = (cellAccessors: string[]
|
94
|
+
const createCellFunction = (cellAccessors: string[]) => {
|
95
95
|
const columnCells = ({
|
96
96
|
row,
|
97
97
|
getValue,
|
@@ -101,11 +101,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
101
101
|
}) => {
|
102
102
|
const rowData = row.original
|
103
103
|
|
104
|
-
// Use customRenderer if provided, otherwise default rendering
|
105
|
-
if (customRenderer) {
|
106
|
-
return customRenderer(row, getValue())
|
107
|
-
}
|
108
|
-
|
109
104
|
switch (row.depth) {
|
110
105
|
case 0: {
|
111
106
|
return (
|
@@ -139,31 +134,18 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
139
134
|
//Create column array in format needed by Tanstack
|
140
135
|
const columns =
|
141
136
|
columnDefinitions &&
|
142
|
-
columnDefinitions.map((column
|
137
|
+
columnDefinitions.map((column) => {
|
143
138
|
// Define the base column structure
|
144
139
|
const columnStructure = {
|
145
140
|
...columnHelper.accessor(column.accessor, {
|
146
141
|
header: column.label,
|
147
142
|
}),
|
148
143
|
}
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
column.cellAccessors,
|
155
|
-
column.customRenderer
|
156
|
-
)
|
157
|
-
}
|
158
|
-
} else {
|
159
|
-
// For the first column, apply createCellFunction without customRenderer
|
160
|
-
if (column.cellAccessors) {
|
161
|
-
columnStructure.cell = createCellFunction(column.cellAccessors)
|
162
|
-
}
|
163
|
-
}
|
164
|
-
|
165
|
-
return columnStructure
|
166
|
-
})
|
144
|
+
if (column.cellAccessors) {
|
145
|
+
columnStructure.cell = createCellFunction(column.cellAccessors)
|
146
|
+
}
|
147
|
+
return columnStructure
|
148
|
+
})
|
167
149
|
|
168
150
|
//Syntax for sorting Array if we want to manage state ourselves
|
169
151
|
const sorting = [
|
@@ -3,7 +3,6 @@ examples:
|
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
4
4
|
- advanced_table_beta_subrow_headers: SubRow Headers
|
5
5
|
- advanced_table_beta_sort: Enable Sorting
|
6
|
-
|
7
6
|
react:
|
8
7
|
- advanced_table_default: Default (Required Props)
|
9
8
|
- advanced_table_loading: Loading State
|
@@ -16,4 +15,3 @@ examples:
|
|
16
15
|
- advanced_table_table_props: Table Props
|
17
16
|
- advanced_table_inline_row_loading: Inline Row Loading
|
18
17
|
- advanced_table_responsive: Responsive Tables
|
19
|
-
- advanced_table_custom_cell: Custom Components for Cells
|
@@ -9,4 +9,3 @@ export { default as AdvancedTableTableOptions } from './_advanced_table_table_op
|
|
9
9
|
export { default as AdvancedTableTableProps } from './_advanced_table_table_props.jsx'
|
10
10
|
export { default as AdvancedTableInlineRowLoading } from './_advanced_table_inline_row_loading.jsx'
|
11
11
|
export { default as AdvancedTableResponsive } from './_advanced_table_responsive.jsx'
|
12
|
-
export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cell.jsx'
|
@@ -13,20 +13,9 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
13
13
|
get target() {
|
14
14
|
return document.querySelector(CONTENT_SELECTOR.replace("id", this.element.id))
|
15
15
|
}
|
16
|
-
|
17
|
-
static expandedRows = new Set()
|
18
|
-
static isCollapsing = false
|
19
16
|
|
20
17
|
connect() {
|
21
18
|
this.element.addEventListener('click', () => {
|
22
|
-
if (!PbAdvancedTable.isCollapsing) {
|
23
|
-
const isExpanded = this.element.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
24
|
-
if (!isExpanded) {
|
25
|
-
PbAdvancedTable.expandedRows.add(this.element.id)
|
26
|
-
} else {
|
27
|
-
PbAdvancedTable.expandedRows.delete(this.element.id)
|
28
|
-
}
|
29
|
-
}
|
30
19
|
this.toggleElement(this.target)
|
31
20
|
})
|
32
21
|
}
|
@@ -86,53 +75,4 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
86
75
|
this.element.querySelector(UP_ARROW_SELECTOR).style.display = 'inline-block'
|
87
76
|
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display = 'none'
|
88
77
|
}
|
89
|
-
|
90
|
-
static handleToggleAllHeaders(element) {
|
91
|
-
const table = element.closest('.pb_table')
|
92
|
-
const firstLevelButtons = table.querySelectorAll('.pb_advanced_table_body > .pb_table_tr [data-advanced-table]')
|
93
|
-
|
94
|
-
const expandedRows = Array.from(firstLevelButtons).filter(button =>
|
95
|
-
button.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
96
|
-
)
|
97
|
-
|
98
|
-
if (expandedRows.length === firstLevelButtons.length) {
|
99
|
-
expandedRows.forEach(button => {
|
100
|
-
button.click()
|
101
|
-
})
|
102
|
-
this.expandedRows.clear()
|
103
|
-
} else {
|
104
|
-
firstLevelButtons.forEach(button => {
|
105
|
-
if (!this.expandedRows.has(button.id)) {
|
106
|
-
button.click()
|
107
|
-
}
|
108
|
-
})
|
109
|
-
}
|
110
|
-
}
|
111
|
-
static handleToggleAllSubRows(element, rowDepth) {
|
112
|
-
const parentElement = element.closest(".toggle-content")
|
113
|
-
const subrowButtons = parentElement.querySelectorAll('.depth-sub-row-' + rowDepth + ' [data-advanced-table]')
|
114
|
-
|
115
|
-
const expandedSubRows = Array.from(subrowButtons).filter(button =>
|
116
|
-
button.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
117
|
-
)
|
118
|
-
|
119
|
-
if (expandedSubRows.length === subrowButtons.length) {
|
120
|
-
expandedSubRows.forEach(button => {
|
121
|
-
button.click()
|
122
|
-
})
|
123
|
-
} else {
|
124
|
-
subrowButtons.forEach(button => {
|
125
|
-
if (!this.expandedRows.has(button.id)) {
|
126
|
-
button.click()
|
127
|
-
}
|
128
|
-
})
|
129
|
-
}
|
130
|
-
}
|
131
|
-
}
|
132
|
-
|
133
|
-
window.expandAllRows = (element) => {
|
134
|
-
PbAdvancedTable.handleToggleAllHeaders(element)
|
135
78
|
}
|
136
|
-
window.expandAllSubRows = (element, rowDepth) => {
|
137
|
-
PbAdvancedTable.handleToggleAllSubRows(element, rowDepth)
|
138
|
-
}
|
@@ -13,4 +13,12 @@
|
|
13
13
|
<% end %>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
|
-
<% end %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<script type="text/javascript">
|
19
|
+
var expandAllRows = (element) => {
|
20
|
+
element.closest('.pb_table').querySelectorAll('.pb_advanced_table_body > .pb_table_tr [data-advanced-table]').forEach((button) => {
|
21
|
+
button.dispatchEvent(new Event('click'));
|
22
|
+
});
|
23
|
+
};
|
24
|
+
</script>
|
@@ -23,4 +23,12 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
|
-
<% end %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<script type="text/javascript">
|
29
|
+
var expandAllSubRows = (element, rowDepth) => {
|
30
|
+
element.closest(".toggle-content").querySelectorAll('.depth-sub-row-' + rowDepth + ' [data-advanced-table]').forEach((button) => {
|
31
|
+
button.dispatchEvent(new Event('click'));
|
32
|
+
});
|
33
|
+
};
|
34
|
+
</script>
|
@@ -5,7 +5,7 @@ import { get } from 'lodash'
|
|
5
5
|
import classnames from 'classnames'
|
6
6
|
|
7
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
8
|
-
import { GlobalProps, globalProps
|
8
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
9
9
|
import type { ProductColors, CategoryColors, BackgroundColors } from '../types/colors'
|
10
10
|
|
11
11
|
import Icon from '../pb_icon/_icon'
|
@@ -49,7 +49,6 @@ type CardBodyProps = {
|
|
49
49
|
padding?: string,
|
50
50
|
} & GlobalProps
|
51
51
|
|
52
|
-
|
53
52
|
// Header component
|
54
53
|
const Header = (props: CardHeaderProps) => {
|
55
54
|
const { children, className, headerColor = 'category_1', headerColorStriped = false } = props
|
@@ -108,7 +107,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
108
107
|
|
109
108
|
// coerce to array
|
110
109
|
const cardChildren = React.Children.toArray(children)
|
111
|
-
const dynamicInlineProps = globalInlineProps(props);
|
112
110
|
|
113
111
|
const subComponentTags = (tagName: string) => {
|
114
112
|
return cardChildren.filter((c: string) => (
|
@@ -137,7 +135,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
137
135
|
{...dataProps}
|
138
136
|
{...htmlProps}
|
139
137
|
className={classnames(cardCss, globalProps(props), className)}
|
140
|
-
style={dynamicInlineProps}
|
141
138
|
>
|
142
139
|
{subComponentTags('Header')}
|
143
140
|
{
|
@@ -166,7 +163,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
166
163
|
{...dataProps}
|
167
164
|
{...htmlProps}
|
168
165
|
className={classnames(cardCss, globalProps(props), className)}
|
169
|
-
style={dynamicInlineProps}
|
170
166
|
>
|
171
167
|
{subComponentTags('Header')}
|
172
168
|
{nonHeaderChildren}
|
@@ -6,7 +6,7 @@ import classnames from "classnames";
|
|
6
6
|
import Modal from "react-modal";
|
7
7
|
|
8
8
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
9
|
-
import { globalProps
|
9
|
+
import { globalProps } from "../utilities/globalProps";
|
10
10
|
|
11
11
|
import Body from "../pb_body/_body";
|
12
12
|
import Button from "../pb_button/_button";
|
@@ -91,8 +91,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
91
91
|
beforeClose: "pb_dialog_overlay_before_close",
|
92
92
|
};
|
93
93
|
|
94
|
-
const dynamicInlineProps = globalInlineProps(props);
|
95
|
-
|
96
94
|
const classes = classnames(
|
97
95
|
buildCss("pb_dialog_wrapper"),
|
98
96
|
globalProps(props),
|
@@ -186,7 +184,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
186
184
|
overlayClassName={overlayClassNames}
|
187
185
|
portalClassName={portalClassName}
|
188
186
|
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick && !loading}
|
189
|
-
style={{ content: dynamicInlineProps }}
|
190
187
|
>
|
191
188
|
<>
|
192
189
|
{title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
|
@@ -195,7 +192,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
195
192
|
<Dialog.Body
|
196
193
|
className="dialog_status_text_align"
|
197
194
|
padding="md"
|
198
|
-
|
199
195
|
>
|
200
196
|
<Flex align="center"
|
201
197
|
orientation="column"
|
@@ -1,36 +1,13 @@
|
|
1
1
|
<%= pb_rails("button", props: { text: "Open Dialog", data: {"open-dialog": "dialog-loading"} }) %>
|
2
2
|
|
3
|
-
<%= pb_rails("dialog", props: {
|
4
|
-
id:"dialog-loading",
|
5
|
-
size: "sm",
|
6
|
-
title: "Loading
|
7
|
-
text: "Make a loading request?",
|
8
|
-
cancel_button: "Cancel Button",
|
3
|
+
<%= pb_rails("dialog", props: {
|
4
|
+
id:"dialog-loading",
|
5
|
+
size: "sm",
|
6
|
+
title: "Loading Exmaple",
|
7
|
+
text: "Make a loading request?",
|
8
|
+
cancel_button: "Cancel Button",
|
9
9
|
cancel_button_id: "cancel-button-loading",
|
10
|
-
confirm_button: "Okay",
|
10
|
+
confirm_button: "Okay",
|
11
11
|
confirm_button_id: "confirm-button-loading",
|
12
12
|
loading: true,
|
13
13
|
}) %>
|
14
|
-
|
15
|
-
<script>
|
16
|
-
const loadingButton = document.querySelector('[data-disable-with="Loading"]');
|
17
|
-
if (loadingButton) {
|
18
|
-
loadingButton.addEventListener("click", function() {
|
19
|
-
const okayLoadingButton = document.querySelector('[data-disable-with="Loading"]');
|
20
|
-
const cancelButton = document.querySelector('[data-disable-cancel-with="Loading"]');
|
21
|
-
let currentClass = okayLoadingButton.className;
|
22
|
-
let cancelClass = cancelButton ? cancelButton.className : "";
|
23
|
-
|
24
|
-
setTimeout(function() {
|
25
|
-
okayLoadingButton.disabled = false;
|
26
|
-
okayLoadingButton.className = currentClass.replace("_disabled_loading", "_enabled");
|
27
|
-
|
28
|
-
if (cancelButton) {
|
29
|
-
cancelButton.disabled = false;
|
30
|
-
cancelButton.className = cancelClass.replace("_disabled", "_enabled");
|
31
|
-
}
|
32
|
-
}, 5000);
|
33
|
-
|
34
|
-
});
|
35
|
-
}
|
36
|
-
</script>
|
@@ -69,21 +69,15 @@
|
|
69
69
|
padding-bottom: $space_xs;
|
70
70
|
cursor: pointer;
|
71
71
|
&:hover {
|
72
|
-
background-color: $
|
72
|
+
background-color: $border_light;
|
73
73
|
}
|
74
74
|
|
75
75
|
&[class*="_focused"] {
|
76
|
-
background-color: $
|
76
|
+
background-color: $border_light;
|
77
77
|
}
|
78
78
|
|
79
79
|
&[class*="_list"] {
|
80
80
|
border-bottom: 1px solid $border_light;
|
81
|
-
|
82
|
-
&:hover, &:focus {
|
83
|
-
.pb_body_kit {
|
84
|
-
color: $primary;
|
85
|
-
}
|
86
|
-
}
|
87
81
|
}
|
88
82
|
&[class*="selected"] {
|
89
83
|
background-color: $primary;
|
@@ -93,7 +87,7 @@
|
|
93
87
|
color: $white !important;
|
94
88
|
}
|
95
89
|
&:hover {
|
96
|
-
background-color: $
|
90
|
+
background-color: $primary !important;
|
97
91
|
}
|
98
92
|
}
|
99
93
|
}
|
@@ -131,81 +125,6 @@
|
|
131
125
|
}
|
132
126
|
}
|
133
127
|
|
134
|
-
&.separators_hidden {
|
135
|
-
.dropdown_wrapper {
|
136
|
-
.pb_dropdown_container {
|
137
|
-
|
138
|
-
[class*="pb_dropdown_option"] {
|
139
|
-
border: none;
|
140
|
-
}
|
141
|
-
}
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
&.subtle {
|
146
|
-
.dropdown_wrapper {
|
147
|
-
.pb_dropdown_container {
|
148
|
-
|
149
|
-
[class*="pb_dropdown_option"]:first-child {
|
150
|
-
margin-top: $space_xs;
|
151
|
-
}
|
152
|
-
|
153
|
-
[class*="pb_dropdown_option"]:last-child {
|
154
|
-
margin-bottom: $space_xs;
|
155
|
-
}
|
156
|
-
|
157
|
-
[class*="pb_dropdown_option"] {
|
158
|
-
margin: $space_xs;
|
159
|
-
padding: $space_xs;
|
160
|
-
border-radius: $border_radius_md;
|
161
|
-
border-bottom: none;
|
162
|
-
position: relative;
|
163
|
-
|
164
|
-
&::after {
|
165
|
-
content: "";
|
166
|
-
position: absolute;
|
167
|
-
left: -$space_xs;
|
168
|
-
right: -$space_xs;
|
169
|
-
bottom: -4.5px;
|
170
|
-
height: 1px;
|
171
|
-
background: $border_light;
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
[class*="pb_dropdown_option"]:last-child::after {
|
176
|
-
display: none;
|
177
|
-
}
|
178
|
-
}
|
179
|
-
}
|
180
|
-
|
181
|
-
&.separators_hidden {
|
182
|
-
.dropdown_wrapper {
|
183
|
-
.pb_dropdown_container {
|
184
|
-
[class*="pb_dropdown_option"]:first-child {
|
185
|
-
margin-top: $space_xs;
|
186
|
-
}
|
187
|
-
|
188
|
-
[class*="pb_dropdown_option"]:last-child {
|
189
|
-
margin-bottom: $space_xs;
|
190
|
-
}
|
191
|
-
|
192
|
-
[class*="pb_dropdown_option"] {
|
193
|
-
padding: $space_xxs $space_xs;
|
194
|
-
margin: $space_xxs $space_xs;
|
195
|
-
|
196
|
-
&::after {
|
197
|
-
height: 0px;
|
198
|
-
}
|
199
|
-
|
200
|
-
&[class*="selected"] {
|
201
|
-
border-bottom: none;
|
202
|
-
}
|
203
|
-
}
|
204
|
-
}
|
205
|
-
}
|
206
|
-
}
|
207
|
-
}
|
208
|
-
|
209
128
|
&.dark {
|
210
129
|
.dropdown_wrapper {
|
211
130
|
[class*="dropdown_trigger_wrapper"] {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState, useRef, useEffect
|
1
|
+
import React, { useState, useRef, useEffect } from "react";
|
2
2
|
import classnames from "classnames";
|
3
3
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
4
4
|
import { globalProps } from "../utilities/globalProps";
|
@@ -35,19 +35,10 @@ type DropdownProps = {
|
|
35
35
|
label?: string;
|
36
36
|
onSelect?: (arg: GenericObject) => null;
|
37
37
|
options: GenericObject;
|
38
|
-
separators: boolean;
|
39
38
|
triggerRef?: any;
|
40
|
-
variant?: "default" | "subtle";
|
41
39
|
};
|
42
40
|
|
43
|
-
|
44
|
-
extends React.ForwardRefExoticComponent<DropdownProps & React.RefAttributes<unknown>> {
|
45
|
-
Option: typeof DropdownOption;
|
46
|
-
Trigger: typeof DropdownTrigger;
|
47
|
-
Container: typeof DropdownContainer;
|
48
|
-
}
|
49
|
-
|
50
|
-
const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
41
|
+
const Dropdown = (props: DropdownProps) => {
|
51
42
|
const {
|
52
43
|
aria = {},
|
53
44
|
autocomplete = false,
|
@@ -64,20 +55,15 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
64
55
|
label,
|
65
56
|
onSelect,
|
66
57
|
options,
|
67
|
-
|
68
|
-
triggerRef,
|
69
|
-
variant = "default",
|
58
|
+
triggerRef
|
70
59
|
} = props;
|
71
60
|
|
72
61
|
const ariaProps = buildAriaProps(aria);
|
73
62
|
const dataProps = buildDataProps(data);
|
74
63
|
const htmlProps = buildHtmlProps(htmlOptions);
|
75
|
-
const separatorsClass = separators ? '' : 'separators_hidden'
|
76
64
|
const classes = classnames(
|
77
65
|
buildCss("pb_dropdown"),
|
78
66
|
globalProps(props),
|
79
|
-
variant,
|
80
|
-
separatorsClass,
|
81
67
|
className
|
82
68
|
);
|
83
69
|
|
@@ -139,7 +125,7 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
139
125
|
const filteredOptions = optionsWithBlankSelection?.filter((option: GenericObject) => {
|
140
126
|
const label = typeof option.label === 'string' ? option.label.toLowerCase() : option.label;
|
141
127
|
return String(label).toLowerCase().includes(filterItem.toLowerCase());
|
142
|
-
});
|
128
|
+
});
|
143
129
|
|
144
130
|
// For keyboard accessibility: Set focus within dropdown to selected item if it exists
|
145
131
|
useEffect(() => {
|
@@ -189,14 +175,6 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
189
175
|
dark
|
190
176
|
});
|
191
177
|
|
192
|
-
useImperativeHandle(ref, () => ({
|
193
|
-
clearSelected: () => {
|
194
|
-
setSelected({});
|
195
|
-
setFilterItem("");
|
196
|
-
setIsDropDownClosed(true);
|
197
|
-
onSelect && onSelect(null);
|
198
|
-
},
|
199
|
-
}));
|
200
178
|
|
201
179
|
return (
|
202
180
|
<div {...ariaProps}
|
@@ -280,9 +258,8 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
280
258
|
</DropdownContext.Provider>
|
281
259
|
</div>
|
282
260
|
)
|
283
|
-
}
|
261
|
+
};
|
284
262
|
|
285
|
-
Dropdown.displayName = "Dropdown";
|
286
263
|
Dropdown.Option = DropdownOption;
|
287
264
|
Dropdown.Trigger = DropdownTrigger;
|
288
265
|
Dropdown.Container = DropdownContainer;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- dropdown_default: Default
|
4
|
-
- dropdown_subtle_variant: Subtle Variant
|
5
4
|
- dropdown_subcomponent_structure_rails: Subcomponent Structure
|
6
5
|
- dropdown_with_label: With Label
|
7
6
|
- dropdown_with_custom_options_rails: Custom Options
|
@@ -11,11 +10,9 @@ examples:
|
|
11
10
|
- dropdown_error: Dropdown with Error
|
12
11
|
- dropdown_default_value: Default Value
|
13
12
|
- dropdown_blank_selection: Blank Selection
|
14
|
-
- dropdown_separators_hidden: Separators Hidden
|
15
13
|
|
16
14
|
react:
|
17
15
|
- dropdown_default: Default
|
18
|
-
- dropdown_subtle_variant: Subtle Variant
|
19
16
|
- dropdown_subcomponent_structure: Subcomponent Structure
|
20
17
|
- dropdown_with_label: With Label
|
21
18
|
- dropdown_with_custom_options: Custom Options
|
@@ -25,8 +22,6 @@ examples:
|
|
25
22
|
- dropdown_error: Dropdown with Error
|
26
23
|
- dropdown_default_value: Default Value
|
27
24
|
- dropdown_blank_selection: Blank Selection
|
28
|
-
- dropdown_clear_selection: Clear Selection
|
29
|
-
- dropdown_separators_hidden: Separators Hidden
|
30
25
|
# - dropdown_with_autocomplete: Autocomplete
|
31
26
|
# - dropdown_with_autocomplete_and_custom_display: Autocomplete with Custom Display
|
32
27
|
# - dropdown_with_external_control: useDropdown Hook
|
@@ -12,6 +12,3 @@ export { default as DropdownSubcomponentStructure } from './_dropdown_subcompone
|
|
12
12
|
export { default as DropdownError } from './_dropdown_error.jsx'
|
13
13
|
export { default as DropdownDefaultValue } from './_dropdown_default_value.jsx'
|
14
14
|
export { default as DropdownBlankSelection } from './_dropdown_blank_selection.jsx'
|
15
|
-
export { default as DropdownClearSelection } from './_dropdown_clear_selection.jsx'
|
16
|
-
export { default as DropdownSubtleVariant } from './_dropdown_subtle_variant.jsx'
|
17
|
-
export { default as DropdownSeparatorsHidden } from './_dropdown_separators_hidden.jsx'
|
@@ -13,18 +13,13 @@ module Playbook
|
|
13
13
|
prop :default_value
|
14
14
|
prop :blank_selection, type: Playbook::Props::String,
|
15
15
|
default: ""
|
16
|
-
prop :variant, type: Playbook::Props::Enum,
|
17
|
-
values: %w[default subtle],
|
18
|
-
default: "default"
|
19
|
-
prop :separators, type: Playbook::Props::Boolean,
|
20
|
-
default: true
|
21
16
|
|
22
17
|
def data
|
23
18
|
Hash(prop(:data)).merge(pb_dropdown: true)
|
24
19
|
end
|
25
20
|
|
26
21
|
def classname
|
27
|
-
generate_classname("pb_dropdown"
|
22
|
+
generate_classname("pb_dropdown")
|
28
23
|
end
|
29
24
|
|
30
25
|
private
|
@@ -37,10 +32,6 @@ module Playbook
|
|
37
32
|
default_value.present? ? default_value.transform_keys(&:to_s)["id"] : ""
|
38
33
|
end
|
39
34
|
|
40
|
-
def separators_class
|
41
|
-
separators ? "" : "separators_hidden"
|
42
|
-
end
|
43
|
-
|
44
35
|
def options_with_blank
|
45
36
|
blank_selection.present? ? [{ id: "", value: "", label: blank_selection }] + options : options
|
46
37
|
end
|
@@ -73,7 +73,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
73
73
|
!autocomplete && "select_only"
|
74
74
|
);
|
75
75
|
|
76
|
-
const customDisplayPlaceholder = selected
|
76
|
+
const customDisplayPlaceholder = selected.label ? (
|
77
77
|
<b>{selected.label}</b>
|
78
78
|
) : autocomplete ? (
|
79
79
|
""
|
@@ -83,7 +83,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
83
83
|
"Select..."
|
84
84
|
);
|
85
85
|
|
86
|
-
const defaultDisplayPlaceholder = selected
|
86
|
+
const defaultDisplayPlaceholder = selected.label
|
87
87
|
? selected.label
|
88
88
|
: autocomplete
|
89
89
|
? ""
|
@@ -34,7 +34,6 @@ const FilterDouble = ({
|
|
34
34
|
maxHeight,
|
35
35
|
minWidth,
|
36
36
|
placement,
|
37
|
-
popoverProps,
|
38
37
|
...bgProps
|
39
38
|
}: FilterDoubleProps): React.ReactElement => (
|
40
39
|
<FilterBackground
|
@@ -50,7 +49,6 @@ const FilterDouble = ({
|
|
50
49
|
maxHeight={maxHeight}
|
51
50
|
minWidth={minWidth}
|
52
51
|
placement={placement}
|
53
|
-
popoverProps={popoverProps}
|
54
52
|
>
|
55
53
|
{children}
|
56
54
|
</FiltersPopover>
|
@@ -33,7 +33,6 @@ const FilterSingle = ({
|
|
33
33
|
maxHeight,
|
34
34
|
minWidth,
|
35
35
|
placement,
|
36
|
-
popoverProps,
|
37
36
|
...bgProps
|
38
37
|
}: FilterSingleProps): React.ReactElement => {
|
39
38
|
return (
|
@@ -53,7 +52,6 @@ const FilterSingle = ({
|
|
53
52
|
maxHeight={maxHeight}
|
54
53
|
minWidth={minWidth}
|
55
54
|
placement={placement}
|
56
|
-
popoverProps={popoverProps}
|
57
55
|
>
|
58
56
|
{children}
|
59
57
|
</FiltersPopover>
|
@@ -2,7 +2,6 @@ import React, { ReactNode, useState } from 'react'
|
|
2
2
|
|
3
3
|
import CircleIconButton from '../../pb_circle_icon_button/_circle_icon_button'
|
4
4
|
import PbReactPopover from '../../pb_popover/_popover'
|
5
|
-
import { GenericObject } from '../../types'
|
6
5
|
|
7
6
|
type FiltersPopoverProps = {
|
8
7
|
children?: React.ReactChild[] | React.ReactChild | (({closePopover}: {closePopover: () => void}) => ReactNode),
|
@@ -10,9 +9,8 @@ type FiltersPopoverProps = {
|
|
10
9
|
maxHeight?: string,
|
11
10
|
minWidth?: string,
|
12
11
|
placement?: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end",
|
13
|
-
popoverProps?: GenericObject,
|
14
12
|
}
|
15
|
-
const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bottom-start"
|
13
|
+
const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bottom-start" }: FiltersPopoverProps): React.ReactElement => {
|
16
14
|
const [hide, updateHide] = useState(true)
|
17
15
|
const toggle = () => updateHide(!hide)
|
18
16
|
|
@@ -35,7 +33,6 @@ const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bott
|
|
35
33
|
reference={filterButton}
|
36
34
|
shouldClosePopover={updateHide}
|
37
35
|
show={!hide}
|
38
|
-
{...popoverProps}
|
39
36
|
>
|
40
37
|
<div className="pb-form">
|
41
38
|
{typeof children === 'function'
|