playbook_ui 13.28.0 → 13.29.0.pre.alpha.PBNTR329draggablev33059
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/_playbook.scss +2 -3
- data/app/pb_kits/playbook/index.js +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +40 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +14 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +10 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +34 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +31 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +4 -1
- data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +31 -0
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +16 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +2 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/{_bar_graph_custom.html.erb → _bar_graph_custom_rails.html.erb} +3 -3
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.md +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_card/_card.scss +5 -0
- data/app/pb_kits/playbook/pb_card/_card.tsx +56 -9
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +1 -2
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +9 -3
- data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +45 -0
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +24 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +53 -0
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +14 -8
- data/app/pb_kits/playbook/pb_collapsible/collapsible.test.js +24 -0
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +7 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +9 -1
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +13 -0
- data/app/pb_kits/playbook/pb_draggable/_draggable.tsx +53 -0
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +92 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +53 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +4 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +158 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +101 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx +50 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx +51 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +11 -0
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +63 -0
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +54 -0
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +57 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +10 -0
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -2
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +4 -1
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +6 -1
- data/app/pb_kits/playbook/pb_gauge/gauge.test.js +35 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +3 -2
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +8 -2
- data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +52 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +22 -1
- data/app/pb_kits/playbook/pb_list/_list.tsx +43 -2
- data/app/pb_kits/playbook/pb_list/_list_item.tsx +46 -10
- data/app/pb_kits/playbook/pb_pill/docs/_description.md +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -0
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +30 -32
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +0 -2
- data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +35 -28
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +5 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +5 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.jsx +33 -32
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.jsx +33 -33
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.jsx +51 -50
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.html.erb +54 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.jsx +37 -38
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.html.erb +53 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/{_table_alignment_row.html.erb → _table_outer_padding.html.erb} +7 -7
- data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.jsx +76 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +9 -9
- 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/_outer_padding.scss +21 -0
- data/app/pb_kits/playbook/pb_table/table.rb +14 -1
- data/app/pb_kits/playbook/pb_table/table.test.js +5 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +12 -9
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +61 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +6 -1
- data/app/pb_kits/playbook/playbook-doc.js +2 -0
- data/app/pb_kits/playbook/tokens/_vertical_align.scss +18 -0
- data/app/pb_kits/playbook/utilities/_vertical_align.scss +16 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +12 -1
- data/dist/menu.yml +5 -2
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/classnames.rb +1 -0
- data/lib/playbook/forms/builder/dropdown_field.rb +14 -0
- data/lib/playbook/forms/builder.rb +1 -0
- data/lib/playbook/kit_base.rb +2 -0
- data/lib/playbook/version.rb +2 -2
- data/lib/playbook/vertical_align.rb +37 -0
- metadata +49 -10
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.html.erb +0 -63
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.html.erb +0 -52
- /data/app/pb_kits/playbook/pb_table/docs/{_table_alignment_column.html.erb → _table_alignment_column_rails.html.erb} +0 -0
@@ -10,6 +10,7 @@ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
|
10
10
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
11
11
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
12
12
|
import treemap from 'highcharts/modules/treemap'
|
13
|
+
import { merge } from 'lodash'
|
13
14
|
|
14
15
|
type TreemapChartProps = {
|
15
16
|
chartData: {
|
@@ -21,6 +22,7 @@ type TreemapChartProps = {
|
|
21
22
|
}[];
|
22
23
|
className?: string;
|
23
24
|
colors: string[];
|
25
|
+
customOptions?: Partial<Highcharts.Options>;
|
24
26
|
dark?: boolean;
|
25
27
|
drillable: boolean;
|
26
28
|
grouped: boolean;
|
@@ -39,6 +41,7 @@ const TreemapChart = ({
|
|
39
41
|
data = {},
|
40
42
|
chartData,
|
41
43
|
colors,
|
44
|
+
customOptions = {},
|
42
45
|
dark = false,
|
43
46
|
drillable = false,
|
44
47
|
grouped = false,
|
@@ -96,20 +99,20 @@ const TreemapChart = ({
|
|
96
99
|
|
97
100
|
useEffect(() => {
|
98
101
|
|
99
|
-
setOptions(
|
102
|
+
setOptions(merge(staticOptions, customOptions));
|
100
103
|
}, [chartData]);
|
101
104
|
|
102
105
|
return (
|
103
106
|
<HighchartsReact
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
107
|
+
containerProps={{
|
108
|
+
className: classnames(globalProps(props), "pb_treemap_chart"),
|
109
|
+
id: id,
|
110
|
+
...ariaProps,
|
111
|
+
...dataProps,
|
112
|
+
...htmlProps
|
110
113
|
}}
|
111
|
-
|
112
|
-
|
114
|
+
highcharts={Highcharts}
|
115
|
+
options={options}
|
113
116
|
/>
|
114
117
|
);
|
115
118
|
};
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '../utilities/test-utils';
|
3
|
+
import TreemapChart from './_treemap_chart';
|
4
|
+
|
5
|
+
beforeEach(() => {
|
6
|
+
// Silences error logs within the test suite.
|
7
|
+
jest.spyOn(console, 'error');
|
8
|
+
jest.spyOn(console, 'warn');
|
9
|
+
console.error.mockImplementation(() => {});
|
10
|
+
console.warn.mockImplementation(() => {});
|
11
|
+
});
|
12
|
+
|
13
|
+
afterEach(() => {
|
14
|
+
console.error.mockRestore();
|
15
|
+
console.warn.mockRestore();
|
16
|
+
});
|
17
|
+
|
18
|
+
const testId = 'treemapchart1';
|
19
|
+
|
20
|
+
test('uses exact classname', () => {
|
21
|
+
const data = [
|
22
|
+
{
|
23
|
+
name: "Pepperoni",
|
24
|
+
parent: "Toppings",
|
25
|
+
value: 600,
|
26
|
+
}, {
|
27
|
+
name: "Cheese",
|
28
|
+
parent: "Toppings",
|
29
|
+
value: 510,
|
30
|
+
}, {
|
31
|
+
name: "Mushroom",
|
32
|
+
parent: "Toppings",
|
33
|
+
value: 330,
|
34
|
+
},{
|
35
|
+
name: "Onions",
|
36
|
+
parent: "Toppings",
|
37
|
+
value: 250,
|
38
|
+
}, {
|
39
|
+
name: "Olives",
|
40
|
+
parent: "Toppings",
|
41
|
+
value: 204,
|
42
|
+
}, {
|
43
|
+
name: "Pineapple",
|
44
|
+
parent: "Toppings",
|
45
|
+
value: 90,
|
46
|
+
}, {
|
47
|
+
name: "Pizza Toppings",
|
48
|
+
id: "Toppings",
|
49
|
+
},
|
50
|
+
]
|
51
|
+
render(
|
52
|
+
<TreemapChart
|
53
|
+
chartData={data}
|
54
|
+
data={{ testid: testId }}
|
55
|
+
id="tree-map-id"
|
56
|
+
/>
|
57
|
+
);
|
58
|
+
|
59
|
+
const kit = screen.getByTestId(testId);
|
60
|
+
expect(kit).toHaveClass('pb_treemap_chart');
|
61
|
+
});
|
@@ -7,6 +7,7 @@ module Playbook
|
|
7
7
|
default: []
|
8
8
|
prop :colors, type: Playbook::Props::Array,
|
9
9
|
default: []
|
10
|
+
prop :custom_options, default: {}
|
10
11
|
prop :drillable, type: Playbook::Props::Boolean, default: false
|
11
12
|
prop :grouped, type: Playbook::Props::Boolean, default: false
|
12
13
|
prop :height
|
@@ -19,7 +20,7 @@ module Playbook
|
|
19
20
|
"treemap"
|
20
21
|
end
|
21
22
|
|
22
|
-
def
|
23
|
+
def standard_options
|
23
24
|
{
|
24
25
|
chartData: chart_data,
|
25
26
|
className: classname,
|
@@ -35,6 +36,10 @@ module Playbook
|
|
35
36
|
}
|
36
37
|
end
|
37
38
|
|
39
|
+
def chart_options
|
40
|
+
standard_options.deep_merge(custom_options)
|
41
|
+
end
|
42
|
+
|
38
43
|
def classname
|
39
44
|
generate_classname("pb_treemap_chart")
|
40
45
|
end
|
@@ -34,6 +34,7 @@ import * as DateYearStacked from 'pb_date_year_stacked/docs'
|
|
34
34
|
import * as Detail from 'pb_detail/docs'
|
35
35
|
import * as Dialog from 'pb_dialog/docs'
|
36
36
|
import * as DistributionBarDocs from 'pb_distribution_bar/docs'
|
37
|
+
import * as Draggable from 'pb_draggable/docs'
|
37
38
|
import * as Dropdown from 'pb_dropdown/docs'
|
38
39
|
import * as FileUpload from 'pb_file_upload/docs'
|
39
40
|
import * as Filter from 'pb_filter/docs'
|
@@ -137,6 +138,7 @@ WebpackerReact.registerComponents({
|
|
137
138
|
...Detail,
|
138
139
|
...Dialog,
|
139
140
|
...DistributionBarDocs,
|
141
|
+
...Draggable,
|
140
142
|
...Dropdown,
|
141
143
|
...FileUpload,
|
142
144
|
...Filter,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
$vertical_align_baseline: baseline !default;
|
2
|
+
$vertical_align_sub: sub !default;
|
3
|
+
$vertical_align_super: super !default;
|
4
|
+
$vertical_align_text_top: text-top !default;
|
5
|
+
$vertical_align_text_bottom: text-bottom !default;
|
6
|
+
$vertical_align_middle: middle !default;
|
7
|
+
$vertical_align_top: top !default;
|
8
|
+
$vertical_align_bottom: bottom !default;
|
9
|
+
$vertical_align: (
|
10
|
+
baseline: $vertical_align_baseline,
|
11
|
+
sub: $vertical_align_sub,
|
12
|
+
super: $vertical_align_super,
|
13
|
+
text_top: $vertical_align_text_top,
|
14
|
+
text_bottom: $vertical_align_text_bottom,
|
15
|
+
middle: $vertical_align_middle,
|
16
|
+
top: $vertical_align_top,
|
17
|
+
bottom: $vertical_align_bottom
|
18
|
+
);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
@import "../tokens/vertical_align";
|
2
|
+
|
3
|
+
|
4
|
+
$vertical_align_classes: (
|
5
|
+
vertical_align_baseline: $vertical_align_baseline,
|
6
|
+
vertical_align_sub: $vertical_align_sub,
|
7
|
+
vertical_align_super: $vertical_align_super,
|
8
|
+
vertical_align_text_top: $vertical_align_text_top,
|
9
|
+
vertical_align_text_bottom: $vertical_align_text_bottom,
|
10
|
+
vertical_align_middle: $vertical_align_middle,
|
11
|
+
vertical_align_top: $vertical_align_top,
|
12
|
+
vertical_align_bottom: $vertical_align_bottom,
|
13
|
+
);
|
14
|
+
|
15
|
+
|
16
|
+
@include global_props_responsive_css($vertical_align, 'vertical_align', 'vertical-align');
|
@@ -156,6 +156,10 @@ type Truncate = {
|
|
156
156
|
truncate?: TruncateType
|
157
157
|
}
|
158
158
|
|
159
|
+
type VerticalAlign = {
|
160
|
+
verticalAlign?: "baseline" | "super" | "top" | "middle" | "bottom" | "sub" | "text-top" | "text-bottom"
|
161
|
+
}
|
162
|
+
|
159
163
|
type ZIndexType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|
160
164
|
type ZIndexResponsiveType = {[key: string]: ZIndexType}
|
161
165
|
type ZIndex = {
|
@@ -167,7 +171,7 @@ export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
|
167
171
|
BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
|
168
172
|
FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
|
169
173
|
LineHeight & Margin & MaxWidth & NumberSpacing & Order & Overflow & Padding &
|
170
|
-
Position & Shadow & TextAlign & Truncate & ZIndex & { hover?: string } & Top & Right & Bottom & Left;
|
174
|
+
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left;
|
171
175
|
|
172
176
|
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
173
177
|
const keys: string[] = Object.keys(prop)
|
@@ -470,6 +474,13 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
470
474
|
} else {
|
471
475
|
return textAlign ? `text_align_${textAlign} ` : ''
|
472
476
|
}
|
477
|
+
},
|
478
|
+
verticalAlignProps: ({ verticalAlign }: VerticalAlign) => {
|
479
|
+
if (typeof verticalAlign === 'object') {
|
480
|
+
return getResponsivePropClasses(verticalAlign, 'vertical_align')
|
481
|
+
} else {
|
482
|
+
return verticalAlign ? `vertical_align_${verticalAlign} ` : ''
|
483
|
+
}
|
473
484
|
}
|
474
485
|
}
|
475
486
|
|
data/dist/menu.yml
CHANGED
@@ -352,6 +352,10 @@ kits:
|
|
352
352
|
platforms: *web
|
353
353
|
description:
|
354
354
|
status: "stable"
|
355
|
+
- name: "draggable"
|
356
|
+
platforms: *react_only
|
357
|
+
description:
|
358
|
+
status: "beta"
|
355
359
|
- name: message_text_patterns
|
356
360
|
description:
|
357
361
|
components:
|
@@ -463,5 +467,4 @@ kits:
|
|
463
467
|
status: "stable"
|
464
468
|
- name: "user"
|
465
469
|
platforms: *web
|
466
|
-
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.
|
467
|
-
status: "stable"
|
470
|
+
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.
|