playbook_ui 6.0.1.pre.alpha3 → 6.1.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/_playbook.scss +3 -2
- data/app/pb_kits/playbook/data/menu.yml +4 -3
- data/app/pb_kits/playbook/index.js +2 -2
- data/app/pb_kits/playbook/packs/examples.js +5 -2
- data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +2 -2
- data/app/pb_kits/playbook/pb_badge/_badge.jsx +2 -5
- data/app/pb_kits/playbook/pb_badge/_badge.scss +1 -1
- data/app/pb_kits/playbook/pb_badge/badge.rb +1 -6
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +2 -2
- data/app/pb_kits/playbook/pb_body/_body.jsx +3 -6
- data/app/pb_kits/playbook/pb_body/_body.scss +6 -0
- data/app/pb_kits/playbook/pb_body/body.rb +2 -8
- data/app/pb_kits/playbook/pb_button/_button.jsx +2 -5
- data/app/pb_kits/playbook/pb_button/_button.scss +1 -1
- data/app/pb_kits/playbook/pb_button/button.rb +1 -7
- data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +2 -0
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.html.erb +7 -0
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +52 -0
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.scss +101 -0
- data/app/pb_kits/playbook/pb_button_toolbar/button_toolbar.rb +29 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_default.html.erb +7 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_default.jsx +29 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_secondary.html.erb +7 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_secondary.jsx +34 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_vertical.html.erb +11 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_vertical.jsx +29 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_vertical_secondary.html.erb +11 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/_button_toolbar_vertical_secondary.jsx +34 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/_description.md +1 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/example.yml +15 -0
- data/app/pb_kits/playbook/pb_button_toolbar/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +3 -7
- data/app/pb_kits/playbook/pb_caption/_caption.scss +0 -4
- data/app/pb_kits/playbook/pb_caption/caption.rb +1 -8
- data/app/pb_kits/playbook/pb_card/_card.jsx +17 -14
- data/app/pb_kits/playbook/pb_card/_card.scss +4 -1
- data/app/pb_kits/playbook/pb_card/card.rb +2 -9
- data/app/pb_kits/playbook/pb_card/docs/_card_dark.html.erb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +2 -2
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -8
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +2 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +0 -2
- data/app/pb_kits/playbook/pb_contact/_contact.jsx +2 -2
- data/app/pb_kits/playbook/pb_currency/_currency.jsx +2 -2
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +26 -0
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +2 -2
- data/app/pb_kits/playbook/pb_date/_date.jsx +4 -4
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx +2 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.jsx +2 -2
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +2 -2
- data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.jsx +2 -2
- data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +2 -2
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +2 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +2 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +2 -2
- data/app/pb_kits/playbook/pb_flex/_flex.jsx +2 -2
- data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +0 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +0 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_simple_form.html.erb +1 -3
- data/app/pb_kits/playbook/pb_form/docs/_form_simple_form_validate.html.erb +1 -3
- data/app/pb_kits/playbook/pb_form/form_builder.rb +0 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
- data/app/pb_kits/playbook/pb_gauge/_gauge.html.erb +12 -0
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +110 -0
- data/app/pb_kits/playbook/pb_gauge/_gauge.scss +11 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.html.erb +11 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +17 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.html.erb +12 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.jsx +18 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.html.erb +14 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +20 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.html.erb +15 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +23 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +40 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.html.erb +15 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +21 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.html.erb +26 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +37 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.html.erb +14 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +20 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.html.erb +29 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +29 -0
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +24 -0
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +9 -0
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +57 -0
- data/app/pb_kits/playbook/pb_hashtag/_hashtag.jsx +2 -2
- data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +2 -2
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +2 -2
- data/app/pb_kits/playbook/pb_icon/_icon.jsx +2 -2
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.jsx +2 -2
- data/app/pb_kits/playbook/pb_icon_value/_icon_value.jsx +2 -2
- data/app/pb_kits/playbook/pb_image/_image.jsx +2 -2
- data/app/pb_kits/playbook/pb_kit/dateTime.js +5 -1
- data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +2 -2
- data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +2 -2
- data/app/pb_kits/playbook/pb_layout/_layout.jsx +6 -6
- data/app/pb_kits/playbook/pb_legend/_legend.jsx +2 -2
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +2 -2
- data/app/pb_kits/playbook/pb_list/_list.jsx +2 -2
- data/app/pb_kits/playbook/pb_list/_list_item.jsx +2 -2
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.jsx +2 -2
- data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +111 -0
- data/app/pb_kits/playbook/pb_message/_message.jsx +2 -2
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +2 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.jsx +2 -2
- data/app/pb_kits/playbook/pb_nav/_nav.jsx +2 -2
- data/app/pb_kits/playbook/pb_online_status/_online_status.jsx +2 -2
- data/app/pb_kits/playbook/pb_person/_person.jsx +2 -2
- data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +2 -2
- data/app/pb_kits/playbook/pb_pill/_pill.jsx +2 -2
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +2 -2
- data/app/pb_kits/playbook/pb_popover/docs/_popover_list.jsx +5 -5
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx +2 -2
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +2 -2
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +2 -2
- data/app/pb_kits/playbook/pb_radio/_radio.jsx +2 -2
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +2 -2
- data/app/pb_kits/playbook/pb_select/_select.jsx +2 -2
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.jsx +12 -16
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +1 -7
- data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx +26 -26
- data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.scss +1 -1
- data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.rb +1 -8
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.jsx +8 -10
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.scss +1 -1
- data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.rb +1 -7
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +2 -2
- data/app/pb_kits/playbook/pb_stat_value/_stat_value.jsx +2 -2
- data/app/pb_kits/playbook/pb_table/_table.jsx +2 -2
- data/app/pb_kits/playbook/pb_table/_table_row.jsx +2 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +2 -2
- data/app/pb_kits/playbook/pb_textarea/_textarea.html.erb +1 -1
- data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +2 -2
- data/app/pb_kits/playbook/pb_textarea/_textarea.scss +2 -1
- data/app/pb_kits/playbook/pb_time/_time.jsx +57 -14
- data/app/pb_kits/playbook/pb_time/_time.scss +17 -0
- data/app/pb_kits/playbook/pb_time/docs/_time_align.jsx +27 -0
- data/app/pb_kits/playbook/pb_time/docs/_time_dark.jsx +28 -0
- data/app/pb_kits/playbook/pb_time/docs/_time_default.jsx +28 -0
- data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.jsx +32 -0
- data/app/pb_kits/playbook/pb_time/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_time/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.jsx +2 -2
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +2 -2
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +2 -2
- data/app/pb_kits/playbook/pb_title/_title.jsx +3 -6
- data/app/pb_kits/playbook/pb_title/_title.scss +1 -1
- data/app/pb_kits/playbook/pb_title/title.rb +1 -9
- data/app/pb_kits/playbook/pb_title_count/_title_count.jsx +2 -2
- data/app/pb_kits/playbook/pb_title_detail/_title_detail.jsx +2 -2
- data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +39 -31
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_custom.jsx +31 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_custom_radio.html.erb +6 -6
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_custom_radio.jsx +72 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default.html.erb +1 -3
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx +6 -19
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name.jsx +57 -0
- data/app/pb_kits/playbook/pb_toggle/docs/{_toggle_checked.html.erb → _toggle_size.html.erb} +2 -2
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_size.jsx +44 -0
- data/app/pb_kits/playbook/pb_toggle/docs/example.yml +8 -5
- data/app/pb_kits/playbook/pb_toggle/docs/index.js +4 -2
- data/app/pb_kits/playbook/pb_user/_user.jsx +2 -2
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +2 -2
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +2 -2
- data/app/pb_kits/playbook/plugins/pb_chart.js +74 -0
- data/app/pb_kits/playbook/props.rb +6 -0
- data/app/pb_kits/playbook/utilities/{spacing.js → globalProps.js} +14 -1
- data/app/pb_kits/playbook/utilities/props.js +1 -0
- data/app/pb_kits/playbook/vendor.js +0 -6
- data/lib/generators/kit/templates/kit_jsx.erb.tt +2 -2
- data/lib/playbook/version.rb +1 -1
- metadata +56 -34
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.html.erb +0 -38
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +0 -101
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +0 -846
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -41
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +0 -91
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.jsx +0 -12
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.html.erb +0 -24
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.jsx +0 -30
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_disabled.html.erb +0 -43
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_disabled.jsx +0 -48
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_error.jsx +0 -13
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_format.html.erb +0 -19
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_format.jsx +0 -25
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_label.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_label.jsx +0 -13
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_min_max.html.erb +0 -14
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_min_max.jsx +0 -22
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.html.erb +0 -4
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.jsx +0 -13
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -23
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +0 -8
- data/app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb +0 -34
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_accessibility.jsx +0 -12
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_data.jsx +0 -15
@@ -2,7 +2,7 @@
|
|
2
2
|
import React from 'react'
|
3
3
|
import classnames from 'classnames'
|
4
4
|
import { buildCss } from '../utilities/props'
|
5
|
-
import {
|
5
|
+
import { globalProps } from '../utilities/globalProps.js'
|
6
6
|
type FlexItemPropTypes = {
|
7
7
|
children: Array<React.ReactNode> | React.ReactNode,
|
8
8
|
fixedSize: String,
|
@@ -18,7 +18,7 @@ const FlexItem = (props: FlexItemPropTypes) => {
|
|
18
18
|
|
19
19
|
return (
|
20
20
|
<div
|
21
|
-
className={classnames(buildCss('pb_flex_item_kit', growClass), className,
|
21
|
+
className={classnames(buildCss('pb_flex_item_kit', growClass), className, globalProps(props))}
|
22
22
|
style={fixedStyle}
|
23
23
|
>
|
24
24
|
{children}
|
@@ -24,7 +24,6 @@
|
|
24
24
|
<%= form.text_area :example_text_area, props: { label: true } %>
|
25
25
|
<%= form.select :example_select, [ ["Yes", 1], ["No", 2] ], props: { label: true } %>
|
26
26
|
<%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true } %>
|
27
|
-
<%= form.date_picker :example_date_picker, props: { default_date: 'blank', name: "example[example_date_picker]", picker_id: "example_example_date_picker1" } %>
|
28
27
|
|
29
28
|
<%= form.actions do |action| %>
|
30
29
|
<%= action.submit %>
|
@@ -27,7 +27,6 @@
|
|
27
27
|
<%= form.text_area :example_text_area, props: { label: true, required: true } %>
|
28
28
|
<%= form.select :example_select, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true } %>
|
29
29
|
<%= form.collection_select :example_collection_select, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
|
30
|
-
<%= form.date_picker :example_date_picker, props: { default_date: 'blank', name: "example[example_date_picker]", picker_id: "example_example_date_picker2", required: true } %>
|
31
30
|
|
32
31
|
<%= form.actions do |action| %>
|
33
32
|
<%= action.submit %>
|
@@ -13,8 +13,7 @@
|
|
13
13
|
:example_url_field,
|
14
14
|
:example_text_area,
|
15
15
|
:example_select_field,
|
16
|
-
:example_collection_select_field
|
17
|
-
:example_date_picker_field
|
16
|
+
:example_collection_select_field
|
18
17
|
|
19
18
|
|
20
19
|
def self.model_name
|
@@ -50,7 +49,6 @@
|
|
50
49
|
<%= form.input :example_text_area, as: :text %>
|
51
50
|
<%= form.select :example_select_field, [["Yes", 1], ["No", 2]], props: { label: true } %>
|
52
51
|
<%= form.collection_select :example_collection_select_field, example_collection, :value, :name, props: { label: true } %>
|
53
|
-
<%= form.date_picker :example_date_picker_field, props: { default_date: 'blank', name: "example[example_date_picker]", picker_id: "example_example_date_picker3" } %>
|
54
52
|
|
55
53
|
<%= form.actions do |action| %>
|
56
54
|
<%= action.submit %>
|
@@ -13,8 +13,7 @@
|
|
13
13
|
:example_url_field,
|
14
14
|
:example_text_area,
|
15
15
|
:example_select_field,
|
16
|
-
:example_collection_select_field
|
17
|
-
:example_date_picker_field
|
16
|
+
:example_collection_select_field
|
18
17
|
|
19
18
|
|
20
19
|
def self.model_name
|
@@ -50,7 +49,6 @@
|
|
50
49
|
<%= form.input :example_text_area, {as: :text, input_html: {props: {required: true}}} %>
|
51
50
|
<%= form.select :example_select_field, [["Yes", 1], ["No", 2]], props: { required: true, blank_selection: "Select One...", label: true } %>
|
52
51
|
<%= form.collection_select :example_collection_select_field, example_collection, :value, :name, props: { required: true, blank_selection: "Select One...", label: true } %>
|
53
|
-
<%= form.date_picker :example_date_picker_field, props: { default_date: 'blank', name: "example[example_date_picker]", picker_id: "example_example_date_picker4", required: true } %>
|
54
52
|
|
55
53
|
<%= form.actions do |action| %>
|
56
54
|
<%= action.submit %>
|
@@ -4,7 +4,7 @@ import classnames from 'classnames'
|
|
4
4
|
import Title from '../pb_title/_title.jsx'
|
5
5
|
import Icon from '../pb_icon/_icon.jsx'
|
6
6
|
import Avatar from '../pb_avatar/_avatar.jsx'
|
7
|
-
import {
|
7
|
+
import { globalProps } from '../utilities/globalProps.js'
|
8
8
|
|
9
9
|
type FormPillProps = {
|
10
10
|
className?: String,
|
@@ -19,7 +19,7 @@ const FormPill = (props: FormPillProps) => {
|
|
19
19
|
const { className, text, name, onClick = () => {}, avatarUrl } = props
|
20
20
|
const css = classnames(
|
21
21
|
[`pb_form_pill_kit_${'primary'}`, className],
|
22
|
-
|
22
|
+
globalProps(props)
|
23
23
|
)
|
24
24
|
return (
|
25
25
|
<div className={css}>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= content_tag(:div, "",
|
2
|
+
id: object.id,
|
3
|
+
data: object.data,
|
4
|
+
class: object.classname) %>
|
5
|
+
<% content_for :pb_js do %>
|
6
|
+
<%= javascript_tag do %>
|
7
|
+
window.addEventListener('DOMContentLoaded', function() {
|
8
|
+
new pbChart('.selector', <%= object.chart_options %>)
|
9
|
+
})
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/* @flow */
|
2
|
+
|
3
|
+
import React, { useEffect, useRef } from 'react'
|
4
|
+
import { pbChart } from '../'
|
5
|
+
import { globalProps } from '../utilities/globalProps'
|
6
|
+
import classnames from 'classnames'
|
7
|
+
import Highcharts from 'highcharts'
|
8
|
+
|
9
|
+
import {
|
10
|
+
buildAriaProps,
|
11
|
+
buildCss,
|
12
|
+
buildDataProps,
|
13
|
+
} from '../utilities/props'
|
14
|
+
|
15
|
+
type GaugeProps = {
|
16
|
+
aria: Object,
|
17
|
+
className?: String,
|
18
|
+
chartData?: Array,
|
19
|
+
data?: Object,
|
20
|
+
disableAnimation: Boolean,
|
21
|
+
fullCircle: Boolean,
|
22
|
+
height: String,
|
23
|
+
id?: String,
|
24
|
+
max: Number,
|
25
|
+
min: Number,
|
26
|
+
prefix: String,
|
27
|
+
showLabels: Boolean,
|
28
|
+
style: String,
|
29
|
+
suffix: String,
|
30
|
+
title: String,
|
31
|
+
tooltipHtml: String,
|
32
|
+
}
|
33
|
+
|
34
|
+
const Gauge = (props: GaugeProps) => {
|
35
|
+
const {
|
36
|
+
aria = {},
|
37
|
+
className,
|
38
|
+
chartData = [{ name: 'Name', value: 0 }],
|
39
|
+
data = {},
|
40
|
+
disableAnimation = false,
|
41
|
+
fullCircle = false,
|
42
|
+
height = null,
|
43
|
+
id,
|
44
|
+
max = 100,
|
45
|
+
min = 0,
|
46
|
+
prefix = '',
|
47
|
+
showLabels = false,
|
48
|
+
style = 'solidgauge',
|
49
|
+
suffix = '',
|
50
|
+
title = '',
|
51
|
+
tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + '<b>{point.y}</b>',
|
52
|
+
} = props
|
53
|
+
|
54
|
+
const ariaProps = buildAriaProps(aria)
|
55
|
+
const dataProps = buildDataProps(data)
|
56
|
+
|
57
|
+
const css = buildCss({
|
58
|
+
'pb_gauge_kit': true,
|
59
|
+
})
|
60
|
+
// Runs first time component Renders
|
61
|
+
useEffect(() => {
|
62
|
+
const formattedChartData = chartData.map((obj) => {
|
63
|
+
obj.y = obj.value
|
64
|
+
delete obj.value
|
65
|
+
return obj
|
66
|
+
})
|
67
|
+
|
68
|
+
new pbChart('.selector', {
|
69
|
+
id: id,
|
70
|
+
chartData: formattedChartData,
|
71
|
+
circumference: fullCircle ? [0, 360] : [-100, 100],
|
72
|
+
disableAnimation: disableAnimation,
|
73
|
+
height: height,
|
74
|
+
min: min,
|
75
|
+
max: max,
|
76
|
+
prefix: prefix,
|
77
|
+
title: title,
|
78
|
+
suffix: suffix,
|
79
|
+
showLabels: showLabels,
|
80
|
+
style: style,
|
81
|
+
tooltipHtml: tooltipHtml,
|
82
|
+
type: 'gauge',
|
83
|
+
})
|
84
|
+
}, [])
|
85
|
+
|
86
|
+
const componentDidMount = useRef(false)
|
87
|
+
// Doesn't run the first time but runs every subsequent render
|
88
|
+
useEffect(() => {
|
89
|
+
if (componentDidMount.current) {
|
90
|
+
Highcharts.charts.forEach((chart) => {
|
91
|
+
if (chart.renderTo.id === id) {
|
92
|
+
chart.series[0].setData([chartData[0].value])
|
93
|
+
chart.series[0].data[0].name = chartData[0].name
|
94
|
+
}
|
95
|
+
})
|
96
|
+
} else {
|
97
|
+
componentDidMount.current = true
|
98
|
+
}
|
99
|
+
}, [chartData])
|
100
|
+
return (
|
101
|
+
<div
|
102
|
+
{...ariaProps}
|
103
|
+
{...dataProps}
|
104
|
+
className={classnames(css, className, globalProps(props))}
|
105
|
+
id={id}
|
106
|
+
/>
|
107
|
+
)
|
108
|
+
}
|
109
|
+
|
110
|
+
export default Gauge
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Gauge } from '../../'
|
3
|
+
|
4
|
+
const data = [
|
5
|
+
{ name: 'Name', value: 45 },
|
6
|
+
]
|
7
|
+
|
8
|
+
const GaugeDefault = () => (
|
9
|
+
<div>
|
10
|
+
<Gauge
|
11
|
+
chartData={data}
|
12
|
+
id="gauge-default"
|
13
|
+
/>
|
14
|
+
</div>
|
15
|
+
)
|
16
|
+
|
17
|
+
export default GaugeDefault
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Gauge } from '../../'
|
3
|
+
|
4
|
+
const data = [
|
5
|
+
{ name: 'Participants', value: 84 },
|
6
|
+
]
|
7
|
+
|
8
|
+
const GaugeDisableAnimation = () => (
|
9
|
+
<div>
|
10
|
+
<Gauge
|
11
|
+
chartData={data}
|
12
|
+
disableAnimation
|
13
|
+
id="gauge-disable-animation"
|
14
|
+
/>
|
15
|
+
</div>
|
16
|
+
)
|
17
|
+
|
18
|
+
export default GaugeDisableAnimation
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Gauge } from '../../'
|
3
|
+
|
4
|
+
const data = [
|
5
|
+
{ name: 'Capacity', value: 75 },
|
6
|
+
]
|
7
|
+
|
8
|
+
const GaugeFullCircle = () => (
|
9
|
+
<div>
|
10
|
+
<Gauge
|
11
|
+
chartData={data}
|
12
|
+
fullCircle
|
13
|
+
id="gauge-full-circle"
|
14
|
+
suffix="%"
|
15
|
+
title="Seating Capacity"
|
16
|
+
/>
|
17
|
+
</div>
|
18
|
+
)
|
19
|
+
|
20
|
+
export default GaugeFullCircle
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= pb_rails("gauge", props: {
|
2
|
+
id: "gauge-height-px",
|
3
|
+
chart_data: [{ name: "Pixels", value: 400 }],
|
4
|
+
height: '400',
|
5
|
+
title: "Fixed Height in Pixels",
|
6
|
+
suffix: "px"
|
7
|
+
}) %>
|
8
|
+
|
9
|
+
<%= pb_rails("gauge", props: {
|
10
|
+
id: "gauge-height-percent",
|
11
|
+
chart_data: [{ name: "Percentage", value: 45 }],
|
12
|
+
height: '45%',
|
13
|
+
title: "Height as Percentage of Width",
|
14
|
+
suffix: "%"
|
15
|
+
}) %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Gauge } from '../../'
|
3
|
+
|
4
|
+
const GaugeHeight = () => (
|
5
|
+
<div>
|
6
|
+
<Gauge
|
7
|
+
chartData={[ { name: 'Pixels', value: 400 } ]}
|
8
|
+
height="400"
|
9
|
+
id="gauge-height-px"
|
10
|
+
suffix="px"
|
11
|
+
title="Fixed Height in Pixels"
|
12
|
+
/>
|
13
|
+
<Gauge
|
14
|
+
chartData={[ { name: 'Percentage', value: 45 } ]}
|
15
|
+
height="45%"
|
16
|
+
id="gauge-height-percent"
|
17
|
+
suffix="%"
|
18
|
+
title="Height as Percentage of Width"
|
19
|
+
/>
|
20
|
+
</div>
|
21
|
+
)
|
22
|
+
|
23
|
+
export default GaugeHeight
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Button, Gauge } from '../../'
|
3
|
+
|
4
|
+
const GaugeLiveData = () => {
|
5
|
+
const [value, setValue] = useState(50)
|
6
|
+
const [name, setName] = useState('Name')
|
7
|
+
|
8
|
+
const updateValue = () => {
|
9
|
+
setValue(Math.floor(Math.random() * 100))
|
10
|
+
}
|
11
|
+
const updateName = () => {
|
12
|
+
let index = namesArray.indexOf(name)
|
13
|
+
if (namesArray.indexOf(name) == 5) {
|
14
|
+
index = 0
|
15
|
+
} else {
|
16
|
+
index += 1
|
17
|
+
}
|
18
|
+
setName(namesArray[index])
|
19
|
+
}
|
20
|
+
const namesArray = ['Name', 'Windows', 'Doors', 'Roofing', 'Siding', 'Gutters']
|
21
|
+
|
22
|
+
return (
|
23
|
+
<div>
|
24
|
+
<Button
|
25
|
+
onClick={updateValue}
|
26
|
+
text="Update Value"
|
27
|
+
/>
|
28
|
+
<Button
|
29
|
+
onClick={updateName}
|
30
|
+
text="Update Name"
|
31
|
+
/>
|
32
|
+
<Gauge
|
33
|
+
chartData={[{ name: name, value: value }]}
|
34
|
+
id="gauge-live-data"
|
35
|
+
/>
|
36
|
+
</div>
|
37
|
+
)
|
38
|
+
}
|
39
|
+
|
40
|
+
export default GaugeLiveData
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Gauge } from '../../'
|
3
|
+
|
4
|
+
const data = [{
|
5
|
+
name: 'Rating', value: 4.5,
|
6
|
+
}]
|
7
|
+
|
8
|
+
const GaugeMinMax = () => (
|
9
|
+
<div>
|
10
|
+
<Gauge
|
11
|
+
chartData={data}
|
12
|
+
id="gauge-min-max"
|
13
|
+
max={5}
|
14
|
+
min={0}
|
15
|
+
showLabels
|
16
|
+
title="Product Rating"
|
17
|
+
/>
|
18
|
+
</div>
|
19
|
+
)
|
20
|
+
|
21
|
+
export default GaugeMinMax
|