playbook_ui 11.11.0.pre.alpha.renderer1 → 11.12.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/index.js +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +21 -1
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +17 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.html.erb +62 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +86 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.md +17 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +6 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +4 -4
- data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +18 -17
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +15 -0
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +16 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.html.erb +86 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +114 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +17 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +50 -50
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_time.jsx +1 -0
- data/app/pb_kits/playbook/pb_date_picker/plugins/timeSelect.ts +89 -89
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_time_selection_styles.scss +15 -0
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +6 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +7 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +16 -11
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.md +3 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.md +3 -0
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +3 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +8 -1
- data/app/pb_kits/playbook/pb_icon/icon.test.js +155 -0
- data/app/pb_kits/playbook/pb_legend/{_legend.jsx → _legend.tsx} +6 -6
- data/app/pb_kits/playbook/pb_legend/legend.test.js +29 -0
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +20 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.html.erb +62 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.jsx +83 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.md +17 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +17 -1
- data/app/pb_kits/playbook/pb_radio/_radio.scss +1 -1
- data/app/pb_kits/playbook/pb_title/_title.scss +5 -0
- data/app/pb_kits/playbook/pb_title/_title.tsx +4 -1
- data/app/pb_kits/playbook/pb_title/docs/{_title_light.html.erb → _title_default.html.erb} +3 -3
- data/app/pb_kits/playbook/pb_title/docs/{_title_light.jsx → _title_default.jsx} +14 -14
- data/app/pb_kits/playbook/pb_title/docs/{_title_light.md → _title_default.md} +0 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.html.erb +1 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.jsx +19 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.md +4 -0
- data/app/pb_kits/playbook/pb_title/docs/example.yml +4 -2
- data/app/pb_kits/playbook/pb_title/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_title/title.rb +6 -1
- data/app/pb_kits/playbook/pb_title/title.test.js +13 -0
- data/app/pb_kits/playbook/plugins/pb_chart.js +13 -0
- data/app/pb_kits/playbook/tokens/_titles.scss +10 -1
- data/app/pb_kits/playbook/tokens/_typography.scss +2 -2
- data/lib/playbook/version.rb +1 -1
- metadata +22 -8
@@ -0,0 +1,114 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import CircleChart from '../_circle_chart'
|
4
|
+
|
5
|
+
import {Title} from '../..'
|
6
|
+
|
7
|
+
const data = [
|
8
|
+
{
|
9
|
+
name: 'Waiting for Calls',
|
10
|
+
value: 41,
|
11
|
+
},
|
12
|
+
{
|
13
|
+
name: 'On Call',
|
14
|
+
value: 49,
|
15
|
+
},
|
16
|
+
{
|
17
|
+
name: 'After call',
|
18
|
+
value: 10,
|
19
|
+
},
|
20
|
+
]
|
21
|
+
|
22
|
+
const dataFirst = [{
|
23
|
+
name: 'Bugs',
|
24
|
+
value: 8,
|
25
|
+
|
26
|
+
},
|
27
|
+
{
|
28
|
+
name: 'Chores',
|
29
|
+
value: 1,
|
30
|
+
|
31
|
+
},
|
32
|
+
{
|
33
|
+
name: 'Stories',
|
34
|
+
value: 12,
|
35
|
+
},
|
36
|
+
]
|
37
|
+
|
38
|
+
const dataSecond = [
|
39
|
+
{
|
40
|
+
name: 'Queued',
|
41
|
+
value: 7,
|
42
|
+
},
|
43
|
+
{
|
44
|
+
name: 'In Progress',
|
45
|
+
value: 6,
|
46
|
+
},
|
47
|
+
{
|
48
|
+
name: 'Validation',
|
49
|
+
value: 3,
|
50
|
+
},
|
51
|
+
{
|
52
|
+
name: 'Done',
|
53
|
+
value: 6,
|
54
|
+
},
|
55
|
+
]
|
56
|
+
|
57
|
+
|
58
|
+
const CircleChartLegendPosition = (props) => (
|
59
|
+
<div>
|
60
|
+
<Title
|
61
|
+
paddingBottom="sm"
|
62
|
+
paddingTop="sm"
|
63
|
+
size={4}
|
64
|
+
tag="h4"
|
65
|
+
text="align | verticalAlign"
|
66
|
+
/>
|
67
|
+
<CircleChart
|
68
|
+
align='right'
|
69
|
+
chartData={data}
|
70
|
+
id="legend-position-circle"
|
71
|
+
legend
|
72
|
+
paddingBottom="sm"
|
73
|
+
title="Alignment of Legend"
|
74
|
+
verticalAlign="top"
|
75
|
+
{...props}
|
76
|
+
/>
|
77
|
+
<Title
|
78
|
+
paddingBottom="sm"
|
79
|
+
paddingTop="sm"
|
80
|
+
size={4}
|
81
|
+
tag="h4"
|
82
|
+
text="layout"
|
83
|
+
/>
|
84
|
+
<CircleChart
|
85
|
+
chartData={dataFirst}
|
86
|
+
id="legend-position-circle-1"
|
87
|
+
layout="vertical"
|
88
|
+
legend
|
89
|
+
paddingBottom="sm"
|
90
|
+
paddingTop="sm"
|
91
|
+
title="Layout of Legend"
|
92
|
+
{...props}
|
93
|
+
/>
|
94
|
+
<Title
|
95
|
+
paddingBottom="sm"
|
96
|
+
paddingTop="sm"
|
97
|
+
size={4}
|
98
|
+
tag="h4"
|
99
|
+
text="x | y"
|
100
|
+
/>
|
101
|
+
<CircleChart
|
102
|
+
chartData={dataSecond}
|
103
|
+
id="legend-position-circle-2"
|
104
|
+
layout="vertical"
|
105
|
+
legend
|
106
|
+
title="Offset of Legend"
|
107
|
+
x={100}
|
108
|
+
y={10}
|
109
|
+
{...props}
|
110
|
+
/>
|
111
|
+
</div>
|
112
|
+
)
|
113
|
+
|
114
|
+
export default CircleChartLegendPosition
|
@@ -0,0 +1,17 @@
|
|
1
|
+
##### Prop
|
2
|
+
|
3
|
+
`align` **Type**: String | **Values**: left | center | right (defaults to center)
|
4
|
+
`verticalAlign` **Type**: String | **Values**: top | middle | bottom (defaults middle)
|
5
|
+
`layout` **Type**: String | **Values**: horizontal | vertical | proximate (defaults to horizontal)
|
6
|
+
`x` **Type**: Number (defaults to 0)
|
7
|
+
`y` **Type**: Number (defaults to 0)
|
8
|
+
|
9
|
+
-
|
10
|
+
|
11
|
+
- `layout` determines the position of the legend items
|
12
|
+
`layout: proximate` will place the legend items as close as possible to the graphs they're representing. It will also determine whether to place the legend above/below or on the side of the plot area, if the legend is in a corner.
|
13
|
+
|
14
|
+
- `x` offsets the legend relative to its horizontal alignmnet. Negative x moves it to the left, positive x moves it to the right
|
15
|
+
|
16
|
+
|
17
|
+
- `y` offsets the legend relative to its vertical alignmnet. Negative y moves it up, positive y moves it down.
|
@@ -7,6 +7,7 @@ examples:
|
|
7
7
|
- circle_chart_colors: Color Overrides
|
8
8
|
- circle_chart_with_labels: Data Labels
|
9
9
|
- circle_chart_with_legend_kit: Legend
|
10
|
+
- circle_chart_legend_position: Legend Position
|
10
11
|
- circle_chart_with_title: Title
|
11
12
|
- circle_chart_inner_sizes: Inner Circle Size Options
|
12
13
|
|
@@ -18,6 +19,7 @@ examples:
|
|
18
19
|
- circle_chart_colors: Color Overrides
|
19
20
|
- circle_chart_with_labels: Data Labels
|
20
21
|
- circle_chart_with_legend_kit: Legend
|
22
|
+
- circle_chart_legend_position: Legend Position
|
21
23
|
- circle_chart_with_title: Title
|
22
24
|
- circle_chart_inner_sizes: Inner Circle Size Options
|
23
25
|
|
@@ -5,5 +5,6 @@ export { default as CircleChartBlock } from './_circle_chart_block.jsx'
|
|
5
5
|
export { default as CircleChartColors } from './_circle_chart_colors.jsx'
|
6
6
|
export { default as CircleChartWithLabels } from './_circle_chart_with_labels.jsx'
|
7
7
|
export { default as CircleChartWithLegendKit } from './_circle_chart_with_legend_kit.jsx'
|
8
|
+
export { default as CircleChartLegendPosition } from './_circle_chart_legend_position.jsx'
|
8
9
|
export { default as CircleChartWithTitle } from './_circle_chart_with_title.jsx'
|
9
10
|
export { default as CircleChartInnerSizes } from './_circle_chart_inner_sizes.jsx'
|
@@ -108,54 +108,54 @@ describe('DatePicker Kit', () => {
|
|
108
108
|
})
|
109
109
|
})
|
110
110
|
|
111
|
-
test('shows DatePicker meridiem toggle', async () => {
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
})
|
111
|
+
// test('shows DatePicker meridiem toggle', async () => {
|
112
|
+
// const testId = 'datepicker-meridiem'
|
113
|
+
// render(
|
114
|
+
// <DatePicker
|
115
|
+
// data={{ testid: testId }}
|
116
|
+
// defaultDate={DEFAULT_DATE}
|
117
|
+
// enableTime
|
118
|
+
// pickerId="date-picker-meridiem"
|
119
|
+
// />
|
120
|
+
// )
|
121
|
+
|
122
|
+
// const kit = screen.getByTestId(testId)
|
123
|
+
// const input = within(kit).getByPlaceholderText('Select Date')
|
124
|
+
|
125
|
+
// fireEvent(
|
126
|
+
// input,
|
127
|
+
// new MouseEvent('click', {
|
128
|
+
// bubbles: true,
|
129
|
+
// cancelable: true,
|
130
|
+
// }),
|
131
|
+
// )
|
132
|
+
// const meridiemToggleAM = within(kit).getByLabelText('AM')
|
133
|
+
// const meridiemTogglePM = within(kit).getByLabelText('PM')
|
134
|
+
// await waitFor(() => {
|
135
|
+
// expect(meridiemToggleAM).toBeInTheDocument()
|
136
|
+
// expect(meridiemTogglePM).toBeInTheDocument()
|
137
|
+
// })
|
138
|
+
|
139
|
+
// fireEvent(
|
140
|
+
// meridiemToggleAM,
|
141
|
+
// new MouseEvent('click', {
|
142
|
+
// bubbles: true,
|
143
|
+
// cancelable: true,
|
144
|
+
// }),
|
145
|
+
// )
|
146
|
+
// await waitFor(() => {
|
147
|
+
// expect(input).toHaveValue('01/01/2020 at 12:00 AM')
|
148
|
+
// })
|
149
|
+
|
150
|
+
// fireEvent(
|
151
|
+
// meridiemTogglePM,
|
152
|
+
// new MouseEvent('click', {
|
153
|
+
// bubbles: true,
|
154
|
+
// cancelable: true,
|
155
|
+
// }),
|
156
|
+
// )
|
157
|
+
// await waitFor(() => {
|
158
|
+
// expect(input).toHaveValue('01/01/2020 at 12:00 PM')
|
159
|
+
// })
|
160
|
+
// })
|
161
161
|
})
|
@@ -41,96 +41,96 @@ export const getTimezoneText = (inputDate: {
|
|
41
41
|
|
42
42
|
function timeSelectPlugin(props: { caption: string; showTimezone: boolean }) {
|
43
43
|
return function (fp: FpTypes) {
|
44
|
-
const generateMeridiemCard = (text: string) => {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
};
|
69
|
-
|
70
|
-
const generateMeridiemToggle = () => {
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
};
|
99
|
-
|
100
|
-
const getMeridiem = (dateObj: string | any[]) => {
|
101
|
-
|
102
|
-
};
|
103
|
-
|
104
|
-
const updateMeridiemToggle = (forceClick: boolean) => {
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
};
|
44
|
+
// const generateMeridiemCard = (text: string) => {
|
45
|
+
// const selectableCard = document.createElement("div");
|
46
|
+
// selectableCard.className = "pb_selectable_card_kit_enabled";
|
47
|
+
|
48
|
+
// const cardInput = document.createElement("input"),
|
49
|
+
// cardInputId = `datePicker${text}`;
|
50
|
+
|
51
|
+
// cardInput.id = cardInputId;
|
52
|
+
// cardInput.name = "datepicker-ampm";
|
53
|
+
// cardInput.type = "radio";
|
54
|
+
// cardInput.value = text;
|
55
|
+
|
56
|
+
// const cardLabel = document.createElement("label"),
|
57
|
+
// cardLabelBuffer = document.createElement("div");
|
58
|
+
// cardLabel.className = `label-${text.toLowerCase()}`;
|
59
|
+
// cardLabel.setAttribute("for", cardInputId);
|
60
|
+
// cardLabelBuffer.className = "buffer";
|
61
|
+
// cardLabelBuffer.innerHTML = text;
|
62
|
+
|
63
|
+
// cardLabel.append(cardLabelBuffer);
|
64
|
+
// selectableCard.prepend(cardInput);
|
65
|
+
// selectableCard.append(cardLabel);
|
66
|
+
|
67
|
+
// return selectableCard;
|
68
|
+
// };
|
69
|
+
|
70
|
+
// const generateMeridiemToggle = () => {
|
71
|
+
// fp.amPM.style.display = "none";
|
72
|
+
// const formGroupKit = document.createElement("div");
|
73
|
+
// formGroupKit.className = "pb_form_group_kit";
|
74
|
+
|
75
|
+
// const amCard = generateMeridiemCard("AM");
|
76
|
+
// amCard.addEventListener("click", () => {
|
77
|
+
// fp.selectedDates[0].setHours(
|
78
|
+
// (fp.selectedDates[0].getHours() % 12) + 12 * 0
|
79
|
+
// );
|
80
|
+
// fp.setDate(fp.selectedDates[0], true);
|
81
|
+
// });
|
82
|
+
|
83
|
+
// const pmCard = generateMeridiemCard("PM");
|
84
|
+
// pmCard.addEventListener("click", () => {
|
85
|
+
// fp.selectedDates[0].setHours(
|
86
|
+
// (fp.selectedDates[0].getHours() % 12) + 12 * 1
|
87
|
+
// );
|
88
|
+
// fp.setDate(fp.selectedDates[0], true);
|
89
|
+
// });
|
90
|
+
|
91
|
+
// formGroupKit.prepend(amCard);
|
92
|
+
// formGroupKit.append(pmCard);
|
93
|
+
|
94
|
+
// const meridiemContainer = document.createElement("div");
|
95
|
+
// meridiemContainer.className = "meridiem";
|
96
|
+
// meridiemContainer.append(formGroupKit);
|
97
|
+
// document.querySelector(".pb_time_selection").append(meridiemContainer);
|
98
|
+
// };
|
99
|
+
|
100
|
+
// const getMeridiem = (dateObj: string | any[]) => {
|
101
|
+
// return dateObj[0].getHours() < 12 ? "AM" : "PM";
|
102
|
+
// };
|
103
|
+
|
104
|
+
// const updateMeridiemToggle = (forceClick: boolean) => {
|
105
|
+
// if (!fp.selectedDates.length) return;
|
106
|
+
|
107
|
+
// const uncheckedClass = "pb_selectable_card_kit_enabled",
|
108
|
+
// checkedClass = "pb_selectable_card_kit_checked_enabled",
|
109
|
+
// pickerAM: HTMLElement & { [x: string]: any } =
|
110
|
+
// document.getElementById("datePickerAM"),
|
111
|
+
// pickerPM: HTMLElement & { [x: string]: any } =
|
112
|
+
// document.getElementById("datePickerPM"),
|
113
|
+
// meridiem = getMeridiem(fp.selectedDates);
|
114
|
+
|
115
|
+
// if (forceClick) {
|
116
|
+
// pickerAM.checked = false;
|
117
|
+
// pickerPM.checked = false;
|
118
|
+
// pickerPM.checked = meridiem === "PM";
|
119
|
+
// pickerAM.checked = meridiem === "AM";
|
120
|
+
// }
|
121
|
+
|
122
|
+
// if (meridiem === "PM") {
|
123
|
+
// pickerPM.parentElement.className = checkedClass;
|
124
|
+
// pickerAM.parentElement.className = uncheckedClass;
|
125
|
+
// } else if (meridiem === "AM") {
|
126
|
+
// pickerAM.parentElement.className = checkedClass;
|
127
|
+
// pickerPM.parentElement.className = uncheckedClass;
|
128
|
+
// }
|
129
|
+
// };
|
130
130
|
|
131
131
|
return {
|
132
132
|
onValueUpdate() {
|
133
|
-
updateMeridiemToggle(true);
|
133
|
+
// updateMeridiemToggle(true);
|
134
134
|
},
|
135
135
|
onReady() {
|
136
136
|
const id = fp.input.id;
|
@@ -151,8 +151,8 @@ function timeSelectPlugin(props: { caption: string; showTimezone: boolean }) {
|
|
151
151
|
}
|
152
152
|
|
153
153
|
// add meridiem toggle
|
154
|
-
generateMeridiemToggle();
|
155
|
-
updateMeridiemToggle(true);
|
154
|
+
// generateMeridiemToggle();
|
155
|
+
// updateMeridiemToggle(true);
|
156
156
|
|
157
157
|
// add timezone text
|
158
158
|
if (props.showTimezone) {
|
@@ -7,6 +7,21 @@
|
|
7
7
|
color: inherit;
|
8
8
|
text-align: left;
|
9
9
|
margin-left: $space_sm;
|
10
|
+
|
11
|
+
span.flatpickr-am-pm {
|
12
|
+
margin-left: $space_sm;
|
13
|
+
border-radius: 5px;
|
14
|
+
color: $primary;
|
15
|
+
&:hover{
|
16
|
+
background-color: rgba($primary, 0.03);
|
17
|
+
}
|
18
|
+
&:focus{
|
19
|
+
background-color: unset;
|
20
|
+
&:hover{
|
21
|
+
background-color: rgba($primary, 0.03);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
10
25
|
.numInputWrapper {
|
11
26
|
width: auto;
|
12
27
|
input.numInput {
|
@@ -80,7 +80,6 @@
|
|
80
80
|
animation-duration: $animation-duration;
|
81
81
|
outline: none;
|
82
82
|
animation-timing-function: $easeInOutQuint;
|
83
|
-
margin: auto;
|
84
83
|
|
85
84
|
&[class*="_status_size"] {
|
86
85
|
width: $status_size;
|
@@ -178,6 +177,12 @@
|
|
178
177
|
}
|
179
178
|
|
180
179
|
.pb_dialog_wrapper_rails {
|
180
|
+
.pb_dialog_rails {
|
181
|
+
top: 0 !important;
|
182
|
+
padding: unset !important;
|
183
|
+
margin: auto;
|
184
|
+
|
185
|
+
}
|
181
186
|
dialog::backdrop {
|
182
187
|
position: fixed;
|
183
188
|
top: 0;
|
@@ -1,16 +1,21 @@
|
|
1
|
-
|
2
|
-
const openTrigger = document.querySelectorAll(
|
3
|
-
const closeTrigger = document.querySelectorAll(
|
1
|
+
const dialogHelper = () => {
|
2
|
+
const openTrigger = document.querySelectorAll("[data-open-dialog]");
|
3
|
+
const closeTrigger = document.querySelectorAll("[data-close-dialog]");
|
4
|
+
|
4
5
|
openTrigger.forEach((open) => {
|
5
6
|
open.addEventListener("click", () => {
|
6
|
-
var openTriggerData = open.dataset.openDialog
|
7
|
-
document.getElementById(openTriggerData).
|
7
|
+
var openTriggerData = open.dataset.openDialog;
|
8
|
+
if (document.getElementById(openTriggerData).open) return;
|
9
|
+
document.getElementById(openTriggerData).showModal();
|
8
10
|
});
|
9
|
-
})
|
11
|
+
});
|
12
|
+
|
10
13
|
closeTrigger.forEach((close) => {
|
11
14
|
close.addEventListener("click", () => {
|
12
|
-
var closeTriggerData = close.dataset.closeDialog
|
13
|
-
document.getElementById(closeTriggerData).close()
|
14
|
-
})
|
15
|
-
})
|
16
|
-
}
|
15
|
+
var closeTriggerData = close.dataset.closeDialog;
|
16
|
+
document.getElementById(closeTriggerData).close();
|
17
|
+
});
|
18
|
+
});
|
19
|
+
};
|
20
|
+
|
21
|
+
export default dialogHelper;
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= pb_rails("button", props: { type: "submit", id: object.confirm_button_id }) do %>
|
7
7
|
<%= object.confirm_button %>
|
8
8
|
<% end %>
|
9
|
-
<%= pb_rails("button", props: { data: {"close-dialog": "#{object.id}" }, id: object.cancel_button_id}) do %>
|
9
|
+
<%= pb_rails("button", props: { data: {"close-dialog": "#{object.id}" }, id: object.cancel_button_id, variant: "link"}) do %>
|
10
10
|
<%= object.cancel_button %>
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
id: object.id,
|
3
3
|
data: object.data,
|
4
4
|
aria: object.aria) do %>
|
5
|
-
<%= pb_rails("flex", props: {classname:object.classname, spacing:"between", padding:"sm"}) do %>
|
5
|
+
<%= pb_rails("flex", props: {classname:object.classname, spacing:"between", padding:"sm", align:"center"}) do %>
|
6
6
|
<%= content.presence || object.title %>
|
7
7
|
|
8
8
|
<button class="dialog-button-class" data-close-dialog= <%= object.id %> >
|
@@ -1,2 +1,4 @@
|
|
1
1
|
The dialog kit also supports customizing your dialog with a [compound component](https://kentcdodds.com/blog/compound-components-with-react-hooks) structure.
|
2
|
-
This allows for greater flexibility and more complex dialogs.
|
2
|
+
This allows for greater flexibility and more complex dialogs.
|
3
|
+
|
4
|
+
For the Rails version, when using the kit as a compound component it is necessary to pass the same value as the id for the dialog, the dialog header and the dialog footer in order for the opening and closing of the dialog to function as expected.
|
@@ -0,0 +1,3 @@
|
|
1
|
+
For the Rails version of the dialog kit, the clickable element being used to open the dialog must be given a `open-dialog` data attribute with a value that is the same as the id being given to the dialog itself. See code example below to see this in action.
|
2
|
+
|
3
|
+
Additionally, both the cancel button and the confirm button have optional id props which can be used to pass in a custom id to allow developers to target that button with custom javascript if needed (`confirm_button_id` and `cancel_button_id`).
|
@@ -34,6 +34,7 @@ type IconProps = {
|
|
34
34
|
pulse?: boolean,
|
35
35
|
rotation?: 90 | 180 | 270,
|
36
36
|
size?: IconSizes,
|
37
|
+
fontStyle?: 'far' | 'fas' | 'fab',
|
37
38
|
spin?: boolean,
|
38
39
|
} & GlobalProps
|
39
40
|
|
@@ -61,6 +62,7 @@ const Icon = (props: IconProps) => {
|
|
61
62
|
pulse = false,
|
62
63
|
rotation,
|
63
64
|
size,
|
65
|
+
fontStyle = 'far',
|
64
66
|
spin = false,
|
65
67
|
} = props
|
66
68
|
|
@@ -85,7 +87,7 @@ const Icon = (props: IconProps) => {
|
|
85
87
|
const classes = classnames(
|
86
88
|
flipMap[flip],
|
87
89
|
'pb_icon_kit',
|
88
|
-
customIcon ? '' :
|
90
|
+
customIcon ? '' : fontStyle,
|
89
91
|
faClasses,
|
90
92
|
globalProps(props),
|
91
93
|
className
|
@@ -32,13 +32,16 @@ module Playbook
|
|
32
32
|
prop :size, type: Playbook::Props::Enum,
|
33
33
|
values: ["lg", "xs", "sm", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x", nil],
|
34
34
|
default: nil
|
35
|
+
prop :font_style, type: Playbook::Props::Enum,
|
36
|
+
values: %w[far fas fab],
|
37
|
+
default: "far"
|
35
38
|
prop :spin, type: Playbook::Props::Boolean,
|
36
39
|
default: false
|
37
40
|
|
38
41
|
def classname
|
39
42
|
generate_classname(
|
40
43
|
"pb_icon_kit",
|
41
|
-
|
44
|
+
font_style_class,
|
42
45
|
icon_class,
|
43
46
|
border_class,
|
44
47
|
fixed_width_class,
|
@@ -131,6 +134,10 @@ module Playbook
|
|
131
134
|
size ? "fa-#{size}" : nil
|
132
135
|
end
|
133
136
|
|
137
|
+
def font_style_class
|
138
|
+
font_style ? font_style.to_s : "far"
|
139
|
+
end
|
140
|
+
|
134
141
|
def spin_class
|
135
142
|
spin ? "fa-spin" : nil
|
136
143
|
end
|