playbook_ui 13.32.0.pre.alpha.PBNTR405dropdownformfixesrails3301 → 13.32.0.pre.alpha.PLAY1138iconkitaddcolorprop3268
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_bar_graph/docs/_bar_graph_custom.md +0 -4
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +7 -12
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +4 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +0 -11
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +1 -1
- data/app/pb_kits/playbook/pb_dropdown/index.js +17 -75
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +5 -108
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +2 -11
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_example.html.erb +1 -5
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_example.jsx +0 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_size.html.erb +0 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_size.jsx +0 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_tag.html.erb +1 -4
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_tag.jsx +2 -3
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_user.html.erb +0 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_user.jsx +0 -2
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -5
- data/app/pb_kits/playbook/pb_icon/_icon.scss +27 -210
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +44 -100
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +7 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +46 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.md +1 -0
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_icon/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +28 -34
- data/app/pb_kits/playbook/pb_icon/icon_aliases.json +39 -0
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +2 -2
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_nav/nav.rb +0 -9
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +1 -1
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +2 -11
- data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +5 -25
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +0 -6
- data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/index.ts +4 -4
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_cell.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/table.test.js +0 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +27 -45
- data/app/pb_kits/playbook/pb_textarea/index.tsx +3 -3
- data/app/pb_kits/playbook/pb_time/_time.tsx +3 -3
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
- data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +10 -10
- data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +2 -2
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +2 -1
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +0 -2
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -3
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +4 -4
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +7 -11
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +3 -8
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +1 -6
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +19 -18
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +6 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +6 -6
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +3 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default.html.erb +57 -22
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -2
- data/app/pb_kits/playbook/pb_typeahead/index.ts +31 -31
- data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +6 -6
- data/app/pb_kits/playbook/pb_user_badge/badges/million-dollar.tsx +235 -236
- data/app/pb_kits/playbook/pb_user_badge/badges/veteran.tsx +1 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +63 -68
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +2 -2
- data/app/pb_kits/playbook/playbook-rails.js +0 -6
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/forms/builder.rb +0 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -13
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.jsx +0 -31
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.jsx +0 -31
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.test.jsx +0 -53
- data/app/pb_kits/playbook/pb_nav/docs/_tab_nav.html.erb +0 -48
- data/app/pb_kits/playbook/pb_nav/docs/_tab_nav.md +0 -3
- data/app/pb_kits/playbook/pb_nav/index.js +0 -43
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.html.erb +0 -1
- data/app/pb_kits/playbook/pb_star_rating/index.js +0 -50
- data/lib/playbook/forms/builder/star_rating_field.rb +0 -14
@@ -14,7 +14,6 @@ module Playbook
|
|
14
14
|
require_relative "builder/multi_level_select_field"
|
15
15
|
require_relative "builder/phone_number_field"
|
16
16
|
require_relative "builder/dropdown_field"
|
17
|
-
require_relative "builder/star_rating_field"
|
18
17
|
|
19
18
|
prepend(FormFieldBuilder.new(:email_field, kit_name: "text_input"))
|
20
19
|
prepend(FormFieldBuilder.new(:number_field, kit_name: "text_input"))
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.32.0.pre.alpha.
|
4
|
+
version: 13.32.0.pre.alpha.PLAY1138iconkitaddcolorprop3268
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-07-
|
12
|
+
date: 2024-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -1101,13 +1101,9 @@ files:
|
|
1101
1101
|
- app/pb_kits/playbook/pb_dropdown/_dropdown.scss
|
1102
1102
|
- app/pb_kits/playbook/pb_dropdown/_dropdown.tsx
|
1103
1103
|
- app/pb_kits/playbook/pb_dropdown/context/index.tsx
|
1104
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.html.erb
|
1105
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.jsx
|
1106
1104
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.html.erb
|
1107
1105
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx
|
1108
1106
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md
|
1109
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.html.erb
|
1110
|
-
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.jsx
|
1111
1107
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb
|
1112
1108
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx
|
1113
1109
|
- app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.jsx
|
@@ -1327,7 +1323,6 @@ files:
|
|
1327
1323
|
- app/pb_kits/playbook/pb_form_group/form_group.rb
|
1328
1324
|
- app/pb_kits/playbook/pb_form_group/form_group.test.js
|
1329
1325
|
- app/pb_kits/playbook/pb_form_pill/_form_pill.scss
|
1330
|
-
- app/pb_kits/playbook/pb_form_pill/_form_pill.test.jsx
|
1331
1326
|
- app/pb_kits/playbook/pb_form_pill/_form_pill.tsx
|
1332
1327
|
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_example.html.erb
|
1333
1328
|
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_example.jsx
|
@@ -1437,6 +1432,9 @@ files:
|
|
1437
1432
|
- app/pb_kits/playbook/pb_icon/docs/_icon_border.html.erb
|
1438
1433
|
- app/pb_kits/playbook/pb_icon/docs/_icon_border.jsx
|
1439
1434
|
- app/pb_kits/playbook/pb_icon/docs/_icon_border_swift.md
|
1435
|
+
- app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb
|
1436
|
+
- app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx
|
1437
|
+
- app/pb_kits/playbook/pb_icon/docs/_icon_color.md
|
1440
1438
|
- app/pb_kits/playbook/pb_icon/docs/_icon_custom.html.erb
|
1441
1439
|
- app/pb_kits/playbook/pb_icon/docs/_icon_custom.jsx
|
1442
1440
|
- app/pb_kits/playbook/pb_icon/docs/_icon_custom.md
|
@@ -1464,6 +1462,7 @@ files:
|
|
1464
1462
|
- app/pb_kits/playbook/pb_icon/icon.html.erb
|
1465
1463
|
- app/pb_kits/playbook/pb_icon/icon.rb
|
1466
1464
|
- app/pb_kits/playbook/pb_icon/icon.test.js
|
1465
|
+
- app/pb_kits/playbook/pb_icon/icon_aliases.json
|
1467
1466
|
- app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss
|
1468
1467
|
- app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx
|
1469
1468
|
- app/pb_kits/playbook/pb_icon_circle/docs/_description.md
|
@@ -1874,8 +1873,6 @@ files:
|
|
1874
1873
|
- app/pb_kits/playbook/pb_nav/docs/_subtle_no_highlight_nav.jsx
|
1875
1874
|
- app/pb_kits/playbook/pb_nav/docs/_subtle_with_icons_nav.html.erb
|
1876
1875
|
- app/pb_kits/playbook/pb_nav/docs/_subtle_with_icons_nav.jsx
|
1877
|
-
- app/pb_kits/playbook/pb_nav/docs/_tab_nav.html.erb
|
1878
|
-
- app/pb_kits/playbook/pb_nav/docs/_tab_nav.md
|
1879
1876
|
- app/pb_kits/playbook/pb_nav/docs/_with_icons_nav.html.erb
|
1880
1877
|
- app/pb_kits/playbook/pb_nav/docs/_with_icons_nav.jsx
|
1881
1878
|
- app/pb_kits/playbook/pb_nav/docs/_with_img_nav.html.erb
|
@@ -1883,7 +1880,6 @@ files:
|
|
1883
1880
|
- app/pb_kits/playbook/pb_nav/docs/_with_img_nav.md
|
1884
1881
|
- app/pb_kits/playbook/pb_nav/docs/example.yml
|
1885
1882
|
- app/pb_kits/playbook/pb_nav/docs/index.js
|
1886
|
-
- app/pb_kits/playbook/pb_nav/index.js
|
1887
1883
|
- app/pb_kits/playbook/pb_nav/item.html.erb
|
1888
1884
|
- app/pb_kits/playbook/pb_nav/item.rb
|
1889
1885
|
- app/pb_kits/playbook/pb_nav/nav.html.erb
|
@@ -2338,14 +2334,12 @@ files:
|
|
2338
2334
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.jsx
|
2339
2335
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.html.erb
|
2340
2336
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx
|
2341
|
-
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.html.erb
|
2342
2337
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.html.erb
|
2343
2338
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.jsx
|
2344
2339
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.html.erb
|
2345
2340
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.jsx
|
2346
2341
|
- app/pb_kits/playbook/pb_star_rating/docs/example.yml
|
2347
2342
|
- app/pb_kits/playbook/pb_star_rating/docs/index.js
|
2348
|
-
- app/pb_kits/playbook/pb_star_rating/index.js
|
2349
2343
|
- app/pb_kits/playbook/pb_star_rating/star_rating.html.erb
|
2350
2344
|
- app/pb_kits/playbook/pb_star_rating/star_rating.rb
|
2351
2345
|
- app/pb_kits/playbook/pb_star_rating/star_rating.test.js
|
@@ -3013,7 +3007,6 @@ files:
|
|
3013
3007
|
- lib/playbook/forms/builder/multi_level_select_field.rb
|
3014
3008
|
- lib/playbook/forms/builder/phone_number_field.rb
|
3015
3009
|
- lib/playbook/forms/builder/select_field.rb
|
3016
|
-
- lib/playbook/forms/builder/star_rating_field.rb
|
3017
3010
|
- lib/playbook/forms/builder/typeahead_field.rb
|
3018
3011
|
- lib/playbook/hover.rb
|
3019
3012
|
- lib/playbook/justify_content.rb
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
options = [
|
3
|
-
{ label: 'United States', value: 'United States', id: 'us' },
|
4
|
-
{ label: 'Canada', value: 'Canada', id: 'ca' },
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan', id: 'pk' },
|
6
|
-
]
|
7
|
-
|
8
|
-
%>
|
9
|
-
|
10
|
-
<%= pb_rails("dropdown", props: { blank_selection: "Select One...", options: options }) %>
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { Dropdown } from '../../'
|
3
|
-
|
4
|
-
const DropdownBlankSelection = (props) => {
|
5
|
-
const options = [
|
6
|
-
{
|
7
|
-
label: "United States",
|
8
|
-
value: "United States",
|
9
|
-
},
|
10
|
-
{
|
11
|
-
label: "Canada",
|
12
|
-
value: "Canada",
|
13
|
-
},
|
14
|
-
{
|
15
|
-
label: "Pakistan",
|
16
|
-
value: "Pakistan",
|
17
|
-
}
|
18
|
-
];
|
19
|
-
|
20
|
-
return (
|
21
|
-
<>
|
22
|
-
<Dropdown
|
23
|
-
blankSelection="Select one..."
|
24
|
-
options={options}
|
25
|
-
{...props}
|
26
|
-
/>
|
27
|
-
</>
|
28
|
-
)
|
29
|
-
}
|
30
|
-
|
31
|
-
export default DropdownBlankSelection
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
options = [
|
3
|
-
{ label: 'United States', value: 'United States', id: 'us' },
|
4
|
-
{ label: 'Canada', value: 'Canada', id: 'ca' },
|
5
|
-
{ label: 'Pakistan', value: 'Pakistan', id: 'pk' },
|
6
|
-
]
|
7
|
-
|
8
|
-
%>
|
9
|
-
|
10
|
-
<%= pb_rails("dropdown", props: {options: options, default_value: options.last}) %>
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { Dropdown } from '../../'
|
3
|
-
|
4
|
-
const DropdownDefaultValue = (props) => {
|
5
|
-
const options = [
|
6
|
-
{
|
7
|
-
label: "United States",
|
8
|
-
value: "United States",
|
9
|
-
},
|
10
|
-
{
|
11
|
-
label: "Canada",
|
12
|
-
value: "Canada",
|
13
|
-
},
|
14
|
-
{
|
15
|
-
label: "Pakistan",
|
16
|
-
value: "Pakistan",
|
17
|
-
}
|
18
|
-
];
|
19
|
-
|
20
|
-
return (
|
21
|
-
<>
|
22
|
-
<Dropdown
|
23
|
-
defaultValue={options[2]}
|
24
|
-
options={options}
|
25
|
-
{...props}
|
26
|
-
/>
|
27
|
-
</>
|
28
|
-
)
|
29
|
-
}
|
30
|
-
|
31
|
-
export default DropdownDefaultValue
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { render, screen } from '../utilities/test-utils';
|
3
|
-
import FormPill from './_form_pill';
|
4
|
-
|
5
|
-
const testId = 'formpill';
|
6
|
-
|
7
|
-
test('should render classname', () => {
|
8
|
-
render(
|
9
|
-
<FormPill
|
10
|
-
data={{ testid: testId }}
|
11
|
-
text="test"
|
12
|
-
/>
|
13
|
-
)
|
14
|
-
|
15
|
-
const kit = screen.getByTestId(testId)
|
16
|
-
expect(kit).toHaveClass('pb_form_pill_kit_primary none')
|
17
|
-
});
|
18
|
-
|
19
|
-
test('displays text content', () => {
|
20
|
-
render(
|
21
|
-
<FormPill
|
22
|
-
data={{ testid: testId }}
|
23
|
-
text="test"
|
24
|
-
/>
|
25
|
-
)
|
26
|
-
|
27
|
-
const text = screen.getByText("test")
|
28
|
-
expect(text).toBeInTheDocument()
|
29
|
-
});
|
30
|
-
|
31
|
-
test('displays color variant', () => {
|
32
|
-
render(
|
33
|
-
<FormPill
|
34
|
-
color={"neutral"}
|
35
|
-
data={{ testid: testId }}
|
36
|
-
text={"test"}
|
37
|
-
/>
|
38
|
-
)
|
39
|
-
const kit = screen.getByTestId(testId)
|
40
|
-
expect(kit).toHaveClass(`pb_form_pill_kit_neutral none`)
|
41
|
-
});
|
42
|
-
|
43
|
-
test('displays size variant', () => {
|
44
|
-
render(
|
45
|
-
<FormPill
|
46
|
-
data={{ testid: testId }}
|
47
|
-
size={"small"}
|
48
|
-
text={"test"}
|
49
|
-
/>
|
50
|
-
)
|
51
|
-
const kit = screen.getByTestId('formpill')
|
52
|
-
expect(kit).toHaveClass(`pb_form_pill_kit_primary small none`)
|
53
|
-
});
|
@@ -1,48 +0,0 @@
|
|
1
|
-
<%= pb_rails("nav", props: { orientation: "horizontal", tabbing: true, padding_bottom: "sm" }) do %>
|
2
|
-
<%= pb_rails("nav/item", props: { text: "About", active: true, data: { pb_tab_target: "about" }, cursor: "pointer" }) %>
|
3
|
-
<%= pb_rails("nav/item", props: { text: "Case Studies", data: { pb_tab_target: "case_studies" }, cursor: "pointer" }) %>
|
4
|
-
<%= pb_rails("nav/item", props: { text: "Service", data: { pb_tab_target: "service" }, cursor: "pointer" }) %>
|
5
|
-
<%= pb_rails("nav/item", props: { text: "Contacts", data: { pb_tab_target: "contacts" }, cursor: "pointer" }) %>
|
6
|
-
<% end %>
|
7
|
-
|
8
|
-
<div id="about">
|
9
|
-
<%= pb_rails("body", props: { text: "This is about!" }) %>
|
10
|
-
</div>
|
11
|
-
|
12
|
-
<div id="case_studies">
|
13
|
-
<%= pb_rails("body", props: { text: "This is case studies!" }) %>
|
14
|
-
</div>
|
15
|
-
|
16
|
-
<div id="service">
|
17
|
-
<%= pb_rails("body", props: { text: "This is service!" }) %>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<div id="contacts">
|
21
|
-
<%= pb_rails("body", props: { text: "This is contacts!" }) %>
|
22
|
-
</div>
|
23
|
-
|
24
|
-
<script>
|
25
|
-
// The script in the code snippet below is for demonstrating the active state and NOT needed for the kit to function.
|
26
|
-
// The active prop can be used to highlight this active state.
|
27
|
-
const navItemClass = "pb_nav_list_kit_item"
|
28
|
-
const navItemActiveClass = "pb_nav_list_kit_item_active"
|
29
|
-
const dataNavItems = "[data-pb-tab-target]"
|
30
|
-
|
31
|
-
const navItemTabs = document.querySelectorAll(dataNavItems)
|
32
|
-
navItemTabs.forEach(navItemTab => {
|
33
|
-
navItemTab.addEventListener("click", event => {
|
34
|
-
const navItemTabs = document.querySelectorAll(dataNavItems)
|
35
|
-
navItemTabs.forEach(navItemTab => {
|
36
|
-
if (navItemTab === event.target.closest(dataNavItems)) {
|
37
|
-
navItemTab.classList.add(navItemActiveClass)
|
38
|
-
navItemTab.classList.remove(navItemClass)
|
39
|
-
} else {
|
40
|
-
if (navItemTab.classList.contains(navItemActiveClass)) {
|
41
|
-
navItemTab.classList.remove(navItemActiveClass)
|
42
|
-
navItemTab.classList.add(navItemClass)
|
43
|
-
}
|
44
|
-
}
|
45
|
-
})
|
46
|
-
})
|
47
|
-
})
|
48
|
-
</script>
|
@@ -1,3 +0,0 @@
|
|
1
|
-
The Nav kit can also be used to create dynamic tabbing. To do so, use the boolean `tabbing` prop as shown here.
|
2
|
-
|
3
|
-
All divs you want to use as tabs MUST have an id attached to them. To link the tab to the nav, use the required data attribute `pb_tab_target` on each nav/item and pass it the id of the tab you want linked to that specific nav/item. See code example below to see this in action.
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import PbEnhancedElement from '../pb_enhanced_element'
|
2
|
-
|
3
|
-
const NAV_SELECTOR = '[data-pb-nav-tab]'
|
4
|
-
const NAV_ITEM_SELECTOR = '[data-pb-tab-target]'
|
5
|
-
|
6
|
-
export default class PbNav extends PbEnhancedElement {
|
7
|
-
static get selector() {
|
8
|
-
return NAV_SELECTOR
|
9
|
-
}
|
10
|
-
|
11
|
-
connect() {
|
12
|
-
this.hideAndAddEventListeners()
|
13
|
-
}
|
14
|
-
|
15
|
-
hideAndAddEventListeners() {
|
16
|
-
const navItems = this.element.querySelectorAll(NAV_ITEM_SELECTOR)
|
17
|
-
navItems.forEach((navItem) => {
|
18
|
-
if (!navItem.className.includes('active')) {
|
19
|
-
this.changeContentDisplay(navItem.dataset.pbTabTarget, 'none')
|
20
|
-
}
|
21
|
-
|
22
|
-
navItem.addEventListener('click', event => this.handleNavItemClick(event))
|
23
|
-
})
|
24
|
-
}
|
25
|
-
|
26
|
-
handleNavItemClick(event) {
|
27
|
-
event.preventDefault()
|
28
|
-
const navItem = event.target.closest(NAV_ITEM_SELECTOR)
|
29
|
-
this.changeContentDisplay(navItem.dataset.pbTabTarget, 'block')
|
30
|
-
|
31
|
-
const navItems = this.element.querySelectorAll(NAV_ITEM_SELECTOR)
|
32
|
-
navItems.forEach((navItemSelected) => {
|
33
|
-
if (navItem !== navItemSelected) {
|
34
|
-
this.changeContentDisplay(navItemSelected.dataset.pbTabTarget, 'none')
|
35
|
-
}
|
36
|
-
})
|
37
|
-
}
|
38
|
-
|
39
|
-
changeContentDisplay(contentId, display) {
|
40
|
-
const content = document.getElementById(contentId)
|
41
|
-
content.style.display = display
|
42
|
-
}
|
43
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= pb_rails("star_rating", props: { padding_bottom: "xs", variant: "interactive" }) %>
|
@@ -1,50 +0,0 @@
|
|
1
|
-
import PbEnhancedElement from "../pb_enhanced_element";
|
2
|
-
|
3
|
-
const STAR_RATING_SELECTOR = "[data-pb-star-rating]";
|
4
|
-
const STAR_RATING_INPUT_ID = "star-rating-input";
|
5
|
-
|
6
|
-
export default class PbStarRating extends PbEnhancedElement {
|
7
|
-
static get selector() {
|
8
|
-
return STAR_RATING_SELECTOR;
|
9
|
-
}
|
10
|
-
|
11
|
-
connect() {
|
12
|
-
this.element.addEventListener("click", (event) => {
|
13
|
-
const clickedStarId = event.currentTarget.id;
|
14
|
-
this.updateStarColors(clickedStarId);
|
15
|
-
this.updateHiddenInputValue(clickedStarId);
|
16
|
-
});
|
17
|
-
}
|
18
|
-
|
19
|
-
updateStarColors(clickedStarId) {
|
20
|
-
const allStars = document.querySelectorAll(STAR_RATING_SELECTOR);
|
21
|
-
|
22
|
-
allStars.forEach(star => {
|
23
|
-
const starId = star.id;
|
24
|
-
const icon = star.querySelector(".interactive-star-icon");
|
25
|
-
|
26
|
-
if (icon) {
|
27
|
-
if (starId <= clickedStarId) {
|
28
|
-
if (star.classList.contains("yellow_star")) {
|
29
|
-
icon.classList.add("yellow-star-selected");
|
30
|
-
} else if (star.classList.contains("primary_star")) {
|
31
|
-
icon.classList.add("primary-star-selected");
|
32
|
-
} else if (star.classList.contains("suble_star_light")) {
|
33
|
-
icon.classList.add("suble-star-selected");
|
34
|
-
} else {
|
35
|
-
icon.classList.add("yellow-star-selected");
|
36
|
-
}
|
37
|
-
} else {
|
38
|
-
icon.classList.remove("yellow-star-selected", "primary-star-selected", "suble-star-selected");
|
39
|
-
}
|
40
|
-
}
|
41
|
-
});
|
42
|
-
}
|
43
|
-
|
44
|
-
updateHiddenInputValue(value) {
|
45
|
-
const hiddenInput = document.getElementById(STAR_RATING_INPUT_ID);
|
46
|
-
if (hiddenInput) {
|
47
|
-
hiddenInput.value = value;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Playbook
|
4
|
-
module Forms
|
5
|
-
class Builder
|
6
|
-
def star_rating_field(name, props: {})
|
7
|
-
props[:name] = name
|
8
|
-
props[:margin_bottom] = "sm"
|
9
|
-
props[:label] = @template.label(@object_name, name) if props[:label] == true
|
10
|
-
@template.pb_rails("star_rating", props: props)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|