playbook_ui 14.18.0.pre.alpha.play2034zonesandcolors7407 → 14.18.0.pre.alpha.revert4567revert4553PLAY2056ATcolbordercolors7469
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/_advanced_table.scss +304 -21
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +6 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.jsx +80 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +58 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +12 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +12 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +50 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.md +4 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.md +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.md +5 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.jsx +34 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern.md +14 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.html.erb +20 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range_pattern_rails.md +14 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +10 -0
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.html.erb +41 -0
- data/app/pb_kits/playbook/pb_filter/docs/_filter_within_turbo_frames.md +1 -0
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +52 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +110 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +13 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +3 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.html.erb +10 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.jsx +20 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_country_search.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +19 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.html.erb +46 -0
- data/app/pb_kits/playbook/pb_popover/docs/_popover_append_to.md +1 -0
- data/app/pb_kits/playbook/pb_popover/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_popover/index.ts +13 -1
- data/app/pb_kits/playbook/pb_popover/popover.rb +2 -0
- data/dist/chunks/{_typeahead-CvkGr9xV.js → _typeahead-D8CsVBZO.js} +2 -2
- data/dist/chunks/_weekday_stacked-D3oLTSkH.js +45 -0
- data/dist/chunks/{lib-yWHJ_8mm.js → lib-BmTAc7Nc.js} +1 -1
- data/dist/chunks/{pb_form_validation-CFPfX89U.js → pb_form_validation-BWjy4bFn.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 +1 -1
- metadata +24 -6
- data/dist/chunks/_weekday_stacked-B-ran-L1.js +0 -45
@@ -77,6 +77,14 @@ module Playbook
|
|
77
77
|
default: ""
|
78
78
|
prop :validation_message, type: Playbook::Props::String,
|
79
79
|
default: ""
|
80
|
+
prop :controls_start_id, type: Playbook::Props::String,
|
81
|
+
default: ""
|
82
|
+
prop :controls_end_id, type: Playbook::Props::String,
|
83
|
+
default: ""
|
84
|
+
prop :sync_start_with, type: Playbook::Props::String,
|
85
|
+
default: ""
|
86
|
+
prop :sync_end_with, type: Playbook::Props::String,
|
87
|
+
default: ""
|
80
88
|
|
81
89
|
def classname
|
82
90
|
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
@@ -108,6 +116,10 @@ module Playbook
|
|
108
116
|
staticPosition: static_position,
|
109
117
|
thisRangesEndToday: this_ranges_end_today,
|
110
118
|
yearRange: year_range,
|
119
|
+
controlsStartId: controls_start_id,
|
120
|
+
controlsEndId: controls_end_id,
|
121
|
+
syncStartWith: sync_start_with,
|
122
|
+
syncEndWith: sync_end_with,
|
111
123
|
}.to_json.html_safe
|
112
124
|
end
|
113
125
|
|
@@ -32,7 +32,11 @@ type DatePickerConfig = {
|
|
32
32
|
thisRangesEndToday?: boolean,
|
33
33
|
timeCaption?: string,
|
34
34
|
timeFormat?: string,
|
35
|
-
yearRange: number[]
|
35
|
+
yearRange: number[],
|
36
|
+
controlsStartId?: string,
|
37
|
+
controlsEndId?: string,
|
38
|
+
syncStartWith?: string,
|
39
|
+
syncEndWith?: string,
|
36
40
|
} & Pick<BaseOptions, "allowInput" | "defaultDate" | "enableTime" | "maxDate" | "minDate" | "mode" | "plugins" | "position" | "positionElement" >
|
37
41
|
|
38
42
|
const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HTMLElement) => {
|
@@ -67,6 +71,10 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
67
71
|
timeCaption = 'Select Time',
|
68
72
|
timeFormat = 'at h:i K',
|
69
73
|
yearRange,
|
74
|
+
controlsStartId,
|
75
|
+
controlsEndId,
|
76
|
+
syncStartWith,
|
77
|
+
syncEndWith,
|
70
78
|
} = config
|
71
79
|
|
72
80
|
// ===========================================================
|
@@ -275,6 +283,47 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
275
283
|
})
|
276
284
|
}
|
277
285
|
|
286
|
+
// === Automatic Sync Logic for 3 input range pattern===
|
287
|
+
|
288
|
+
// If this is a quickpick that controls start and end
|
289
|
+
if (selectionType === "quickpick" && (controlsStartId || controlsEndId)) {
|
290
|
+
picker.config.onClose.push((selectedDates:string) => {
|
291
|
+
const [start, end] = selectedDates;
|
292
|
+
|
293
|
+
if (controlsStartId) {
|
294
|
+
const startPicker = (document.querySelector(`#${controlsStartId}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
|
295
|
+
startPicker?.setDate(start, true);
|
296
|
+
}
|
297
|
+
|
298
|
+
if (controlsEndId) {
|
299
|
+
const endPicker = (document.querySelector(`#${controlsEndId}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
|
300
|
+
endPicker?.setDate(end, true);
|
301
|
+
}
|
302
|
+
});
|
303
|
+
}
|
304
|
+
|
305
|
+
// If this is a start picker that syncs with a quickpick
|
306
|
+
if (syncStartWith) {
|
307
|
+
picker.config.onClose.push((selectedDates: string) => {
|
308
|
+
if (selectedDates?.length) {
|
309
|
+
const quickpick = (document.querySelector(`#${syncStartWith}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
|
310
|
+
quickpick?.clear();
|
311
|
+
}
|
312
|
+
});
|
313
|
+
}
|
314
|
+
|
315
|
+
// If this is an end picker that syncs with a quickpick
|
316
|
+
if (syncEndWith) {
|
317
|
+
picker.config.onClose.push((selectedDates: string) => {
|
318
|
+
if (selectedDates?.length) {
|
319
|
+
const quickpick = (document.querySelector(`#${syncEndWith}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
|
320
|
+
quickpick?.clear();
|
321
|
+
}
|
322
|
+
});
|
323
|
+
}
|
324
|
+
// === End of Automatic Sync Logic ===
|
325
|
+
|
326
|
+
|
278
327
|
// Adding dropdown icons to year and month select
|
279
328
|
dropdown.insertAdjacentHTML('afterend', `<i class="year-dropdown-icon">${angleDown}</i>`)
|
280
329
|
if (picker.monthElements[0].parentElement) {
|
@@ -1,3 +1,7 @@
|
|
1
|
+
To use the `quickpick`:
|
2
|
+
- prop `mode` must be set to `range`
|
3
|
+
- prop `selection_type` must be set to `quickpick`
|
4
|
+
|
1
5
|
This date range variant uses hidden inputs to handle start and end dates. While they are not required props, it is advisable to specify a unique `start_date_id`, `start_date_name`, `end_date_id`, and `end_date_name` for each quick pick instance you place in a form and/or on a page.
|
2
6
|
|
3
7
|
Like all other date pickers, the quick pick does require a `picker_id`.
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Use `this_ranges_end_today`/`thisRangesEndToday` to set end date on all ranges that start with 'this' to today's date. For instance, by default 'This Year' will set end day to 12/31/(current year), but if the `this_ranges_end_today`/`thisRangesEndToday` prop is used, end date on that range will be today's date.
|
@@ -1 +1,5 @@
|
|
1
|
-
|
1
|
+
To use the `quickpick`:
|
2
|
+
- prop `mode` must be set to `range`
|
3
|
+
- prop `selectionType` must be set to `quickpick`
|
4
|
+
|
5
|
+
Use the `onClose` handler function to access the startDate and endDate values. Check the [`onClose` example](https://playbook.powerapp.cloud/kits/date_picker/react#onclose) for more information.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import DatePicker from "../_date_picker";
|
3
|
+
|
4
|
+
const DatePickerRangePattern = (props) => {
|
5
|
+
return (
|
6
|
+
<>
|
7
|
+
<DatePicker
|
8
|
+
controlsEndId="end-date-picker"
|
9
|
+
controlsStartId="start-date-picker"
|
10
|
+
mode="range"
|
11
|
+
pickerId="quickpick-for-range"
|
12
|
+
placeholder="Select a Range"
|
13
|
+
selectionType="quickpick"
|
14
|
+
{...props}
|
15
|
+
/>
|
16
|
+
|
17
|
+
<DatePicker
|
18
|
+
pickerId="start-date-picker"
|
19
|
+
placeholder="Select a Start Date"
|
20
|
+
syncStartWith="quickpick-for-range"
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
|
24
|
+
<DatePicker
|
25
|
+
pickerId="end-date-picker"
|
26
|
+
placeholder="Select a End Date"
|
27
|
+
syncEndWith="quickpick-for-range"
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
</>
|
31
|
+
);
|
32
|
+
};
|
33
|
+
|
34
|
+
export default DatePickerRangePattern;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
You can link a Quickpick DatePicker to standard DatePickers using the following props:
|
2
|
+
|
3
|
+
**For the Quickpick DatePicker**:
|
4
|
+
`controlsStartId`: ID of the DatePicker that should receive the start date.
|
5
|
+
|
6
|
+
`controlsEndId`: ID of the DatePicker that should receive the end date.
|
7
|
+
|
8
|
+
When a quickpick option like “This Year” is selected, it automatically populates the linked start and end inputs.
|
9
|
+
|
10
|
+
**For the Start/End DatePickers**:
|
11
|
+
`syncStartWith`: ID of the quickpick this start date is synced to.
|
12
|
+
`syncEndWith`: ID of the quickpick this end date is synced to.
|
13
|
+
|
14
|
+
When a user manually edits the start or end date, it clears the selected quickpick to prevent conflicting values.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= pb_rails("date_picker", props: {
|
2
|
+
mode: "range",
|
3
|
+
picker_id: "quick-pick-date-range",
|
4
|
+
placeholder: "Select a Date Range",
|
5
|
+
selection_type: "quickpick",
|
6
|
+
controls_end_id: "quick-pick-date-range-end",
|
7
|
+
controls_start_id: "quick-pick-date-range-start",
|
8
|
+
}) %>
|
9
|
+
|
10
|
+
<%= pb_rails("date_picker", props: {
|
11
|
+
picker_id: "quick-pick-date-range-start",
|
12
|
+
placeholder: "Select a Start Date",
|
13
|
+
sync_start_with:"quick-pick-date-range",
|
14
|
+
}) %>
|
15
|
+
|
16
|
+
<%= pb_rails("date_picker", props: {
|
17
|
+
picker_id: "quick-pick-date-range-end",
|
18
|
+
placeholder: "Select an End Date",
|
19
|
+
sync_end_with:"quick-pick-date-range",
|
20
|
+
}) %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
You can link a Quickpick DatePicker to standard DatePickers using the following props:
|
2
|
+
|
3
|
+
**For the Quickpick DatePicker**:
|
4
|
+
`controls_start_id`: ID of the DatePicker that should receive the start date.
|
5
|
+
|
6
|
+
`controls_end_id`: ID of the DatePicker that should receive the end date.
|
7
|
+
|
8
|
+
When a quickpick option like “This Year” is selected, it automatically populates the linked start and end inputs.
|
9
|
+
|
10
|
+
**For the Start/End DatePickers**:
|
11
|
+
`sync_start_with`: ID of the quickpick this start date is synced to.
|
12
|
+
`sync_end_with`: ID of the quickpick this end date is synced to.
|
13
|
+
|
14
|
+
When a user manually edits the start or end date, it clears the selected quickpick to prevent conflicting values.
|
@@ -15,6 +15,7 @@ examples:
|
|
15
15
|
- date_picker_quick_pick_custom: Custom Quick Pick Dates
|
16
16
|
- date_picker_quick_pick_custom_override: Custom Quick Pick Dates (append to defaults)
|
17
17
|
- date_picker_quick_pick_default_date: Range (Quick Pick w/ Default Date)
|
18
|
+
- date_picker_range_pattern_rails: Range with 2 Date Pickers and a Quick Pick
|
18
19
|
- date_picker_format: Format
|
19
20
|
- date_picker_disabled: Disabled Dates
|
20
21
|
- date_picker_min_max: Min Max
|
@@ -47,6 +48,7 @@ examples:
|
|
47
48
|
- date_picker_quick_pick_custom: Custom Quick Pick Dates
|
48
49
|
- date_picker_quick_pick_custom_override: Custom Quick Pick Dates (append to defaults)
|
49
50
|
- date_picker_quick_pick_default_date: Range (Quick Pick w/ Default Date)
|
51
|
+
- date_picker_range_pattern: Range with 2 Date Pickers and a Quick Pick
|
50
52
|
- date_picker_format: Format
|
51
53
|
- date_picker_disabled: Disabled Dates
|
52
54
|
- date_picker_min_max: Min Max
|
@@ -26,3 +26,4 @@ export { default as DatePickerOnClose } from './_date_picker_on_close.jsx'
|
|
26
26
|
export { default as DatePickerQuickPickCustom } from './_date_picker_quick_pick_custom'
|
27
27
|
export { default as DatePickerQuickPickCustomOverride } from './_date_picker_quick_pick_custom_override'
|
28
28
|
export { default as DatePickerQuickPickDefaultDate } from './_date_picker_quick_pick_default_date'
|
29
|
+
export { default as DatePickerRangePattern } from './_date_picker_range_pattern'
|
@@ -238,6 +238,16 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
|
|
238
238
|
},
|
239
239
|
|
240
240
|
onClose(selectedDates: Array<Date>) {
|
241
|
+
// Patch .clear() to also remove active state if cleared
|
242
|
+
const originalClear = fp.clear;
|
243
|
+
fp.clear = function (...args: any) {
|
244
|
+
const current = pluginData.rangesNav.querySelector('.active');
|
245
|
+
if (current) {
|
246
|
+
current.classList.remove('active');
|
247
|
+
}
|
248
|
+
activeLabel = "";
|
249
|
+
return originalClear.apply(this, args);
|
250
|
+
};
|
241
251
|
// remove the active class from the button if the selected dates don't match the label
|
242
252
|
if (!isLabelMatchingSelectedDates(selectedDates)) {
|
243
253
|
pluginData.rangesButtons[activeLabel]?.classList.remove('active');
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<%=
|
2
|
+
pb_rails("filter", props: {
|
3
|
+
id: "filter_within_trubo_frames",
|
4
|
+
position: "top",
|
5
|
+
filters: [
|
6
|
+
{ name: "name", value: "John Wick" },
|
7
|
+
{ name: "city", value: "San Francisco"}
|
8
|
+
],
|
9
|
+
sort_menu: [
|
10
|
+
{ item: "Popularity", link: "?q[sorts]=managers_popularity+asc", active: true, direction: "desc" },
|
11
|
+
{ item: "Mananger's Title", link: "?q[sorts]=managers_title+asc", active: false },
|
12
|
+
{ item: "Manager's Name", link: "?q[sorts]=managers_name+asc", active: false },
|
13
|
+
],
|
14
|
+
template: "default",
|
15
|
+
results: 1,
|
16
|
+
popover_props: { append_to: "parent" },
|
17
|
+
}) do
|
18
|
+
%>
|
19
|
+
<%
|
20
|
+
example_collection = [
|
21
|
+
OpenStruct.new(name: "USA", value: 1),
|
22
|
+
OpenStruct.new(name: "Canada", value: 2),
|
23
|
+
OpenStruct.new(name: "Brazil", value: 3),
|
24
|
+
OpenStruct.new(name: "Philippines", value: 4),
|
25
|
+
OpenStruct.new(name: "A galaxy far far away, like really far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far far away...", value: 5)
|
26
|
+
]
|
27
|
+
%>
|
28
|
+
<%= pb_rails("form", props: { form_system_options: { scope: :example, method: :get } }) do |form| %>
|
29
|
+
<%= form.text_field :example_text_field, props: { label: true } %>
|
30
|
+
<%= form.collection_select :example_collection_select, example_collection, :value, :name, props: {max_width: "sm", label: true } %>
|
31
|
+
|
32
|
+
<%= form.actions do |action| %>
|
33
|
+
<%= action.submit props: {
|
34
|
+
text: "Apply",
|
35
|
+
data: {
|
36
|
+
disable_with: "pb_rails('icon', props: { icon: 'spinner', spin: true, fixed_width: true })Searching...".html_safe
|
37
|
+
},}%>
|
38
|
+
<%= action.button props: { type: "reset", text: "Clear", variant: "secondary" } %>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
41
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
By default, the filter popover attaches to the `<body>`. To attach it elsewhere, like inside a Turbo Frame, pass the `append_to` prop through `popover_props`. Set it to `"parent"` to place the tooltip inside its parent element, or pass any CSS selector (`#id` or `.class`) to specify a custom container.
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import lineGraphTheme from '../lineGraphTheme'
|
3
|
+
import Highcharts from "highcharts"
|
4
|
+
import HighchartsReact from "highcharts-react-official"
|
5
|
+
|
6
|
+
const data = [{
|
7
|
+
name: 'Installation',
|
8
|
+
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175],
|
9
|
+
}, {
|
10
|
+
name: 'Manufacturing',
|
11
|
+
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434],
|
12
|
+
}, {
|
13
|
+
name: 'Sales & Distribution',
|
14
|
+
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387],
|
15
|
+
}, {
|
16
|
+
name: 'Project Development',
|
17
|
+
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227],
|
18
|
+
}, {
|
19
|
+
name: 'Other',
|
20
|
+
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111],
|
21
|
+
}]
|
22
|
+
|
23
|
+
const categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
24
|
+
|
25
|
+
const baseOptions = {
|
26
|
+
series: data,
|
27
|
+
title: { text: "Solar Employment Growth by Sector, 2010-2016" },
|
28
|
+
subtitle: { text: "Source: thesolarfoundation.com" },
|
29
|
+
xAxis: {
|
30
|
+
categories: categories,
|
31
|
+
},
|
32
|
+
yAxis: {
|
33
|
+
title: {
|
34
|
+
text: "Number of Employees",
|
35
|
+
},
|
36
|
+
},
|
37
|
+
}
|
38
|
+
|
39
|
+
const LineGraphPbStyles = () => {
|
40
|
+
const options = Highcharts.merge({}, lineGraphTheme, baseOptions)
|
41
|
+
|
42
|
+
return(
|
43
|
+
<div>
|
44
|
+
<HighchartsReact
|
45
|
+
highcharts={Highcharts}
|
46
|
+
options={options}
|
47
|
+
/>
|
48
|
+
</div>
|
49
|
+
)
|
50
|
+
}
|
51
|
+
|
52
|
+
export default LineGraphPbStyles
|
@@ -0,0 +1 @@
|
|
1
|
+
You don't need to use the Line Graph Kit to apply Playbook styles to your Highcharts line graph. Just import lineGraphTheme.ts and merge it with your graph options—Playbook’s styling will apply automatically.
|
@@ -4,3 +4,4 @@ export { default as LineGraphLegendPosition } from './_line_graph_legend_positio
|
|
4
4
|
export { default as LineGraphLegendNonclickable } from './_line_graph_legend_nonclickable.jsx'
|
5
5
|
export { default as LineGraphHeight } from './_line_graph_height.jsx'
|
6
6
|
export { default as LineGraphColors } from './_line_graph_colors.jsx'
|
7
|
+
export { default as LineGraphPbStyles } from './_line_graph_pb_styles.jsx'
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import colors from '../tokens/exports/_colors.module.scss'
|
2
|
+
import typography from '../tokens/exports/_typography.module.scss'
|
3
|
+
|
4
|
+
const lineGraphTheme = {
|
5
|
+
title: {
|
6
|
+
text: "",
|
7
|
+
style: {
|
8
|
+
color: colors.text_lt_default,
|
9
|
+
fontFamily: typography.font_family_base,
|
10
|
+
fontWeight: typography.bold,
|
11
|
+
fontSize: typography.heading_3,
|
12
|
+
},
|
13
|
+
},
|
14
|
+
subtitle: {
|
15
|
+
text: "" ,
|
16
|
+
style: {
|
17
|
+
fontFamily: typography.font_family_base,
|
18
|
+
color: colors.text_lt_light,
|
19
|
+
fontWeight: typography.regular,
|
20
|
+
fontSize: typography.text_base,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
chart: {
|
24
|
+
type: "line",
|
25
|
+
},
|
26
|
+
tooltip: {
|
27
|
+
backgroundColor: {
|
28
|
+
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
29
|
+
stops: [
|
30
|
+
[0, colors.bg_dark],
|
31
|
+
[1, colors.bg_dark],
|
32
|
+
],
|
33
|
+
},
|
34
|
+
followPointer: true,
|
35
|
+
shadow: false,
|
36
|
+
borderWidth: 0,
|
37
|
+
borderRadius: 10,
|
38
|
+
style: {
|
39
|
+
fontFamily: typography.font_family_base,
|
40
|
+
color: colors.text_dk_default,
|
41
|
+
fontWeight: typography.regular,
|
42
|
+
fontSize: typography.text_smaller,
|
43
|
+
},
|
44
|
+
},
|
45
|
+
plotOptions: {
|
46
|
+
line: {
|
47
|
+
dataLabels: {
|
48
|
+
enabled: false,
|
49
|
+
},
|
50
|
+
},
|
51
|
+
},
|
52
|
+
credits: { enabled: false },
|
53
|
+
legend: { enabled: false },
|
54
|
+
colors: [
|
55
|
+
colors.data_1,
|
56
|
+
colors.data_2,
|
57
|
+
colors.data_3,
|
58
|
+
colors.data_4,
|
59
|
+
colors.data_5,
|
60
|
+
colors.data_6,
|
61
|
+
colors.data_7,
|
62
|
+
],
|
63
|
+
xAxis: {
|
64
|
+
gridLineWidth: 0,
|
65
|
+
lineColor: colors.border_light,
|
66
|
+
tickColor: colors.border_light,
|
67
|
+
labels: {
|
68
|
+
style: {
|
69
|
+
fontFamily: typography.font_family_base,
|
70
|
+
color: colors.text_lt_lighter,
|
71
|
+
fontWeight: typography.bold,
|
72
|
+
fontSize: typography.text_smaller,
|
73
|
+
},
|
74
|
+
},
|
75
|
+
title: {
|
76
|
+
style: {
|
77
|
+
color: colors.text_lt_default,
|
78
|
+
fontFamily: typography.font_family_base,
|
79
|
+
fontWeight: typography.regular,
|
80
|
+
fontSize: typography.heading_4,
|
81
|
+
},
|
82
|
+
},
|
83
|
+
},
|
84
|
+
yAxis: {
|
85
|
+
alternateGridColor: undefined as string | undefined,
|
86
|
+
minorTickInterval: null as number | null,
|
87
|
+
gridLineColor: colors.border_light,
|
88
|
+
minorGridLineColor: colors.border_light,
|
89
|
+
lineWidth: 0,
|
90
|
+
tickWidth: 0,
|
91
|
+
labels: {
|
92
|
+
style: {
|
93
|
+
fontFamily: typography.font_family_base,
|
94
|
+
color: colors.text_lt_lighter,
|
95
|
+
fontWeight: typography.bold,
|
96
|
+
fontSize: typography.text_smaller,
|
97
|
+
},
|
98
|
+
},
|
99
|
+
title: {
|
100
|
+
style: {
|
101
|
+
fontFamily: typography.font_family_base,
|
102
|
+
color: colors.text_lt_lighter,
|
103
|
+
fontWeight: typography.bold,
|
104
|
+
fontSize: typography.text_smaller,
|
105
|
+
},
|
106
|
+
},
|
107
|
+
},
|
108
|
+
}
|
109
|
+
|
110
|
+
export default lineGraphTheme;
|
@@ -39,6 +39,9 @@ $flag-min-resolution: 192dpi;
|
|
39
39
|
color: $charcoal;
|
40
40
|
}
|
41
41
|
|
42
|
+
.iti__country-list {
|
43
|
+
min-width: $dropdown-min-width;
|
44
|
+
}
|
42
45
|
// iti-spacer-horizontal's default is 8px, or $space_xs
|
43
46
|
.iti__country-list .iti__flag, .iti__country-name {
|
44
47
|
margin-right: $space_xs;
|
@@ -227,6 +230,16 @@ $flag-min-resolution: 192dpi;
|
|
227
230
|
.iti__dropdown-content {
|
228
231
|
border-radius: $space_xs;
|
229
232
|
border: 1px solid $border_dark !important;
|
233
|
+
.iti__search-input {
|
234
|
+
background-color: $bg_dark_card;
|
235
|
+
&:hover {
|
236
|
+
background-color: $bg_dark_card;
|
237
|
+
}
|
238
|
+
&:active,
|
239
|
+
&:focus {
|
240
|
+
background-color: $card_dark;
|
241
|
+
}
|
242
|
+
}
|
230
243
|
}
|
231
244
|
|
232
245
|
.iti__divider {
|
@@ -37,6 +37,7 @@ type PhoneNumberInputProps = {
|
|
37
37
|
required?: boolean,
|
38
38
|
value?: string,
|
39
39
|
formatAsYouType?: boolean,
|
40
|
+
countrySearch?: boolean,
|
40
41
|
}
|
41
42
|
|
42
43
|
enum ValidationError {
|
@@ -91,6 +92,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
91
92
|
preferredCountries = [],
|
92
93
|
value = "",
|
93
94
|
formatAsYouType = false,
|
95
|
+
countrySearch = false,
|
94
96
|
} = props
|
95
97
|
|
96
98
|
const ariaProps = buildAriaProps(aria)
|
@@ -242,7 +244,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
242
244
|
autoInsertDialCode: false,
|
243
245
|
initialCountry: initialCountry || fallbackCountry,
|
244
246
|
onlyCountries,
|
245
|
-
countrySearch:
|
247
|
+
countrySearch: countrySearch,
|
246
248
|
fixDropdownWidth: false,
|
247
249
|
formatAsYouType: formatAsYouType,
|
248
250
|
hiddenInput: hiddenInputs ? () => ({
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PhoneNumberInput from '../_phone_number_input'
|
3
|
+
|
4
|
+
const PhoneNumberInputCountrySearch = (props) => (
|
5
|
+
<>
|
6
|
+
<PhoneNumberInput
|
7
|
+
countrySearch
|
8
|
+
id='country-search'
|
9
|
+
{...props}
|
10
|
+
/>
|
11
|
+
<PhoneNumberInput
|
12
|
+
countrySearch
|
13
|
+
id='country-search-limited'
|
14
|
+
onlyCountries={["br", "us", "ph", "gb"]}
|
15
|
+
{...props}
|
16
|
+
/>
|
17
|
+
</>
|
18
|
+
)
|
19
|
+
|
20
|
+
export default PhoneNumberInputCountrySearch
|
@@ -0,0 +1 @@
|
|
1
|
+
Set `country_search` / `countrySearch` to true to allow users to search for a specific Country within the dropdown. If the range of countries has been limited, only the selected countries will be searchable.
|
@@ -9,6 +9,7 @@ examples:
|
|
9
9
|
- phone_number_input_clear_field: Clearing the Input Field
|
10
10
|
- phone_number_input_access_input_element: Accessing the Input Element
|
11
11
|
- phone_number_input_format: Format as You Type
|
12
|
+
- phone_number_input_country_search: Country Search
|
12
13
|
|
13
14
|
rails:
|
14
15
|
- phone_number_input_default: Default
|
@@ -18,4 +19,5 @@ examples:
|
|
18
19
|
- phone_number_input_validation: Form Validation
|
19
20
|
- phone_number_input_format: Format as You Type
|
20
21
|
- phone_number_input_hidden_inputs: Hidden Inputs
|
22
|
+
- phone_number_input_country_search: Country Search
|
21
23
|
|
@@ -6,3 +6,4 @@ export { default as PhoneNumberInputValidation } from './_phone_number_input_val
|
|
6
6
|
export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
|
7
7
|
export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
|
8
8
|
export { default as PhoneNumberInputFormat } from './_phone_number_input_format'
|
9
|
+
export { default as PhoneNumberInputCountrySearch } from './_phone_number_input_country_search'
|
@@ -25,6 +25,8 @@ module Playbook
|
|
25
25
|
default: false
|
26
26
|
prop :hidden_inputs, type: Playbook::Props::Boolean,
|
27
27
|
default: false
|
28
|
+
prop :country_search, type: Playbook::Props::Boolean,
|
29
|
+
default: false
|
28
30
|
|
29
31
|
def classname
|
30
32
|
generate_classname("pb_phone_number_input")
|
@@ -45,6 +47,7 @@ module Playbook
|
|
45
47
|
preferredCountries: preferred_countries,
|
46
48
|
required: required,
|
47
49
|
value: value,
|
50
|
+
countrySearch: country_search,
|
48
51
|
}
|
49
52
|
end
|
50
53
|
end
|
@@ -139,3 +139,22 @@ test("should format phone number as '555-555-5555' with formatAsYouType and 'us'
|
|
139
139
|
|
140
140
|
expect(input.value).toBe("555-555-5555");
|
141
141
|
});
|
142
|
+
|
143
|
+
test("should pass countrySearch prop to component", () => {
|
144
|
+
window.intlTelInput = jest.fn(() => ({
|
145
|
+
getSelectedCountryData: jest.fn(() => ({})),
|
146
|
+
isValidNumber: jest.fn(() => true),
|
147
|
+
getValidationError: jest.fn(() => 0),
|
148
|
+
}));
|
149
|
+
|
150
|
+
const props = {
|
151
|
+
id: testId,
|
152
|
+
countrySearch: true,
|
153
|
+
data: { testid: 'phone-input-with-search' }
|
154
|
+
};
|
155
|
+
|
156
|
+
render(<PhoneNumberInput {...props} />);
|
157
|
+
|
158
|
+
const wrapper = screen.getByTestId('phone-input-with-search');
|
159
|
+
expect(wrapper).toBeInTheDocument();
|
160
|
+
});
|