Skip to content

Checkbox, Radio and Select styles added #705

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
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { refMethods } from "comps/generators/withMethodExposing";

const CascaderStyle = styled(Cascader)<{ $style: CascaderStyleType }>`
width: 100%;
font-family:"Montserrat";
${(props) => props.$style && getStyle(props.$style)}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const getStyle = (style: CheckboxStyleType) => {
.ant-checkbox-inner {
background-color: ${style.checkedBackground};
border-color: ${style.checkedBackground};
border-width:${!!style.borderWidth ? style.borderWidth : '2px'};

&::after {
border-color: ${style.checked};
Expand All @@ -46,6 +47,7 @@ export const getStyle = (style: CheckboxStyleType) => {

&::after {
border-color: ${style.checkedBackground};
border-width:${!!style.borderWidth ? style.borderWidth : '2px'};
border-radius: ${style.radius};
}
}
Expand All @@ -54,15 +56,23 @@ export const getStyle = (style: CheckboxStyleType) => {
border-radius: ${style.radius};
background-color: ${style.uncheckedBackground};
border-color: ${style.uncheckedBorder};
border-width:${!!style.borderWidth ? style.borderWidth : '2px'};
}

&:hover .ant-checkbox-inner,
.ant-checkbox:hover .ant-checkbox-inner,
.ant-checkbox-input:focus + .ant-checkbox-inner {
border-color: ${style.checkedBackground};
border-width:${!!style.borderWidth ? style.borderWidth : '2px'};
}
}

.ant-checkbox-group-item {
font-family:${style.fontFamily};
font-size:${style.textSize};
font-weight:${style.textWeight};
font-style:${style.fontStyle};
}
.ant-checkbox-wrapper {
padding: ${style.padding};
.ant-checkbox-inner,
Expand All @@ -73,7 +83,7 @@ export const getStyle = (style: CheckboxStyleType) => {
`;
};

const CheckboxGroup = styled(AntdCheckboxGroup)<{
const CheckboxGroup = styled(AntdCheckboxGroup) <{
$style: CheckboxStyleType;
$layout: ValueFromOption<typeof RadioLayoutOptions>;
}>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const getStyle = (style: RadioStyleType) => {
padding: ${style.padding};
span:not(.ant-radio) {
${EllipsisTextCss};
font-family:${style.fontFamily};
font-size:${style.textSize};
font-weight:${style.textWeight};
font-style:${style.fontStyle};
}

.ant-radio-checked {
Expand All @@ -37,7 +41,7 @@ const getStyle = (style: RadioStyleType) => {
.ant-radio-inner {
background-color: ${style.uncheckedBackground};
border-color: ${style.uncheckedBorder};

border-width:${style.borderWidth};
&::after {
background-color: ${style.checked};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { BoolControl } from "../../controls/boolControl";
import { LabelControl } from "../../controls/labelControl";
import { BoolCodeControl, StringControl } from "../../controls/codeControl";
import { PaddingControl } from "../../controls/paddingControl";
import { PaddingControl } from "../../controls/paddingControl";
import { MarginControl } from "../../controls/marginControl";
import {
ControlNode,
Expand Down Expand Up @@ -65,8 +65,15 @@ export const getStyle = (
height: auto;
}
.ant-select-selection-search {
padding: ${style.padding};
padding: ${style.padding};
}
.ant-select-selection-search-input {
font-family:${(style as SelectStyleType).fontFamily} !important;
font-size:${(style as SelectStyleType).textSize} !important;
font-weight:${(style as SelectStyleType).textWeight};
color:${(style as SelectStyleType).text} !important;
font-style:${(style as SelectStyleType).fontStyle};
}
.ant-select-selector::after,
.ant-select-selection-placeholder,
.ant-select-selection-item {
Expand All @@ -88,6 +95,7 @@ export const getStyle = (
.ant-select-selector {
background-color: ${style.background};
border-color: ${style.border};
border-width:${(style as SelectStyleType).borderWidth};
}

&.ant-select-focused,
Expand All @@ -101,18 +109,18 @@ export const getStyle = (
.ant-select-clear {
background-color: ${style.background};
color: ${style.text === "#222222"
? "#8B8FA3"
: isDarkColor(style.text)
? lightenColor(style.text, 0.2)
: style.text};
? "#8B8FA3"
: isDarkColor(style.text)
? lightenColor(style.text, 0.2)
: style.text};
}

.ant-select-clear:hover {
color: ${style.text === "#222222"
? "#8B8FA3"
: isDarkColor(style.text)
? lightenColor(style.text, 0.1)
: style.text};
? "#8B8FA3"
: isDarkColor(style.text)
? lightenColor(style.text, 0.1)
: style.text};
}

&.ant-select-multiple .ant-select-selection-item {
Expand Down Expand Up @@ -160,7 +168,7 @@ const getDropdownStyle = (style: MultiSelectStyleType) => {
`;
};

const Select = styled(AntdSelect)<{ $style: SelectStyleType & MultiSelectStyleType }>`
const Select = styled(AntdSelect) <{ $style: SelectStyleType & MultiSelectStyleType }>`
width: 100%;

${(props) => props.$style && getStyle(props.$style)}
Expand Down Expand Up @@ -197,7 +205,7 @@ export const SelectChildrenMap = {
inputValue: stateComp<string>(""), // user's input value when search
showSearch: BoolControl.DEFAULT_TRUE,
viewRef: RefControl<BaseSelectRef>,
margin: MarginControl,
margin: MarginControl,
padding: PaddingControl,
...SelectInputValidationChildren,
...formDataChildren,
Expand Down Expand Up @@ -235,8 +243,8 @@ export const SelectUIView = (
onSearch={
props.showSearch
? (value) => {
props.dispatch(changeChildAction("inputValue", value, false));
}
props.dispatch(changeChildAction("inputValue", value, false));
}
: undefined
}
>
Expand All @@ -248,6 +256,7 @@ export const SelectUIView = (
label={option.label}
disabled={option.disabled}
key={option.value}
style={{fontFamily:"Montserrat"}}
>
<Wrapper className="option-label">
{props.options.findIndex((option) => hasIcon(option.prefixIcon)) > -1 &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ type SelectEditProps = {
options: any[];
};

const defaultProps: any = {}
const SelectEdit = (props: SelectEditProps) => {
const [currentValue, setCurrentValue] = useState(props.initialValue);

return (
<SelectUIView
<SelectUIView
{...defaultProps}
value={currentValue}
options={options}
onChange={(val) => {
props.onChange(val);
setCurrentValue(val)
}}
onEvent={async (eventName)=>{
if(eventName==="blur"){
onEvent={async (eventName) => {
if (eventName === "blur") {
props.onChangeEnd()
}
return []
Expand Down Expand Up @@ -66,7 +68,8 @@ export const ColumnSelectComp = (function () {
onChange={props.onChange}
onChangeEnd={props.onChangeEnd}
/>
)})
)
})
.setPropertyViewFn((children) => {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,20 +735,23 @@ export const SwitchStyle = [
] as const;

export const SelectStyle = [
LABEL,
...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"),
TEXT,
MARGIN,
PADDING,
// LABEL,
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE, 'border', [...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc")]),

// ...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"),
// TEXT,
// MARGIN,
// PADDING,
...ACCENT_VALIDATE,
] as const;

const multiSelectCommon = [
LABEL,
...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"),
TEXT,
MARGIN,
PADDING,
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE, 'border', [...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc")]),
// LABEL,
// ...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"),
// TEXT,
// MARGIN,
// PADDING,
{
name: "tags",
label: trans("style.tags"),
Expand Down Expand Up @@ -841,7 +844,8 @@ function checkAndUncheck() {
}

export const CheckboxStyle = [
LABEL,
// LABEL,
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE, 'text', [LABEL, STATIC_TEXT, VALIDATE]).filter((style) => style.name !== 'border'),
...checkAndUncheck(),
{
name: "checked",
Expand All @@ -850,15 +854,16 @@ export const CheckboxStyle = [
depType: DEP_TYPE.CONTRAST_TEXT,
transformer: contrastText,
},
RADIUS,
STATIC_TEXT,
VALIDATE,
MARGIN,
PADDING,
// RADIUS,
// STATIC_TEXT,
// VALIDATE,
// MARGIN,
// PADDING,
] as const;

export const RadioStyle = [
LABEL,
// LABEL,
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE, 'text', [LABEL, STATIC_TEXT, VALIDATE]).filter((style) => style.name !== 'border' && style.name !== 'radius'),
...checkAndUncheck(),
{
name: "checked",
Expand All @@ -867,10 +872,10 @@ export const RadioStyle = [
depType: DEP_TYPE.SELF,
transformer: toSelf,
},
STATIC_TEXT,
VALIDATE,
MARGIN,
PADDING,
// STATIC_TEXT,
// VALIDATE,
// MARGIN,
// PADDING,
] as const;

export const SegmentStyle = [
Expand Down Expand Up @@ -1019,7 +1024,7 @@ export const TableColumnLinkStyle = [
export const FileStyle = [
// ...getStaticBgBorderRadiusByBg(SURFACE_COLOR),
getStaticBackground(SURFACE_COLOR),
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE,'border',[getStaticBorder('#00000000')]),
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE, 'border', [getStaticBorder('#00000000')]),
// TEXT, ACCENT, MARGIN, PADDING
] as const;

Expand Down