Skip to content

Commit

Permalink
feat: css overlapping for form package components
Browse files Browse the repository at this point in the history
  • Loading branch information
soslayando committed Jul 5, 2023
1 parent f986506 commit bb90400
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
FocusEventAttrProps,
GlobalAttrProps,
MouseEventAttrProps,
StyledOverloadCssProps,
StyledPolymorphicProps,
} from '../../declarations';

import { StyledEditableContent } from './StyledEditableContent';
Expand All @@ -14,17 +16,20 @@ export interface EditableContentProps
MouseEventAttrProps,
FocusEventAttrProps,
ContainerEventAttrProps,
FieldEventAttrProps {
FieldEventAttrProps,
StyledPolymorphicProps,
StyledOverloadCssProps {
children?: React.ReactNode;
}

export const EditableContent: React.FC<EditableContentProps> = React.forwardRef<
HTMLDivElement,
EditableContentProps
>(({ children, tooltip, ...nativeProps }, ref) => {
>(({ children, tooltip, styles, ...nativeProps }, ref) => {
return (
<StyledEditableContent
{...nativeProps}
css={styles}
contentEditable
ref={ref}
title={tooltip}
Expand Down
16 changes: 14 additions & 2 deletions packages/core/src/components/Field/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
FieldStatus,
GlobalAttrProps,
MouseEventAttrProps,
StyledOverloadCssProps,
StyledPolymorphicProps,
} from '../../declarations';
import { LabelPosition } from './declarations';
import {
Expand Down Expand Up @@ -47,7 +49,9 @@ export type FieldChildrenProps = React.ReactElement<{
export interface FieldProps
extends WithRequired<GlobalAttrProps, 'id'>,
Pick<FieldAttrProps, 'disabled' | 'required'>,
MouseEventAttrProps {
MouseEventAttrProps,
StyledOverloadCssProps,
StyledPolymorphicProps {
/** Children to be passed */
children: FieldChildrenProps;
/** Field control predefined width for Input, Select… etc. */
Expand All @@ -73,6 +77,7 @@ export interface FieldProps
}

export const PartField: React.FC<FieldProps> = ({
as,
children,
disabled = false,
controlWidth,
Expand All @@ -88,6 +93,7 @@ export const PartField: React.FC<FieldProps> = ({
role,
size = 'md',
status = 'base',
styles,
tooltip,
...mouseEventAttrProps
}) => {
Expand All @@ -109,7 +115,13 @@ export const PartField: React.FC<FieldProps> = ({
/>
);
return (
<Field.Container {...mouseEventAttrProps} role={role} tooltip={tooltip}>
<Field.Container
{...mouseEventAttrProps}
as={as}
role={role}
styles={styles}
tooltip={tooltip}
>
<Field.LabelDistributor direction={direction}>
{label && (
<Field.Label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ import {
GlobalAttrProps,
MouseEventAttrProps,
StyledOverloadCssProps,
StyledPolymorphicProps,
} from '../../../declarations';
import { Flex } from '../../Flex';

export interface FieldContainerProps
extends MouseEventAttrProps,
StyledOverloadCssProps,
StyledPolymorphicProps,
Pick<GlobalAttrProps, 'tooltip' | 'role'> {
children: React.ReactNode;
}

export const FieldContainer: React.FC<FieldContainerProps> = ({
as,
children,
onClick,
onMouseDown,
Expand All @@ -27,6 +30,7 @@ export const FieldContainer: React.FC<FieldContainerProps> = ({
tooltip,
}) => (
<Flex
as={as}
onClick={onClick}
onMouseDown={onMouseDown}
onMouseLeave={onMouseLeave}
Expand Down
2 changes: 2 additions & 0 deletions packages/form/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
requiredMarkTooltip,
size = 'md',
status = 'base',
styles,
tooltip,
...restNativeInputProps
}) => (
Expand All @@ -59,6 +60,7 @@ export const Checkbox: React.FC<CheckboxProps> = ({
requiredMarkTooltip={requiredMarkTooltip}
size={size}
status={status}
styles={styles}
tooltip={tooltip}
>
<CheckboxControl
Expand Down
2 changes: 2 additions & 0 deletions packages/form/src/components/ColorPicker/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const ColorPicker: React.FC<ColorPickerProps> = ({
requiredMarkTooltip,
size = 'md',
status = 'base',
styles,
tooltip,
value,
}) => {
Expand Down Expand Up @@ -89,6 +90,7 @@ export const ColorPicker: React.FC<ColorPickerProps> = ({
requiredMarkTooltip={requiredMarkTooltip}
size={size}
status={status}
styled={styles}
tooltip={tooltip}
>
<Popper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const FieldsCombiner: React.FC<FieldsCombinerProps> = ({
hideLabel,
labelPosition,
label,
styles,
// Common
id,
size = 'md',
Expand Down Expand Up @@ -103,6 +104,7 @@ export const FieldsCombiner: React.FC<FieldsCombinerProps> = ({
required={required}
size={size}
status={status}
styles={styles}
tooltip={tooltip}
>
<StyledFieldsCombinerWrapper>
Expand Down
2 changes: 2 additions & 0 deletions packages/form/src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const Input: React.FC<InputProps> = ({
requiredMarkTooltip,
size = 'md',
status = 'base',
styles,
tooltip,
type = 'text',
...restNativeInputProps
Expand All @@ -63,6 +64,7 @@ export const Input: React.FC<InputProps> = ({
requiredMarkTooltip={requiredMarkTooltip}
size={size}
status={status}
styles={styles}
tooltip={tooltip}
>
<InputControl
Expand Down
2 changes: 2 additions & 0 deletions packages/form/src/components/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const Radio: React.FC<RadioProps> = ({
requiredMarkTooltip,
size = 'md',
status = 'base',
styles,
tooltip,
...restNativeInputProps
}) => (
Expand All @@ -59,6 +60,7 @@ export const Radio: React.FC<RadioProps> = ({
requiredMarkTooltip={requiredMarkTooltip}
size={size}
status={status}
styles={styles}
tooltip={tooltip}
>
<RadioControl
Expand Down
2 changes: 2 additions & 0 deletions packages/form/src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const Select: React.FC<SelectProps> = ({
hideLabel,
label,
labelPosition = 'top',
styles,
tooltip,
// SELECT ----------------------------------
...props
Expand All @@ -59,6 +60,7 @@ export const Select: React.FC<SelectProps> = ({
hideLabel={hideLabel}
label={label}
labelPosition={labelPosition}
styles={styles}
tooltip={tooltip}
>
<SelectControl
Expand Down
2 changes: 2 additions & 0 deletions packages/form/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const Switch: React.FC<SwitchProps> = ({
requiredMarkTooltip,
size = 'md',
status = 'base',
styles,
tooltip,
...restSwitchControlProps
}) => {
Expand All @@ -53,6 +54,7 @@ export const Switch: React.FC<SwitchProps> = ({
requiredMarkTooltip={requiredMarkTooltip}
size={size}
status={status}
styles={styles}
tooltip={tooltip}
>
<SwitchControl
Expand Down
2 changes: 2 additions & 0 deletions packages/form/src/components/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const Textarea: React.FC<TextareaProps> = ({
requiredMarkTooltip,
size = 'md',
status = 'base',
styles,
tooltip,
...restNativeTextareaProps
}) => (
Expand All @@ -56,6 +57,7 @@ export const Textarea: React.FC<TextareaProps> = ({
requiredMarkTooltip={requiredMarkTooltip}
size={size}
status={status}
styles={styles}
tooltip={tooltip}
>
<TextareaControl
Expand Down
2 changes: 2 additions & 0 deletions packages/form/src/components/UploadFiles/UploadFiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const UploadFiles: React.FC<UploadFilesProps> = (props) => {
requiredMarkTooltip,
size = 'md',
status = 'base',
styles,
tooltip,
// FilePondProps
acceptedFileTypes,
Expand Down Expand Up @@ -102,6 +103,7 @@ export const UploadFiles: React.FC<UploadFilesProps> = (props) => {
requiredMarkTooltip={requiredMarkTooltip}
size={size}
status={status}
styles={styles}
tooltip={tooltip}
>
<Box flex="1 1 100%">
Expand Down

0 comments on commit bb90400

Please sign in to comment.