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/update design wtf #738

Merged
merged 4 commits into from
Aug 3, 2023
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
5 changes: 4 additions & 1 deletion packages/date-picker/src/input/rangeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ export const RangeDateInput = forwardRef<
<ClearIcon />
</span>
)}
<span className="suffix-icon" css={suffixIconStyle}>
<span
className="suffix-icon"
css={suffixIconStyle(disabled1 && disabled2)}
>
{suffixIcon}
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/date-picker/src/input/singleInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const DateInput = forwardRef<DateInputHandler, DateInputProps>(
<ClearIcon />
</span>
)}
<span className="suffix-icon" css={suffixIconStyle}>
<span className="suffix-icon" css={suffixIconStyle(disabled)}>
{suffixIcon}
</span>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/date-picker/src/input/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ export const clearIconStyle = css`
cursor: pointer;
`

export const suffixIconStyle = css`
color: ${getColor("grayBlue", "01")};
export const suffixIconStyle = (disabled?: boolean) => css`
color: ${getColor("grayBlue", disabled ? "05" : "01")};
height: 100%;
svg {
vertical-align: unset;
Expand Down
1 change: 1 addition & 0 deletions packages/date-picker/src/panels/date/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export const DatePickerPanel: FC<DatePickerPanelProps> = (props) => {
<MonthPickerPanel
{...getHeaderOperations?.(panelMode)}
setPageShowDate={setPageShowDate}
pageShowDate={pageShowDate}
panelMode={panelMode}
getHeaderOperations={getHeaderOperations as GetHeaderOperationsFun}
onSelect={onSelectAtMonthPanel}
Expand Down
4 changes: 3 additions & 1 deletion packages/select/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export interface SelectProps<T extends SelectValue = SelectValue>
defaultValue?: T
showSearch?: boolean
value?: T
filterOption?: boolean | ((inputValue: string | number) => boolean)
filterOption?:
| boolean
| ((inputValue: string | number, option: SelectOptionObject) => boolean)
onChange?: (value?: T) => void
onClear?: () => void
readOnly?: boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/select/src/multiple-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const MultipleSelect = forwardRef<HTMLDivElement, SelectProps>(
) {
newOptions = newOptions.filter((option) => {
if (typeof filterOption === "function") {
return filterOption(finalInputValue)
return filterOption(finalInputValue, option)
}
return (
typeof option.label === "string" &&
Expand Down
8 changes: 5 additions & 3 deletions packages/select/src/single-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,19 @@ export const SingleSelect = forwardRef<HTMLInputElement, SelectProps>(
) {
newOptions = newOptions.filter((option) => {
if (typeof filterOption === "function") {
return filterOption(finalInputValue)
return filterOption(finalInputValue, option)
}
return (
typeof option.label === "string" &&
option.label.includes(finalInputValue.toString())
option.label
.toLowerCase()
.includes(finalInputValue.toString().toLowerCase())
)
})
}

return newOptions
}, [filterOption, finalInputValue, options])
}, [filterOption, finalInputValue, options, showSearch])

return (
<Dropdown
Expand Down
21 changes: 1 addition & 20 deletions packages/upload/src/list/uploadProgress.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC, useContext } from "react"
import { STATUS, UploadProgressProps } from "../interface"
import { Progress } from "@illa-design/progress"
import { UploadIcon, SuccessIcon, VideoPlayIcon } from "@illa-design/icon"
import { UploadIcon, SuccessIcon } from "@illa-design/icon"
import { isFunction } from "@illa-design/system"
import {
ConfigProviderContext,
Expand All @@ -12,7 +12,6 @@ import {
successIconStyle,
uploadProgressFailStyle,
uploadProgressStatus,
uploadProgressStyle,
} from "../style"
import { handleKeyDown } from "../utils"
import { globalColor, illaPrefix } from "@illa-design/theme"
Expand All @@ -35,23 +34,6 @@ const UploadProgress: FC<UploadProgressProps> = (props) => {
onReupload && onReupload(file)
}

const handleFileUpload = () => {
onUpload && onUpload(file)
}

const startIcon = status === STATUS.INIT && props.startIcon !== null && (
<span
css={uploadProgressStyle}
tabIndex={0}
role="button"
aria-label={locale.start}
onClick={handleFileUpload}
onKeyDown={(e) => handleKeyDown(e, handleFileUpload)}
>
{props.startIcon || <VideoPlayIcon />}
</span>
)

const dom = (
<>
{status === STATUS.FAIL && props.reuploadIcon !== null && (
Expand Down Expand Up @@ -87,7 +69,6 @@ const UploadProgress: FC<UploadProgressProps> = (props) => {
trailColor={globalColor(`--${illaPrefix}-blue-06`)}
{...progressProps}
/>
{startIcon}
</div>
)}
</>
Expand Down
10 changes: 9 additions & 1 deletion packages/upload/src/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ export const textItemImageStyle = css`
width: 40px;
height: 40px;
flex-shrink: 0;
display: flex;
border-radius: 4px;
& span {
display: flex;
width: 100%;
height: 100%;
}
& img,
& svg {
width: 100%;
Expand Down Expand Up @@ -214,7 +220,9 @@ export const getPictureCardContainerStyle = (disabled: boolean) => {
width: 100px;
height: 100px;
border-radius: 2px;
padding: 32px 28px 22px 28px;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
`
if (disabled) {
Expand Down
4 changes: 3 additions & 1 deletion packages/upload/src/trigger-node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ const TriggerNode = (props: PropsWithChildren<TriggerNodeProps>) => {
aria-label={locale.upload}
>
<div css={pictureCardContentStyle}>
<AddIcon css={pictureCardIconStyle} />
<span css={pictureCardIconStyle}>
<AddIcon />
</span>
<div css={pictureCardTextStyle}>{text ?? locale.upload}</div>
</div>
</div>
Expand Down
6 changes: 1 addition & 5 deletions packages/upload/stories/upload.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,11 @@ const Template: Story<UploadProps> = (props) => {
name: "image.png",
status: "error",
},
{
uid: "-3",
name: "image.png",
status: "uploading",
},
{
uid: "-1",
name: "image.png",
status: "init",
percent: 50,
},
{
uid: "-2",
Expand Down