diff --git a/src/components/Field/Field.scss b/src/components/Field/Field.scss index ce5bee4e..756f67be 100644 --- a/src/components/Field/Field.scss +++ b/src/components/Field/Field.scss @@ -1,9 +1,7 @@ .moonstone-field { - padding-top: var(--spacing-nano); - padding-left: var(--spacing-large); + padding-left: 32px; border-left: 3px solid transparent; - border-radius: 0 2px 2px 0; } .moonstone-field_error { @@ -11,26 +9,28 @@ border-color: var(--color-warning); } -.moonstone-field_label { - display: flex; - gap: var(--spacing-small); - max-width: inherit; - - text-overflow: ellipsis; - overflow: hidden; +.moonstone-field_chips { + gap: var(--spacing-nano); + margin-right: var(--spacing-medium); + margin-left: var(--spacing-small); } .moonstone-field_helper { + margin-top: 2px; + padding-right: calc(var(--spacing-large) + var(--spacing-nano)); + color: var(--color-gray_dark_plain60); - line-clamp: 2; } .moonstone-field_children { gap: var(--spacing-small); - width: 100%; - padding: var(--spacing-small) 0; + margin-top: var(--spacing-small); } .moonstome-field_errorMessage { color: var(--color-warning_dark); } + +.moonstone-field_buttons { + gap: var(--spacing-nano); +} diff --git a/src/components/Field/Field.tsx b/src/components/Field/Field.tsx index 7a7c691c..129fcc6a 100644 --- a/src/components/Field/Field.tsx +++ b/src/components/Field/Field.tsx @@ -20,33 +20,42 @@ export const Field = React.forwardRef(({ ref={ref} className={clsx( 'moonstone-field', + 'flexCol_nowrap', hasError && 'moonstone-field_error', className )} {...props} > -
-
- {label} - {chips} +
+
+ {label} + {chips && +
+ {chips} +
+ }
{buttons && -
- {React.Children.map(buttons, button => - button.props && button.props.children ? - (React.Children.map(button.props.children, btn => { - const key = btn.props.icon ? btn.props.icon.name : btn.props.label; - return (btn && ); - } - - )) : (buttons && ) - )} -
} +
+ {React.Children.map(buttons, button => + button.props && button.props.children ? + (React.Children.map(button.props.children, btn => { + const key = btn.props.icon ? btn.props.icon.name : btn.props.label; + return (btn && ); + } + )) : + (buttons && ) + )} +
}
+ {helper} +
{children} - {hasError && errorMessage && {errorMessage}} + {hasError && errorMessage && + {errorMessage} + }
); diff --git a/src/components/Field/Field.types.ts b/src/components/Field/Field.types.ts index fbed5c64..69ee681b 100644 --- a/src/components/Field/Field.types.ts +++ b/src/components/Field/Field.types.ts @@ -6,6 +6,11 @@ export type FieldProps = { */ label: string; + /** + * Field's id + */ + id: string; + /** * Additional classname */ diff --git a/src/components/Field/FieldBoolean/FieldBoolean.scss b/src/components/Field/FieldBoolean/FieldBoolean.scss index 495e8dff..298b3803 100644 --- a/src/components/Field/FieldBoolean/FieldBoolean.scss +++ b/src/components/Field/FieldBoolean/FieldBoolean.scss @@ -1,9 +1,11 @@ .moonstone-fieldBoolean { position: relative; + + gap: var(--spacing-nano); } -.moonstone-fieldBoolean_children { +.moonstone-fieldBoolean_checkbox { position: absolute; - top: var(--spacing-small); - left: var(--spacing-nano); + top: var(--spacing-nano); + left: var(--spacing-small); } diff --git a/src/components/Field/FieldBoolean/FieldBoolean.tsx b/src/components/Field/FieldBoolean/FieldBoolean.tsx index b02bcf98..577f6776 100644 --- a/src/components/Field/FieldBoolean/FieldBoolean.tsx +++ b/src/components/Field/FieldBoolean/FieldBoolean.tsx @@ -6,6 +6,7 @@ import type {FieldBooleanProps} from './FieldBoolean.types'; import {Typography, Checkbox} from '~/components'; export const FieldBoolean = React.forwardRef(({ + id, label, helper, chips, @@ -22,33 +23,43 @@ export const FieldBoolean = React.forwardRef( className={clsx( 'moonstone-field', 'moonstone-fieldBoolean', + 'flexCol_nowrap', hasError && 'moonstone-field_error', className )} {...props} > -
- -
-
-
- {label} - {chips} +
+
+
+ +
+ {label} + {chips && +
+ {chips} +
+ }
{buttons && -
- {React.Children.map(buttons, button => - button.props && button.props.children ? - (React.Children.map(button.props.children, btn => { - const key = btn.props.icon ? btn.props.icon.name : btn.props.label; - return (btn && ); - } - )) : (buttons && ) - )} -
} +
+ {React.Children.map(buttons, button => + button.props && button.props.children ? + (React.Children.map(button.props.children, btn => { + const key = btn.props.icon ? btn.props.icon.name : btn.props.label; + return (btn && ); + } + )) : + (buttons && ) + )} +
+ }
+ {helper} - {hasError && errorMessage && {errorMessage}} + {hasError && errorMessage && + {errorMessage} + }
); }); diff --git a/src/components/Field/FieldBoolean/FieldBoolean.types.ts b/src/components/Field/FieldBoolean/FieldBoolean.types.ts index 2d57ca1d..afd453f6 100644 --- a/src/components/Field/FieldBoolean/FieldBoolean.types.ts +++ b/src/components/Field/FieldBoolean/FieldBoolean.types.ts @@ -2,11 +2,16 @@ import * as React from 'react'; import type {CheckboxProps} from '~/components/Checkbox/Checkbox.types'; export type FieldBooleanProps = { - /** + /** * FieldBoolean label */ label: string; + /** + * Field's id + */ + id: string; + /** * Additional classname */ diff --git a/src/components/Field/FieldSelector/FieldSelector.scss b/src/components/Field/FieldSelector/FieldSelector.scss index c8a8bf7a..8b95930d 100644 --- a/src/components/Field/FieldSelector/FieldSelector.scss +++ b/src/components/Field/FieldSelector/FieldSelector.scss @@ -1,6 +1,8 @@ .moonstone-fieldSelector { position: relative; + gap: var(--spacing-nano); + width: 100%; } @@ -9,12 +11,16 @@ left: calc(var(--spacing-medium) / -1); } -.moonstone-fieldSelector_selector { - width: 100%; +// .moonstone-fieldSelector_selector { +// width: 100%; - & > .moonstone-dropdown_container { - width: 100%; - } +// & > .moonstone-dropdown_container { +// width: 100%; +// } +// } + +.moonstone-dropdown_container { + width: 100%; } .moonstome-fieldSelector_errorMessage { @@ -22,6 +28,7 @@ } .moonstone-fieldSelector_buttons { + gap: var(--spacing-nano); width: fit-content; min-width: var(--spacing-large); } diff --git a/src/components/Field/FieldSelector/FieldSelector.tsx b/src/components/Field/FieldSelector/FieldSelector.tsx index 237ccd96..7b22f6c1 100644 --- a/src/components/Field/FieldSelector/FieldSelector.tsx +++ b/src/components/Field/FieldSelector/FieldSelector.tsx @@ -26,7 +26,7 @@ export const FieldSelector = React.forwardRef {isDraggable && }
-
+
{selector}