playbook_ui 14.14.0 → 14.15.0.pre.alpha.PBNTR617addgriddisplayglobalprop6700
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/Components/RegularTableView.tsx +127 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +55 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +275 -0
- data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +143 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +66 -0
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +195 -0
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +45 -99
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +73 -0
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +52 -0
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +80 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +130 -7
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +153 -299
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +50 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.jsx +102 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.md +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_infinite_scroll.json +152002 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +2 -1
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +46 -31
- data/app/pb_kits/playbook/pb_currency/currency.html.erb +15 -8
- data/app/pb_kits/playbook/pb_currency/currency.rb +17 -2
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.html.erb +22 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.jsx +34 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_currency/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +4 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.md +3 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.html.erb +39 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.html.erb +39 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date_picker/index.ts +38 -0
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +5 -6
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +2 -0
- data/app/pb_kits/playbook/pb_dialog/index.js +75 -0
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +43 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +8 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +33 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +3 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +0 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +20 -37
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +20 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +24 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +6 -6
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +21 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +49 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +6 -0
- data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +20 -12
- data/app/pb_kits/playbook/pb_drawer/drawer.rb +49 -1
- data/app/pb_kits/playbook/pb_drawer/index.js +257 -0
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +5 -4
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +2 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +4 -3
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +9 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +4 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.html.erb +40 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +50 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.md +3 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +7 -1
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +71 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.jsx +17 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.jsx +61 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.test.jsx +39 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +7 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +45 -8
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.jsx +91 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.md +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +7 -1
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +13 -0
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +7 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.html.erb +11 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.jsx +37 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_rails.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_react.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb +11 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_overlay/index.js +61 -0
- data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +5 -3
- data/app/pb_kits/playbook/pb_overlay/overlay.rb +16 -1
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +12 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +6 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_hidden_inputs.html.erb +5 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_hidden_inputs.md +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +2 -2
- data/app/pb_kits/playbook/pb_popover/popover.test.js +1 -1
- data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +2 -2
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +85 -74
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +60 -0
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.md +1 -0
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_radio/radio.test.js +16 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +58 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.md +1 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_select/index.js +38 -0
- data/app/pb_kits/playbook/pb_select/select.html.erb +3 -5
- data/app/pb_kits/playbook/pb_select/select.rb +8 -0
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -5
- data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +1 -4
- data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +1 -5
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +2 -3
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +2 -2
- data/app/pb_kits/playbook/pb_title/_title.scss +32 -0
- data/app/pb_kits/playbook/pb_title/_title.tsx +10 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_default.html.erb +1 -2
- data/app/pb_kits/playbook/pb_title/docs/_title_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.html.erb +7 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.jsx +54 -0
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.md +1 -0
- data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_title/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_title/title.rb +10 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +0 -3
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +25 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb +39 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon_rails.html.erb +22 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb +26 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +69 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.md +3 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +282 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +2 -2
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +10 -2
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +51 -5
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +5 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.html.erb +45 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.md +5 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.html.erb +33 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.md +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +66 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/index.ts +61 -8
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +17 -2
- data/app/pb_kits/playbook/tokens/_display.scss +3 -1
- data/app/pb_kits/playbook/utilities/_display.scss +6 -1
- data/app/pb_kits/playbook/utilities/object.test.js +99 -0
- data/app/pb_kits/playbook/utilities/object.ts +29 -1
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +1 -1
- data/dist/chunks/_typeahead-B8f4HM8I.js +36 -0
- data/dist/chunks/_weekday_stacked-BVO5G6au.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/{lib-D3us1bGD.js → lib-5OzNgeeu.js} +2 -2
- data/dist/chunks/{pb_form_validation-BpihMSOQ.js → pb_form_validation-DGhKbZtO.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +4 -4
- 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/display.rb +2 -2
- data/lib/playbook/forms/builder/time_zone_select_field.rb +19 -0
- data/lib/playbook/forms/builder.rb +1 -0
- data/lib/playbook/version.rb +2 -2
- metadata +80 -8
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.erb +0 -10
- data/dist/chunks/_typeahead-PqkcDf1H.js +0 -36
- data/dist/chunks/_weekday_stacked-B_pw5Znc.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { map } from 'lodash'
|
|
3
|
+
import { isEmpty, omitBy } from '../../utilities/object'
|
|
3
4
|
|
|
4
5
|
import Body from '../../pb_body/_body'
|
|
5
6
|
import Caption from '../../pb_caption/_caption'
|
|
@@ -40,13 +41,13 @@ const CurrentFilters = ({ dark, filters }: CurrentFiltersProps): React.ReactElem
|
|
|
40
41
|
className="filter"
|
|
41
42
|
key={`filter-${name}`}
|
|
42
43
|
>
|
|
43
|
-
{ value === true ?
|
|
44
|
+
{ value === true ?
|
|
44
45
|
<Title
|
|
45
46
|
dark={dark}
|
|
46
47
|
size={4}
|
|
47
48
|
tag="h4"
|
|
48
49
|
text={name}
|
|
49
|
-
/> :
|
|
50
|
+
/> :
|
|
50
51
|
<div>
|
|
51
52
|
<Caption
|
|
52
53
|
dark={dark}
|
|
@@ -58,7 +59,7 @@ const CurrentFilters = ({ dark, filters }: CurrentFiltersProps): React.ReactElem
|
|
|
58
59
|
tag="h4"
|
|
59
60
|
text={value}
|
|
60
61
|
/>
|
|
61
|
-
</div>
|
|
62
|
+
</div>
|
|
62
63
|
}
|
|
63
64
|
</div>
|
|
64
65
|
))}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { isEmpty } from '
|
|
2
|
+
import { isEmpty } from '../../utilities/object'
|
|
3
3
|
|
|
4
4
|
import Flex from '../../pb_flex/_flex'
|
|
5
5
|
|
|
@@ -46,7 +46,7 @@ const FilterSingle = ({
|
|
|
46
46
|
paddingRight="lg"
|
|
47
47
|
vertical="center"
|
|
48
48
|
>
|
|
49
|
-
{ children &&
|
|
49
|
+
{ children &&
|
|
50
50
|
<>
|
|
51
51
|
<FiltersPopover
|
|
52
52
|
dark={dark}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
|
|
26
26
|
<%= form.typeahead :example_typeahead, props: { data: { typeahead_example1: true, user: {} }, label: true, placeholder: "Search for a user" } %>
|
|
27
27
|
<%= form.text_field :example_text_field, props: { label: true } %>
|
|
28
|
-
<%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
|
|
28
|
+
<%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field", hidden_inputs: true } %>
|
|
29
29
|
<%= form.email_field :example_email_field, props: { label: true } %>
|
|
30
30
|
<%= form.number_field :example_number_field, props: { label: true } %>
|
|
31
31
|
<%= form.search_field :example_search_field, props: { label: true } %>
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
%>
|
|
47
47
|
<%= form.date_picker :example_date_picker_1, props: { label: true } %>
|
|
48
48
|
<%= form.star_rating_field :example_star_rating, props: { variant: "interactive", label: true } %>
|
|
49
|
+
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true } %>
|
|
49
50
|
|
|
50
51
|
<%= form.actions do |action| %>
|
|
51
52
|
<%= action.submit %>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<%= pb_form_with(scope: :example, method: :get, url: "", validate: true) do |form| %>
|
|
25
25
|
<%= form.typeahead :example_typeahead_validation, props: { data: { typeahead_example2: true, user: {} }, label: true, placeholder: "Search for a user", required: true, validation: { message: "Please select a user." } } %>
|
|
26
26
|
<%= form.text_field :example_text_field_validation, props: { label: true, required: true } %>
|
|
27
|
-
<%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field" } %>
|
|
27
|
+
<%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field", hidden_inputs: true } %>
|
|
28
28
|
<%= form.email_field :example_email_field_validation, props: { label: true, required: true } %>
|
|
29
29
|
<%= form.number_field :example_number_field_validation, props: { label: true, required: true } %>
|
|
30
30
|
<%= form.search_field :example_project_number_validation, props: { label: true, required: true, validation: { pattern: "[0-9]{2}-[0-9]{5}", message: "Please enter a valid project number (example: 33-12345)." } } %>
|
|
@@ -32,11 +32,12 @@
|
|
|
32
32
|
<%= form.url_field :example_url_field_validation, props: { label: true, required: true } %>
|
|
33
33
|
<%= form.text_area :example_text_area_validation, props: { label: true, required: true } %>
|
|
34
34
|
<%= form.dropdown_field :example_dropdown_validation, props: { label: true, options: example_dropdown_options, required: true } %>
|
|
35
|
-
<%= form.select :example_select_validation, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true } %>
|
|
35
|
+
<%= form.select :example_select_validation, [ ["Yes", 1], ["No", 2] ], props: { label: true, blank_selection: "Select One...", required: true, validation_message: "Please, select an option." } %>
|
|
36
36
|
<%= form.collection_select :example_collection_select_validation, example_collection, :value, :name, props: { label: true, blank_selection: "Select One...", required: true } %>
|
|
37
37
|
<%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
|
|
38
|
-
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true } %>
|
|
38
|
+
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true, validation_message: "Please, select a date.", allow_input: true } %>
|
|
39
39
|
<%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
|
|
40
|
+
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true, blank_selection: "Select a Time Zone...", required: true } %>
|
|
40
41
|
|
|
41
42
|
<%= form.actions do |action| %>
|
|
42
43
|
<%= action.submit %>
|
|
@@ -23,6 +23,13 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
|
23
23
|
.pb_form_pill_text, .pb_form_pill_close, .pb_form_pill_tag{
|
|
24
24
|
font-size: $font_small !important;
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
&[class*=wrapped] {
|
|
28
|
+
height: max-content;
|
|
29
|
+
padding-top: $space-xxs;
|
|
30
|
+
padding-bottom: $space-xxs;
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
@each $color_name, $color_value in $form_pill_colors {
|
|
27
34
|
&[class*=_#{$color_name}] {
|
|
28
35
|
background-color: mix($color_value, $card_light, 10%);
|
|
@@ -142,7 +149,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
|
142
149
|
height: 12px !important;
|
|
143
150
|
width: 12px !important;
|
|
144
151
|
padding-right: $space_xs;
|
|
145
|
-
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
|
152
|
+
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
|
146
153
|
+ .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
|
|
147
154
|
+ div .pb_form_pill_text, + div .pb_form_pill_tag {
|
|
148
155
|
padding-left: 0;
|
|
@@ -171,7 +178,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
|
171
178
|
}
|
|
172
179
|
.pb_form_pill_icon {
|
|
173
180
|
padding-right: $space_xxs;
|
|
174
|
-
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
|
181
|
+
+ .pb_form_pill_text, + .pb_form_pill_tag,
|
|
175
182
|
+ .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
|
|
176
183
|
+ div .pb_form_pill_text, + div .pb_form_pill_tag {
|
|
177
184
|
padding-left: 0;
|
|
@@ -22,6 +22,7 @@ type FormPillProps = {
|
|
|
22
22
|
data?: {[key: string]: string},
|
|
23
23
|
tabIndex?: number,
|
|
24
24
|
icon?: string,
|
|
25
|
+
wrapped?: boolean,
|
|
25
26
|
closeProps?: {
|
|
26
27
|
onClick?: React.MouseEventHandler<HTMLSpanElement>,
|
|
27
28
|
onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
|
|
@@ -38,6 +39,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
|
38
39
|
onClick = () => undefined,
|
|
39
40
|
avatarUrl,
|
|
40
41
|
closeProps = {},
|
|
42
|
+
wrapped,
|
|
41
43
|
size = '',
|
|
42
44
|
textTransform = 'none',
|
|
43
45
|
color = "primary",
|
|
@@ -48,6 +50,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
|
48
50
|
|
|
49
51
|
const iconClass = icon ? "_icon" : ""
|
|
50
52
|
const closeIconSize = size === "small" ? "xs" : "sm"
|
|
53
|
+
const wrappedClass = wrapped ? "wrapped" : ""
|
|
51
54
|
|
|
52
55
|
const filteredProps: FormPillProps = {...props}
|
|
53
56
|
delete filteredProps.truncate
|
|
@@ -55,6 +58,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
|
|
|
55
58
|
const css = classnames(
|
|
56
59
|
`pb_form_pill_kit_${color}${iconClass}`,
|
|
57
60
|
globalProps(filteredProps),
|
|
61
|
+
wrappedClass,
|
|
58
62
|
className,
|
|
59
63
|
size === 'small' ? 'small' : null,
|
|
60
64
|
textTransform,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<%
|
|
2
|
+
names = [
|
|
3
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
|
4
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
|
5
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
|
6
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
|
7
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
|
8
|
+
]
|
|
9
|
+
%>
|
|
10
|
+
|
|
11
|
+
<%= pb_rails("typeahead", props: {
|
|
12
|
+
html_options: { style: { maxWidth: "240px" }},
|
|
13
|
+
id: "typeahead-form-pill",
|
|
14
|
+
is_multi: true,
|
|
15
|
+
options: names,
|
|
16
|
+
label: "Wrapped Within Typeahead",
|
|
17
|
+
pills: true,
|
|
18
|
+
wrapped: true,
|
|
19
|
+
}) %>
|
|
20
|
+
|
|
21
|
+
<%= pb_rails("caption", props: { text: "Form Pill Wrapped Text" }) %>
|
|
22
|
+
<%= pb_rails("card", props: { max_width: "xs" }) do %>
|
|
23
|
+
<%= pb_rails("form_pill", props: {
|
|
24
|
+
name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo",
|
|
25
|
+
avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
|
|
26
|
+
tabindex: 0,
|
|
27
|
+
wrapped: true,
|
|
28
|
+
}) %>
|
|
29
|
+
<%= pb_rails("form_pill", props: {
|
|
30
|
+
icon: "badge-check",
|
|
31
|
+
text: "icon and a very long tag to show wrapped text",
|
|
32
|
+
tabindex: 0,
|
|
33
|
+
wrapped: true,
|
|
34
|
+
}) %>
|
|
35
|
+
<%= pb_rails("form_pill", props: {
|
|
36
|
+
text: "form pill long tag no tooltip show wrapped text",
|
|
37
|
+
tabindex: 0,
|
|
38
|
+
wrapped: true,
|
|
39
|
+
}) %>
|
|
40
|
+
<% end %>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Card, Caption, FormPill, Typeahead } from 'playbook-ui'
|
|
3
|
+
|
|
4
|
+
const names = [
|
|
5
|
+
{ label: 'Alexander Nathaniel Montgomery', value: 'Alexander Nathaniel Montgomery' },
|
|
6
|
+
{ label: 'Isabella Anastasia Wellington', value: 'Isabella Anastasia Wellington' },
|
|
7
|
+
{ label: 'Christopher Maximilian Harrington', value: 'Christopher Maximilian Harrington' },
|
|
8
|
+
{ label: 'Elizabeth Seraphina Kensington', value: 'Elizabeth Seraphina Kensington' },
|
|
9
|
+
{ label: 'Theodore Jonathan Abernathy', value: 'Theodore Jonathan Abernathy' },
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
const FormPillWrapped = (props) => {
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<Typeahead
|
|
16
|
+
htmlOptions={{ style: { maxWidth: "240px" } }}
|
|
17
|
+
isMulti
|
|
18
|
+
label="Wrapped Within Typeahead"
|
|
19
|
+
options={names}
|
|
20
|
+
wrapped
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
<Caption text="Form Pill Wrapped Text"/>
|
|
24
|
+
<Card maxWidth="xs">
|
|
25
|
+
<FormPill
|
|
26
|
+
avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
|
|
27
|
+
name="Princess Amelia Mignonette Grimaldi Thermopolis Renaldo"
|
|
28
|
+
onClick={() => alert('Click!')}
|
|
29
|
+
tabIndex={0}
|
|
30
|
+
wrapped
|
|
31
|
+
/>
|
|
32
|
+
<FormPill
|
|
33
|
+
icon="badge-check"
|
|
34
|
+
onClick={() => {alert('Click!')}}
|
|
35
|
+
tabIndex={0}
|
|
36
|
+
text="icon and a very long tag to show wrapped text"
|
|
37
|
+
wrapped
|
|
38
|
+
/>
|
|
39
|
+
<FormPill
|
|
40
|
+
onClick={() => {alert('Click!')}}
|
|
41
|
+
tabIndex={0}
|
|
42
|
+
text="form pill with a very long tag to show wrapped text"
|
|
43
|
+
wrapped
|
|
44
|
+
/>
|
|
45
|
+
</Card>
|
|
46
|
+
</>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default FormPillWrapped
|
|
@@ -4,6 +4,7 @@ examples:
|
|
|
4
4
|
- form_pill_user: Form Pill User
|
|
5
5
|
- form_pill_size: Form Pill Size
|
|
6
6
|
- form_pill_truncated_text: Truncated Text
|
|
7
|
+
- form_pill_wrapped: Wrapped Text
|
|
7
8
|
- form_pill_tag: Form Pill Tag
|
|
8
9
|
- form_pill_example: Example
|
|
9
10
|
- form_pill_icon: Form Pill Icon
|
|
@@ -13,6 +14,7 @@ examples:
|
|
|
13
14
|
- form_pill_user: Form Pill User
|
|
14
15
|
- form_pill_size: Form Pill Size
|
|
15
16
|
- form_pill_truncated_text: Truncated Text
|
|
17
|
+
- form_pill_wrapped: Wrapped Text
|
|
16
18
|
- form_pill_tag: Form Pill Tag
|
|
17
19
|
- form_pill_example: Example
|
|
18
20
|
- form_pill_icon: Form Pill Icon
|
|
@@ -5,3 +5,4 @@ export { default as FormPillExample } from './_form_pill_example.jsx'
|
|
|
5
5
|
export { default as FormPillIcon } from './_form_pill_icon.jsx'
|
|
6
6
|
export { default as FormPillColors } from './_form_pill_colors.jsx'
|
|
7
7
|
export { default as FormPillTruncatedText } from './_form_pill_truncated_text.jsx'
|
|
8
|
+
export { default as FormPillWrapped } from './_form_pill_wrapped.jsx'
|
|
@@ -16,9 +16,11 @@ module Playbook
|
|
|
16
16
|
default: "primary"
|
|
17
17
|
prop :tabindex
|
|
18
18
|
prop :icon
|
|
19
|
+
prop :wrapped, type: Playbook::Props::Boolean,
|
|
20
|
+
default: false
|
|
19
21
|
|
|
20
22
|
def classname
|
|
21
|
-
generate_classname("pb_form_pill_kit", color, icon_class, name, text, text_transform)
|
|
23
|
+
generate_classname("pb_form_pill_kit", color, icon_class, name, text, text_transform, wrapped_class)
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
def display_text
|
|
@@ -36,6 +38,10 @@ module Playbook
|
|
|
36
38
|
def close_icon_size
|
|
37
39
|
size == "small" ? "xs" : "sm"
|
|
38
40
|
end
|
|
41
|
+
|
|
42
|
+
def wrapped_class
|
|
43
|
+
wrapped ? "wrapped" : nil
|
|
44
|
+
end
|
|
39
45
|
end
|
|
40
46
|
end
|
|
41
47
|
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import classnames from 'classnames'
|
|
4
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
5
|
+
import { globalProps } from '../utilities/globalProps'
|
|
6
|
+
|
|
7
|
+
import Button from '../pb_button/_button'
|
|
8
|
+
import Icon from '../pb_icon/_icon'
|
|
9
|
+
import { IconSizes } from "../pb_icon/_icon"
|
|
10
|
+
|
|
11
|
+
type IconButtonProps = {
|
|
12
|
+
aria?: { [key: string]: string },
|
|
13
|
+
className?: string,
|
|
14
|
+
data?: { [key: string]: string },
|
|
15
|
+
htmlType?: 'submit' | 'reset' | 'button' | undefined,
|
|
16
|
+
icon?: string,
|
|
17
|
+
id?: string,
|
|
18
|
+
link?: string,
|
|
19
|
+
newWindow?: boolean,
|
|
20
|
+
size?: IconSizes,
|
|
21
|
+
target?: string,
|
|
22
|
+
variant?: 'default' | 'link',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const IconButton = (props: IconButtonProps) => {
|
|
26
|
+
const {
|
|
27
|
+
aria = {},
|
|
28
|
+
className,
|
|
29
|
+
data = {},
|
|
30
|
+
htmlType = 'button',
|
|
31
|
+
icon = 'bars',
|
|
32
|
+
id,
|
|
33
|
+
link,
|
|
34
|
+
newWindow = false,
|
|
35
|
+
size = "2x",
|
|
36
|
+
target,
|
|
37
|
+
variant = "default",
|
|
38
|
+
} = props
|
|
39
|
+
|
|
40
|
+
const ariaProps = buildAriaProps(aria)
|
|
41
|
+
const dataProps = buildDataProps(data)
|
|
42
|
+
const classes = classnames(buildCss('pb_icon_button_kit', variant), globalProps(props), className)
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
{...ariaProps}
|
|
47
|
+
{...dataProps}
|
|
48
|
+
className={classes}
|
|
49
|
+
id={id}
|
|
50
|
+
>
|
|
51
|
+
<Button
|
|
52
|
+
borderRadius="xs"
|
|
53
|
+
htmlType={htmlType}
|
|
54
|
+
link={link}
|
|
55
|
+
newWindow={newWindow}
|
|
56
|
+
target={target}
|
|
57
|
+
>
|
|
58
|
+
<Icon
|
|
59
|
+
className="icon_button_icon"
|
|
60
|
+
fixedWidth
|
|
61
|
+
icon={icon}
|
|
62
|
+
paddingX="xxs"
|
|
63
|
+
paddingY="xs"
|
|
64
|
+
size={size}
|
|
65
|
+
/>
|
|
66
|
+
</Button>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default IconButton
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { IconButton } from 'playbook-ui'
|
|
3
|
+
|
|
4
|
+
const IconButtonDefault = (props) => (
|
|
5
|
+
<div>
|
|
6
|
+
<IconButton
|
|
7
|
+
{...props}
|
|
8
|
+
/>
|
|
9
|
+
<IconButton
|
|
10
|
+
{...props}
|
|
11
|
+
marginTop="md"
|
|
12
|
+
variant="link"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
export default IconButtonDefault
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { IconButton, Flex } from 'playbook-ui'
|
|
3
|
+
|
|
4
|
+
const IconButtonSizes = (props) => (
|
|
5
|
+
<div>
|
|
6
|
+
<Flex align="center">
|
|
7
|
+
<IconButton
|
|
8
|
+
{...props}
|
|
9
|
+
size="lg"
|
|
10
|
+
/>
|
|
11
|
+
<span>Large</span>
|
|
12
|
+
</Flex>
|
|
13
|
+
<Flex align="center">
|
|
14
|
+
<IconButton
|
|
15
|
+
{...props}
|
|
16
|
+
size="sm"
|
|
17
|
+
/>
|
|
18
|
+
<span>Small</span>
|
|
19
|
+
</Flex>
|
|
20
|
+
<Flex align="center">
|
|
21
|
+
<IconButton
|
|
22
|
+
{...props}
|
|
23
|
+
size="xs"
|
|
24
|
+
/>
|
|
25
|
+
<span>XSmall</span>
|
|
26
|
+
</Flex>
|
|
27
|
+
<Flex
|
|
28
|
+
align="center"
|
|
29
|
+
marginTop="md"
|
|
30
|
+
>
|
|
31
|
+
<IconButton
|
|
32
|
+
{...props}
|
|
33
|
+
size="1x"
|
|
34
|
+
/>
|
|
35
|
+
<span>1x</span>
|
|
36
|
+
</Flex>
|
|
37
|
+
<Flex align="center">
|
|
38
|
+
<IconButton
|
|
39
|
+
{...props}
|
|
40
|
+
size="2x"
|
|
41
|
+
/>
|
|
42
|
+
<span>2x</span>
|
|
43
|
+
</Flex>
|
|
44
|
+
<Flex align="center">
|
|
45
|
+
<IconButton
|
|
46
|
+
{...props}
|
|
47
|
+
size="3x"
|
|
48
|
+
/>
|
|
49
|
+
<span>3x</span>
|
|
50
|
+
</Flex>
|
|
51
|
+
<Flex align="center">
|
|
52
|
+
<IconButton
|
|
53
|
+
{...props}
|
|
54
|
+
size="4x"
|
|
55
|
+
/>
|
|
56
|
+
<span>4x</span>
|
|
57
|
+
</Flex>
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
export default IconButtonSizes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ensureAccessible, renderKit } from '../utilities/test-utils'
|
|
2
|
+
|
|
3
|
+
import { IconButton } from 'playbook-ui'
|
|
4
|
+
|
|
5
|
+
const props = {
|
|
6
|
+
data: { testid: 'default', icon: 'plus' }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
test('default test', () => {
|
|
10
|
+
const kit = renderKit(IconButton, props)
|
|
11
|
+
|
|
12
|
+
expect(kit).toBeInTheDocument()
|
|
13
|
+
expect(kit).toHaveClass('pb_icon_button_kit_default')
|
|
14
|
+
|
|
15
|
+
const iconElement = kit.querySelector('.icon_button_icon')
|
|
16
|
+
expect(iconElement).toBeInTheDocument()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it("should be accessible", async () => {
|
|
20
|
+
ensureAccessible(IconButton, props)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('passes link variant prop', () => {
|
|
24
|
+
const kit = renderKit(IconButton, { ...props, variant: "link" })
|
|
25
|
+
expect(kit).toBeInTheDocument()
|
|
26
|
+
expect(kit).toHaveClass('pb_icon_button_kit_link')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('should set button type to "submit" when htmlType prop is passed', () => {
|
|
30
|
+
const kit = renderKit(IconButton, { ...props, htmlType: 'submit' })
|
|
31
|
+
const buttonElement = kit.querySelector('button')
|
|
32
|
+
expect(buttonElement).toHaveAttribute('type', 'submit')
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test('passes custom classname', () => {
|
|
36
|
+
const kit = renderKit(IconButton, { ...props, className: "extra_class" })
|
|
37
|
+
expect(kit).toBeInTheDocument()
|
|
38
|
+
expect(kit).toHaveClass('pb_icon_button_kit_default extra_class')
|
|
39
|
+
})
|