Skip to content

Commit

Permalink
fix: fix gap not support in old browser
Browse files Browse the repository at this point in the history
  • Loading branch information
xiejay97 committed Mar 10, 2023
1 parent 45f5752 commit 4a39ad9
Show file tree
Hide file tree
Showing 38 changed files with 186 additions and 89 deletions.
3 changes: 2 additions & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"rules": {
"import-notation": null,
"selector-class-pattern": null,
"block-no-empty": null
"block-no-empty": null,
"selector-not-notation": "simple"
},
"overrides": [
{
Expand Down
15 changes: 0 additions & 15 deletions packages/site/src/styles/_app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ h3 {
'DatePicker': 'date-picker',
'Image': 'image',
'Input': 'input',
'Radio': 'radio',
'Select': 'select',
'Switch': 'switch',
'Tag': 'tag',
Expand Down Expand Up @@ -251,20 +250,6 @@ h3 {
}
}

section[id^='Checkbox'] {
.#{$rd-prefix}checkbox {
margin-right: 8px;
margin-bottom: 12px;
}

.#{$rd-prefix}checkbox-group {
.#{$rd-prefix}checkbox {
margin-right: 0;
margin-bottom: 0;
}
}
}

section[id^='Form'] {
.#{$rd-prefix}form--inline {
min-width: 800px;
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/components/checkbox/demos/1.Basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export default function Demo() {
</DButton>
<br />
<br />
<DCheckbox dDisabled={disabled}>Checkbox</DCheckbox>
<DCheckbox className="me-3" dDisabled={disabled}>
Checkbox
</DCheckbox>
<DCheckbox dIndeterminate dDisabled={disabled}>
Checkbox
</DCheckbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function Demo() {
{state === true ? 'Clear all' : 'Select all'}
</DCheckbox>
<br />
<br />
<DCheckbox.Group
dList={[1, 2, 3].map((n) => ({
label: `Checkbox ${n}`,
Expand Down
17 changes: 13 additions & 4 deletions packages/ui/src/components/compose/Compose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export interface DComposeProps extends React.HTMLAttributes<HTMLDivElement> {
dDisabled?: boolean;
}

export interface DComposePrivateProps {
__noStyle?: boolean;
}

const { COMPONENT_NAME } = registerComponentMate({ COMPONENT_NAME: 'DCompose' as const });
export const DCompose: {
(props: DComposeProps): JSX.Element | null;
Expand All @@ -31,9 +35,10 @@ export const DCompose: {
dSize,
dVertical = false,
dDisabled = false,
__noStyle,

...restProps
} = useComponentConfig(COMPONENT_NAME, props);
} = useComponentConfig(COMPONENT_NAME, props as DComposeProps & DComposePrivateProps);

//#region Context
const dPrefix = usePrefixConfig();
Expand All @@ -55,9 +60,13 @@ export const DCompose: {
<DComposeContext.Provider value={contextValue}>
<div
{...restProps}
className={getClassName(restProps.className, `${dPrefix}compose`, {
[`${dPrefix}compose--vertical`]: dVertical,
})}
className={
__noStyle
? restProps.className
: getClassName(restProps.className, `${dPrefix}compose`, {
[`${dPrefix}compose--vertical`]: dVertical,
})
}
role="group"
>
{children}
Expand Down
8 changes: 5 additions & 3 deletions packages/ui/src/components/pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,11 @@ export function DPagination(props: DPaginationProps): JSX.Element | null {
return dCustomRender.jump(jumpInput);
} else {
return (
<div className={`${dPrefix}pagination__jump-wrapper`}>
{t('Pagination', 'Go')} {jumpInput} {t('Pagination', 'Page')}
</div>
<>
<span>{t('Pagination', 'Go')}</span>
{jumpInput}
<span>{t('Pagination', 'Page')}</span>
</>
);
}
}
Expand Down
12 changes: 8 additions & 4 deletions packages/ui/src/components/radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ export const DRadio: {

return (
<DBaseDesign
dComposeDesign={{
active: checked || focusVisible,
disabled: disabled,
}}
dComposeDesign={
__type
? {
active: checked || focusVisible,
disabled: disabled,
}
: false
}
dFormDesign={false}
>
{({ render: renderBaseDesign }) =>
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/components/radio/RadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ export function DRadioGroup<V extends DId>(props: DRadioGroupProps<V>): JSX.Elem
{...restProps}
className={getClassName(restProps.className, `${dPrefix}radio-group`, {
[`${dPrefix}radio-group--default`]: isUndefined(dType),
[`${dPrefix}radio-group--vertical`]: dVertical,
'is-change': isChange,
})}
dDisabled={disabled}
role="radiogroup"
dSize={size}
dVertical={dVertical}
{...({ __noStyle: isUndefined(dType) } as any)}
>
{dList.map((item) =>
React.cloneElement<DRadioPrivateProps>(
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/components/radio/demos/1.Basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export default function Demo() {
</DButton>
<br />
<br />
<DRadio dDisabled={disabled}>Radio</DRadio>
<DRadio className="me-3" dDisabled={disabled}>
Radio
</DRadio>
<DRadio dDisabled={disabled} dModel>
Radio
</DRadio>
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
@import 'mixins/function';
@import 'mixins/bem';
@import 'mixins/utils';
@import 'mixins/polyfill';
3 changes: 2 additions & 1 deletion packages/ui/src/styles/components/accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
}

@include e(item-button) {
@include polyfill-column-gap(10px);

display: flex;
gap: 0 10px;
align-items: center;
padding: 12px 16px;
cursor: pointer;
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/styles/components/auto-complete.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ $auto-complete-option-height: 32px;
}

@include e(option) {
@include polyfill-column-gap(8px);

position: relative;
display: flex;
gap: 0 8px;
align-items: center;
width: 100%;
height: $auto-complete-option-height;
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/styles/components/breadcrumb.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@include b(breadcrumb) {
@include e(list) {
@include polyfill-column-gap(2px);

display: flex;
flex-wrap: wrap;
gap: 4px 2px;
align-items: center;
padding: 0;
margin: 0 -6px;
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/styles/components/cascader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ $cascader-option-height: 32px;
}

@include e(option) {
@include polyfill-column-gap(8px);

position: relative;
display: flex;
gap: 0 8px;
align-items: center;
width: 100%;
height: $cascader-option-height;
Expand Down
10 changes: 8 additions & 2 deletions packages/ui/src/styles/components/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
}

@include b(checkbox) {
@include polyfill-column-gap(8px);

position: relative;
display: inline-flex;
gap: 0 8px;
align-items: center;

&:hover {
Expand Down Expand Up @@ -192,10 +193,15 @@
@include b(checkbox-group) {
display: flex;
flex-wrap: wrap;
gap: 8px 12px;
align-items: center;

&:not(.#{$rd-prefix}checkbox-group--vertical) {
@include polyfill-gap(8px, 12px);
}

@include m(vertical) {
@include polyfill-row-gap(8px);

flex-direction: column;
align-items: flex-start;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/src/styles/components/compose.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}

&:not(#{&}--vertical) {
& > :not(:first-child, :only-child) {
& > :not(:first-child):not(:only-child) {
margin-left: -1px !important;
}

Expand All @@ -56,15 +56,15 @@
border-bottom-left-radius: 0 !important;
}

& > :not(:first-child, :last-child) {
& > :not(:first-child):not(:last-child) {
border-radius: 0 !important;
}
}

@include m(vertical) {
flex-direction: column;

& > :not(:first-child, :only-child) {
& > :not(:first-child):not(:only-child) {
margin-top: -1px !important;
}

Expand All @@ -78,7 +78,7 @@
border-top-right-radius: 0 !important;
}

& > :not(:first-child, :last-child) {
& > :not(:first-child):not(:last-child) {
border-radius: 0 !important;
}
}
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/src/styles/components/date-picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
height: 26px;
cursor: pointer;

&:not(.is-current-selected, .is-another-selected, .is-hover, .is-between, .is-between-hover):hover {
&:not(.is-current-selected):not(.is-another-selected):not(.is-hover):not(.is-between):not(.is-between-hover):hover {
background-color: var(--#{$rd-prefix}background-color-hover);
}

Expand Down Expand Up @@ -141,8 +141,9 @@
}

@include e(footer) {
@include polyfill-column-gap(4px);

display: flex;
gap: 0 4px;
align-items: center;
justify-content: center;
min-height: 41px;
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/styles/components/empty.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@include b(empty) {
@include polyfill-row-gap(8px);

display: flex;
flex-direction: column;
gap: 8px 0;
align-items: center;
color: rgb(var(--#{$rd-prefix}text-color-rgb) / 28%);

Expand Down
20 changes: 16 additions & 4 deletions packages/ui/src/styles/components/fab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -246,36 +246,48 @@
top: -16px;
left: 0;
flex-direction: column-reverse;
gap: 10px 0;
width: 100%;
transform: translateY(-100%);

& > * + * {
margin-bottom: 10px;
}
}

@include m(right) {
top: 0;
right: -16px;
flex-direction: row;
gap: 0 10px;
height: 100%;
transform: translateX(100%);

& > * + * {
margin-left: 10px;
}
}

@include m(bottom) {
bottom: -16px;
left: 0;
flex-direction: column;
gap: 10px 0;
width: 100%;
transform: translateY(100%);

& > * + * {
margin-top: 10px;
}
}

@include m(left) {
top: 0;
left: -16px;
flex-direction: row-reverse;
gap: 0 10px;
height: 100%;
transform: translateX(-100%);

& > * + * {
margin-right: 10px;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/styles/components/form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@
}

@include e(item-label-extra) {
@include polyfill-column-gap(4px);

display: inline-flex;
gap: 0 4px;
align-items: center;
margin-left: 4px;
font-size: 0.9em;
Expand Down
6 changes: 4 additions & 2 deletions packages/ui/src/styles/components/image.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@
}

@include e(toolbar-page) {
@include polyfill-column-gap(8px);

display: inline-flex;
gap: 0 8px;
align-items: center;
margin-right: auto;
}
Expand Down Expand Up @@ -159,12 +160,13 @@
}

@include e(thumbnail-list) {
@include polyfill-column-gap(8px);

position: absolute;
bottom: 10px;
left: 50%;
z-index: 5;
display: flex;
gap: 0 8px;
padding: 8px;
margin: 0;
list-style: none;
Expand Down
Loading

0 comments on commit 4a39ad9

Please sign in to comment.