Skip to content

Add groups/dividers to PF4 select #1148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 14, 2021

Conversation

rvsia
Copy link
Contributor

@rvsia rvsia commented Oct 13, 2021

Fixes #1145

Description

Adds support for PF4 select group and divider objects.

Screenshot 2021-10-13 at 17 37 56

TODO:

  • tests
  • documentation

Schema (if applicable)

                schema={{fields:[
                    {
                        component: 'select',
                        name: 'select-with-categories',
                        label: 'With categories',
                        options: [
                            {
                                label: 'Category 1',
                                options: [
                                    { label: 'value 1', value: '111' },
                                    { label: 'value 2', value: '222' }
                                ]
                            },
                            {divider: true},
                            {label: 'independent 1', value: '1112333'},
                            {divider: true},
                            {
                                label: 'Category 2',
                                options: [
                                    { label: 'value 3', value: '333' },
                                    { label: 'value 4', value: '444' }
                                ]
                            },
                            {divider: true},
                            {label: 'independent 2', value: '11111'}
                        ]
                    }
                ]}}

@DataDrivenFormsBot
Copy link

A new version (feat) will be released: v3.15.0 [DataDrivenFormsBot]

@codecov
Copy link

codecov bot commented Oct 13, 2021

Codecov Report

Merging #1148 (9f4ce7b) into master (de36488) will decrease coverage by 0.00%.
The diff coverage is 94.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1148      +/-   ##
==========================================
- Coverage   94.91%   94.91%   -0.01%     
==========================================
  Files         208      209       +1     
  Lines        3542     3576      +34     
  Branches     1224     1243      +19     
==========================================
+ Hits         3362     3394      +32     
- Misses        180      182       +2     
Impacted Files Coverage Δ
packages/common/src/select/reducer.js 92.00% <83.33%> (-8.00%) ⬇️
...ges/pf4-component-mapper/src/select/select/menu.js 35.21% <93.33%> (+9.40%) ⬆️
packages/common/src/select/flat-options.js 100.00% <100.00%> (ø)
packages/common/src/select/select.js 97.61% <100.00%> (+0.11%) ⬆️
...s/pf4-component-mapper/src/select/select/select.js 89.36% <100.00%> (+1.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 834aaac...9f4ce7b. Read the comment docs.

@rvsia rvsia changed the title Pf4 select categories Add groups/dividers to PF4 select Oct 14, 2021
@rvsia rvsia force-pushed the pf4SelectCategories branch from ad42a37 to 04e124a Compare October 14, 2021 08:50
@rvsia rvsia marked this pull request as ready for review October 14, 2021 09:32
@rvsia rvsia requested a review from Hyperkid123 October 14, 2021 09:32
@rvsia rvsia added dependencies Dependency PR enhancement New feature or request PF4 PF4 pull request labels Oct 14, 2021
if (item.group) {
return (
<div className="pf-c-select__menu-group" key={`group-${index}`}>
<div className="pf-c-select__menu-group-title">{item.group}</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rvsia Looking at the PF4 implementation, they use nested lists in the select options menu. But here we have a flat structure. I think we might hear from QAs that this menu is composed accordingly. I personally don't care that much. Only reason that I can think of why the DOM should be nested is accessibility.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@rvsia rvsia merged commit 6bd0e4c into data-driven-forms:master Oct 14, 2021
@Hyperkid123
Copy link
Member

@steverhoades
Copy link
Contributor

steverhoades commented Oct 22, 2021

I am seeing this now when building, are you seeing the same by any chance? Only started after upgrading (took me awhile to do this).
v3.15.3

"export 'flatOptions' was not found in '@data-driven-forms/common/select'

Edit:
I see the issue. For some reason I have @data-driven-forms/common@3.12.1 installed. I haven't explicitly defined this package as a dependency which is strange.

@steverhoades
Copy link
Contributor

steverhoades commented Oct 22, 2021

Strange, force updating the package to 3.15.3 doesn't seem to fix the issue. I can clearly see the export in the package. Any ideas?

WARNING in ../node_modules/@data-driven-forms/pf4-component-mapper/esm/select/select/select.js 343:24-35
"export 'flatOptions' was not found in '@data-driven-forms/common/select'
 @ ../node_modules/@data-driven-forms/pf4-component-mapper/esm/component-mapper/component-mapper.js
 @ ../node_modules/@data-driven-forms/pf4-component-mapper/esm/component-mapper/index.js
 @ ../node_modules/@data-driven-forms/pf4-component-mapper/esm/index.js
 ...
 @ ./src/index.tsx
 @ multi webpack-hot-middleware/client?path=http://localhost:62123/__webpack_hmr&reload=true ./src/index.css ./src/index.tsx

Edit:
Ok, I forgot to look within @data-driven-forms/pf-component-mapper node_modules directory where it still wants 3.12.1. I must have some weird unmet dependencies causing this to fallback to that version. I'll keep digging.

Edit 2:

@data-driven-forms/pf4-component-mapper > @data-driven-forms/common@3.12.1" has unmet peer dependency "react@>=16.13.1".
@data-driven-forms/pf4-component-mapper > @data-driven-forms/common@3.12.1" has unmet peer dependency "react-dom@>=16.13.1".
@data-driven-forms/pf4-component-mapper > @data-driven-forms/common > react-select > @emotion/core@10.1.1" has unmet peer dependency "react@>=16.3.0".
@data-driven-forms/pf4-component-mapper > @data-driven-forms/common > react-select > react-input-autosize@3.0.0" has unmet peer dependency "react@^16.3.0 || ^17.0.0".
@data-driven-forms/pf4-component-mapper > @data-driven-forms/common > react-select > @emotion/core@10.1.1" has unmet peer dependency "react@>=16.3.0".
@data-driven-forms/pf4-component-mapper > @data-driven-forms/common > react-select > react-input-autosize@3.0.0" has unmet peer dependency "react@^16.3.0 || ^17.0.0".

That is interesting because i'm using react@17.0.2

Edit 3:
Alrighty this was due to some weird yarn.lock madness. Removing the @data-driven-forms/pf4-component-mapper package and re-adding it fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Dependency PR enhancement New feature or request PF4 PF4 pull request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Option Groups within PF4 Select Component
4 participants