Skip to content
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

feat(QTM-713): Input component migrated to CSS modules #589

Merged
merged 26 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
25dcc03
Update TabView Component to change tab when activeTab changes
LucasFlaquer Sep 12, 2024
ac24733
extract variable
LucasFlaquer Sep 13, 2024
e248366
Merge pull request #585 from catho/tab-view-fix
MarcosViniciusPC Sep 16, 2024
012516f
feat(Icon.jsx): Added icons outside the MUI, updating unit tests and …
MarcosViniciusPC Sep 18, 2024
9074436
chore(BoxSeamFill.jsx): Adjusment name of component
MarcosViniciusPC Sep 19, 2024
d9e14bb
Merge pull request #586 from catho/QTM-778
MarcosViniciusPC Sep 19, 2024
37246ce
feat(Popover.jsx): Add close functionality when clicks on elements ot…
MarcosViniciusPC Sep 23, 2024
caac76f
chore(Popover.regression-test.story.jsx): Passing a new prop into the…
MarcosViniciusPC Sep 23, 2024
eb8ed86
test(Popover.unit.test.jsx): Added test to validate click behavior ou…
MarcosViniciusPC Sep 23, 2024
c4cf1a1
chore: Added new prop to component typing
MarcosViniciusPC Sep 23, 2024
c0af9c5
Merge pull request #587 from catho/QTM-779
MarcosViniciusPC Sep 25, 2024
1f2ec59
fix(DropdownLight.jsx): Added "button" type to prevent form submissio…
MarcosViniciusPC Sep 30, 2024
a62fd85
chore: Updated snapshots
MarcosViniciusPC Sep 30, 2024
160f344
Merge pull request #588 from catho/QTM-786
MarcosViniciusPC Oct 2, 2024
20b5d0a
chore(components/shared): Shared input subcomponents migrated to css …
MarcosViniciusPC Oct 3, 2024
4621e8c
feat(Input): Component migrated to CSS modules
MarcosViniciusPC Oct 3, 2024
7b18621
chore(index.css): Imported styles from input and shared components to…
MarcosViniciusPC Oct 3, 2024
a177a3b
chore(AutoComplete.jsx): Avoiding passing theme property to the input…
MarcosViniciusPC Oct 3, 2024
d60891f
chore(Checkbox): Avoiding passing theme ownership to the snapshot inp…
MarcosViniciusPC Oct 3, 2024
e18b718
chore(Dropdown): Avoiding passing theme ownership to the snapshot inp…
MarcosViniciusPC Oct 3, 2024
46a2b68
chore: Avoiding passing theme ownership to the snapshot input and upd…
MarcosViniciusPC Oct 3, 2024
ea165a2
chore(Input): New regression testing and unit testing adjustments inc…
MarcosViniciusPC Oct 3, 2024
507de23
chore(Form): Avoiding passing "validate" prop in input rendering
MarcosViniciusPC Oct 3, 2024
c5fc830
chore(Input.unit.test.jsx): REmoved unused import
MarcosViniciusPC Oct 3, 2024
0645544
chore: Removing prop theme from input and updating snapshots
MarcosViniciusPC Oct 4, 2024
57141e2
Merge branch 'master' into QTM-713
MarcosViniciusPC Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions components/AutoComplete/AutoComplete.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ const InputWrapper = styled.div`
position: relative;
`;

const InputText = styled(TextInput)`
const propsNotContainedInTextInput = ['theme'];

const InputText = styled(TextInput).withConfig({
shouldForwardProp: (prop) => !propsNotContainedInTextInput.includes(prop),
})`
${({
theme: {
spacing: { xsmall },
Expand Down Expand Up @@ -344,7 +348,7 @@ const AutoComplete = ({
return (
<ComponentWrapper theme={theme} skin={skin}>
<InputWrapper ref={wrapperRef}>
<InputLabel htmlFor={id} error={error}>
<InputLabel htmlFor={id}>
{label}
{required && <RequiredMark skin={skin}>*</RequiredMark>}
</InputLabel>
Expand All @@ -366,6 +370,7 @@ const AutoComplete = ({
onChange={(e) => handleChange(e.target.value)}
skin={skin}
required={required}
theme={theme}
/>
{userTypedValue && !error && !disabled && (
<InputIcon
Expand Down
180 changes: 48 additions & 132 deletions components/AutoComplete/__snapshots__/AutoComplete.unit.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -1,68 +1,27 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AutoComplete Should render Autocomplete 1`] = `
.c3 {
.InputLabel-module__input-label___u-ovg {
color: inherit;
display: block;
font-weight: 700;
margin: var(--qtm-spacing-xsmall) 0 0;
}

.TextInput-module__text-input___VCylJ {
-webkit-appearance: none;
background-color: var(--qtm-colors-neutral-0);
border: 2px solid var(--qtm-colors-neutral-500);
border-radius: 4px;
box-sizing: border-box;
box-sizing: border-box;
font-size: initial;
-webkit-letter-spacing: 0.2px;
-moz-letter-spacing: 0.2px;
-ms-letter-spacing: 0.2px;
letter-spacing: 0.2px;
color: var(--qtm-colors-neutral-700);
font-size: medium;
letter-spacing: .2px;
margin-top: 0;
outline: none;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
padding: var(--qtm-spacing-xsmall) var(--qtm-spacing-medium);
transition: all .2s ease-in-out;
width: 100%;
margin-top: 0px;
padding: 8px 16px;
background-color: #ffffff;
border: 2px solid #999999;
color: #424242;
}

.c3::-webkit-inner-spin-button,
.c3::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}

.c3::-webkit-calendar-picker-indicator,
.c3::-webkit-search-cancel-button {
display: none;
}

.c3::-ms-clear {
display: none;
}

.c3:hover,
.c3:focus {
border-color: #1250C4;
box-shadow: 0px 3px 1px -2px rgba(18,80,196,0.2),0px 2px 2px 0px rgba(18,80,196,0.14),0px 1px 5px 0px rgba(18,80,196,0.12);
}

.c3[disabled] {
background-color: #f2f2f2;
border-color: #999999;
color: #999999;
}

.c3:-webkit-autofill {
box-shadow: 0 0 0 1000px #fff5f5 inset;
}

.c3[disabled] {
box-shadow: none;
cursor: not-allowed;
}

.c2 {
display: block;
font-weight: bold;
margin: 8px 0 0;
color: inherit;
}

.c0 {
Expand All @@ -74,11 +33,11 @@ exports[`AutoComplete Should render Autocomplete 1`] = `
position: relative;
}

.c4 {
.c2 {
margin-top: 8px;
}

.c5 {
.c3 {
border: 0;
-webkit-clip: rect(0 0 0 0);
clip: rect(0 0 0 0);
Expand All @@ -97,27 +56,28 @@ exports[`AutoComplete Should render Autocomplete 1`] = `
class="c1"
>
<label
class="c2"
class="InputLabel-module__input-label___u-ovg"
for=""
/>
<input
aria-autocomplete="both"
aria-expanded="false"
aria-owns="autocompleteOptions"
autocomplete="off"
class="c3 c4"
class="TextInput-module__text-input___VCylJ c2"
id=""
name=""
placeholder="Select an option"
role="combobox"
style="--icon-size: var(--qtm-spacing-large); --icon-area: calc(var(--qtm-spacing-medium) + var(--icon-size) + var(--qtm-spacing-xsmall));"
type="text"
value=""
/>
</div>
<div
aria-atomic="true"
aria-live="polite"
class="c5"
class="c3"
role="status"
>
Digite uma ou mais letras para expandir os resultados. 5 estão disponiveis.
Expand All @@ -126,78 +86,33 @@ exports[`AutoComplete Should render Autocomplete 1`] = `
`;

exports[`AutoComplete Should render Autocomplete with dark skin 1`] = `
.c3 {
.InputLabel-module__input-label___u-ovg {
color: inherit;
display: block;
font-weight: 700;
margin: var(--qtm-spacing-xsmall) 0 0;
}

.TextInput-module__text-input___VCylJ {
-webkit-appearance: none;
background-color: var(--qtm-colors-neutral-0);
border: 2px solid var(--qtm-colors-neutral-500);
border-radius: 4px;
box-sizing: border-box;
box-sizing: border-box;
font-size: initial;
-webkit-letter-spacing: 0.2px;
-moz-letter-spacing: 0.2px;
-ms-letter-spacing: 0.2px;
letter-spacing: 0.2px;
color: var(--qtm-colors-neutral-700);
font-size: medium;
letter-spacing: .2px;
margin-top: 0;
outline: none;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
padding: var(--qtm-spacing-xsmall) var(--qtm-spacing-medium);
transition: all .2s ease-in-out;
width: 100%;
margin-top: 0px;
padding: 8px 16px;
background-color: rgba(0,0,0,0.7);
border: 2px solid transparent;
color: #ffffff;
}

.c3::-webkit-inner-spin-button,
.c3::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}

.c3::-webkit-calendar-picker-indicator,
.c3::-webkit-search-cancel-button {
display: none;
}

.c3::-ms-clear {
display: none;
}

.c3::-webkit-input-placeholder {
color: #ffffff;
}

.c3::-moz-placeholder {
color: #ffffff;
}

.c3:-ms-input-placeholder {
color: #ffffff;
}

.c3::placeholder {
color: #ffffff;
}

.c3:hover,
.c3:focus {
border-color: #0CC0EA;
}

.c3[disabled] {
color: rgba(255,255,255,0.5);
border-color: transparent;
}

.c3[disabled] {
box-shadow: none;
cursor: not-allowed;
}

.c2 {
display: block;
font-weight: bold;
margin: 8px 0 0;
color: inherit;
.TextInput-module__text-input-dark___TrWzt {
background-color: rgba(0,0,0,.7)!important;
border: 2px solid transparent;
color: var(--qtm-colors-neutral-0);
}

.c0 {
Expand All @@ -209,11 +124,11 @@ exports[`AutoComplete Should render Autocomplete with dark skin 1`] = `
position: relative;
}

.c4 {
.c2 {
margin-top: 8px;
}

.c5 {
.c3 {
border: 0;
-webkit-clip: rect(0 0 0 0);
clip: rect(0 0 0 0);
Expand All @@ -232,27 +147,28 @@ exports[`AutoComplete Should render Autocomplete with dark skin 1`] = `
class="c1"
>
<label
class="c2"
class="InputLabel-module__input-label___u-ovg"
for=""
/>
<input
aria-autocomplete="both"
aria-expanded="false"
aria-owns="autocompleteOptions"
autocomplete="off"
class="c3 c4"
class="TextInput-module__text-input___VCylJ TextInput-module__text-input-dark___TrWzt c2"
id=""
name=""
placeholder="Select an option"
role="combobox"
style="--icon-size: var(--qtm-spacing-large); --icon-area: calc(var(--qtm-spacing-medium) + var(--icon-size) + var(--qtm-spacing-xsmall));"
type="text"
value=""
/>
</div>
<div
aria-atomic="true"
aria-live="polite"
class="c5"
class="c3"
role="status"
>
Digite uma ou mais letras para expandir os resultados. 5 estão disponiveis.
Expand Down
18 changes: 14 additions & 4 deletions components/Checkbox/Checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ const CheckboxWrapper = styled.div`
`}
`;

const CheckboxLabel = styled(Label)`
const PropNotContainedInLabel = ['theme', 'error'];

const CheckboxLabel = styled(Label).withConfig({
shouldForwardProp: (prop) => !PropNotContainedInLabel.includes(prop),
})`
${({
theme: {
colors: {
Expand All @@ -61,9 +65,15 @@ const CheckIcon = styled(Icon).attrs({
name: 'check',
})``;

const HiddenCheckbox = styled(HiddenInput).attrs({
type: 'checkbox',
})`
const PropNotContainedInHiddenInput = ['theme', 'error'];

const HiddenCheckbox = styled(HiddenInput)
.attrs({
type: 'checkbox',
})
.withConfig({
shouldForwardProp: (prop) => !PropNotContainedInHiddenInput.includes(prop),
})`
cursor: pointer;
height: 100%;
width: 100%;
Expand Down
2 changes: 0 additions & 2 deletions components/Checkbox/CheckboxButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ const CheckboxButton = ({
{...props}
checked={checked}
disabled={disabled}
error={error}
id={_id}
name={name}
onChange={onChange}
skin={checkSkin}
value={value}
/>
{children || label || value}
Expand Down
13 changes: 2 additions & 11 deletions components/Checkbox/CheckboxGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { FieldGroup, ErrorMessage } from '../shared';
import Checkbox from './Checkbox';
import CheckboxButton from './CheckboxButton';
import CheckboxGroupContext from './CheckboxGroupContext';
import { colors, spacing } from '../shared/theme';

const Group = styled(FieldGroup)`
position: relative;
Expand All @@ -18,10 +17,6 @@ const CheckboxGroup = ({
options = [],
type = 'checkbox',
inline = false,
theme = {
colors,
spacing,
},
size = 'medium',
}) => {
const _onChange = (event) => {
Expand Down Expand Up @@ -56,11 +51,11 @@ const CheckboxGroup = ({
);

return (
<Group theme={theme}>
<Group>
<CheckboxGroupContext.Provider value={valueProvider}>
{checkboxes()}
</CheckboxGroupContext.Provider>
{error && <ErrorMessage theme={theme}>{error}</ErrorMessage>}
{error && <ErrorMessage>{error}</ErrorMessage>}
</Group>
);
};
Expand Down Expand Up @@ -88,10 +83,6 @@ CheckboxGroup.propTypes = {
),
size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge']),
type: PropTypes.oneOf(['checkbox', 'button']),
theme: PropTypes.shape({
colors: PropTypes.object,
spacing: PropTypes.object,
}),
};

export default CheckboxGroup;
Loading