feat(input): new Input component with 'input' slot#326
Conversation
12fee4f to
aace092
Compare
8a2fc91 to
723fda5
Compare
a7241d4 to
4dad087
Compare
5686846 to
d519ba8
Compare
eeac1f1 to
ad25278
Compare
|
@levithomason @kuzhelov @miroslavstastny @mnajdova review needed |
Codecov Report
@@ Coverage Diff @@
## master #326 +/- ##
=========================================
+ Coverage 89.33% 89.94% +0.6%
=========================================
Files 64 64
Lines 1257 1253 -4
Branches 186 162 -24
=========================================
+ Hits 1123 1127 +4
+ Misses 131 123 -8
Partials 3 3
Continue to review full report at Codecov.
|
ad25278 to
e9a4381
Compare
| it('sets correct "as" prop in defaultProps', () => { | ||
| const as = 'span' | ||
| const options = { testOption: 'test option value' } | ||
| const createShorthandSpy = spyOn(lib, 'createShorthand') |
There was a problem hiding this comment.
here we are checking the implementation details - we should rather check method's result instead
There was a problem hiding this comment.
agreed with @kuzhelov to add the tests in the dedicated PR for Slot factory that's about to come
| const createShorthandSpy = spyOn(lib, 'createShorthand') | ||
| createSlotFactory(as, () => ({}))('testValue', { defaultProps: { as: asOverride } }) // clone of the options | ||
|
|
||
| const optionsArg = createShorthandSpy.calls.mostRecent().args[3] |
There was a problem hiding this comment.
this test is very brittle - if the next day we will check the arguments that createShorthand accepts, this will fail this test - while this failure won't surely guarantee that the logic of createSlotFactory has become to be incorrect
There was a problem hiding this comment.
agreed with @kuzhelov to add the tests in the dedicated PR for Slot factory that's about to come
bmdalex
left a comment
There was a problem hiding this comment.
addressed @kuzhelov 's comments
Note: Please provide all the initial feedback on the first review so I can address it from beginning. It'd be better not to start new conversations in the phase of addressing review comment (after initial code review from specific dev) unless there are code changes in that area, of course
docs/src/examples/components/Input/Variations/InputExampleTargeting.shorthand.tsx
Show resolved
Hide resolved
docs/src/examples/components/Input/Variations/InputExampleWrapperSlot.shorthand.tsx
Outdated
Show resolved
Hide resolved
docs/src/examples/components/Input/Variations/InputExampleWrapperSlot.shorthand.tsx
Outdated
Show resolved
Hide resolved
55bd7b1 to
62bb49a
Compare
62bb49a to
8ed8347
Compare
0d442e6 to
78503f9
Compare
78503f9 to
93156c3
Compare
[RFC] Input
New input component according following the strategy in #314 (closes #314)
This PR contains:
inputandwrapperslots);Slotfactoryv1;Slotfactory,inputandwrapperslots forInputcomponent,controlled/uncontrolledmode forInput, etcTODO
Proposed solution
Inputcomponent consisting of an<input />element wrapped with a<div />;partitionHTMLPropsto decide whatprops(<Input {...props} />) go to the<input />element or wrapping<div />;inputslot to target the<input />element andwrapperslot to target wrapping<div />whenpartitionHTMLPropsdoes not work as expected:e.g.:
Inputcomponent has the following structure:Props:
API
e.g.:
Component structure
DOM structure
This will solve all the scenarios mentioned above in the following fashion:
1. Styling the
<input />2. Setting HTML attributes for the
<input />3. Setting HTML attributes for the wrapping
<div />Rendered component: