Skip to content

Commit

Permalink
Normalize components
Browse files Browse the repository at this point in the history
resolves #2305
  • Loading branch information
Fred Lefévère-Laoide authored and Fred Lefévère-Laoide committed Dec 10, 2024
1 parent 3254004 commit bd14e77
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 6 deletions.
3 changes: 3 additions & 0 deletions frontend/taipy-gui/public/stylekit/controls/slider.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
**************************************************/

.taipy-slider {
display: inline-flex;
max-width: 100%;
min-height: 48px;
align-items: center;
}
28 changes: 28 additions & 0 deletions frontend/taipy-gui/public/stylekit/controls/status.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2021-2024 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

/**************************************************************
TAIPY STATUS
***************************************************************/

/*************************************************
OVERRIDES / NORMALIZATION
**************************************************/

.taipy-status {
display: inline-flex;
min-height: 48px;
padding-top: 0.5em;
}
3 changes: 3 additions & 0 deletions frontend/taipy-gui/public/stylekit/controls/toggle.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
.taipy-toggle {
display: inline-flex;
z-index: 10;
min-height: 48px;
align-items: center;
gap: 0.3em;
}

.taipy-toggle .MuiToggleButtonGroup-root[aria-label='Theme mode'] {
Expand Down
1 change: 1 addition & 0 deletions frontend/taipy-gui/public/stylekit/stylekit.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@import 'controls/number.css';
@import 'controls/slider.css';
@import 'controls/selector.css';
@import 'controls/status.css';
@import 'controls/toggle.css';
@import 'controls/file_download.css';
@import 'controls/file_selector.css';
Expand Down
3 changes: 3 additions & 0 deletions frontend/taipy-gui/src/components/Taipy/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const verticalDivStyle: CSSProperties = {
flexDirection: "column",
gap: 0,
};
const noPaddingYSx = {py: 0};

const Input = (props: TaipyInputProps) => {
const {
Expand Down Expand Up @@ -300,6 +301,7 @@ const Input = (props: TaipyInputProps) => {
size="small"
onMouseDown={handleUpStepperMouseDown}
disabled={!active}
sx={noPaddingYSx}
>
<ArrowDropUpIcon fontSize="inherit" />
</IconButton>
Expand All @@ -308,6 +310,7 @@ const Input = (props: TaipyInputProps) => {
size="small"
onMouseDown={handleDownStepperMouseDown}
disabled={!active}
sx={noPaddingYSx}
>
<ArrowDropDownIcon fontSize="inherit" />
</IconButton>
Expand Down
12 changes: 11 additions & 1 deletion frontend/taipy-gui/src/components/Taipy/Selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,17 @@ const Selector = (props: SelectorProps) => {
return sx;
}, [height]);
const controlSx = useMemo(
() => ({ my: 1, mx: 0, maxWidth: width, display: "flex", "& .MuiFormControl-root": { maxWidth: "unset" } }),
() => ({
my: 1,
mx: 0,
maxWidth: width,
display: "flex",
"& .MuiFormControl-root": {
maxWidth: "unset",
my: 0,
"& .MuiInputBase-root": { minHeight: 48, "& input": { minHeight: "unset" } },
},
}),
[width]
);

Expand Down
11 changes: 6 additions & 5 deletions frontend/taipy-gui/src/components/Taipy/StatusList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
*/

import React, { MouseEvent, useCallback, useEffect, useMemo, useState } from "react";
import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack";
import ArrowDownward from "@mui/icons-material/ArrowDownward";
import ArrowUpward from "@mui/icons-material/ArrowUpward";
import Tooltip from "@mui/material/Tooltip";
import Popover, { PopoverOrigin } from "@mui/material/Popover";

import Status, { StatusType } from "./Status";
import { TaipyBaseProps, TaipyHoverProps } from "./utils";
import { getSuffixedClassNames, TaipyBaseProps, TaipyHoverProps } from "./utils";
import { useClassNames, useDynamicProperty } from "../../utils/hooks";
import { getComponentClassName } from "./TaipyStyle";

Expand Down Expand Up @@ -185,11 +186,11 @@ const StatusList = (props: StatusListProps) => {

return (
<Tooltip title={hover || ""}>
<>
<Box className={`${className} ${getComponentClassName(props.children)}`}>
<Status
id={props.id}
value={globStatus}
className={`${className} ${getComponentClassName(props.children)}`}
className={getSuffixedClassNames(className, "-main")}
{...globalProps}
icon={getIcon(icons, getStatusIntValue(globStatus.status))}
/>
Expand All @@ -204,7 +205,7 @@ const StatusList = (props: StatusListProps) => {
key={getId(props.id, idx)}
id={getId(props.id, idx)}
value={val}
className={`${className} ${getComponentClassName(props.children)}`}
className={getSuffixedClassNames(className, `-${idx}`)}
{...closeProp}
icon={getIcon(icons, getStatusIntValue(val.status))}
/>
Expand All @@ -213,7 +214,7 @@ const StatusList = (props: StatusListProps) => {
</Stack>
</Popover>
{props.children}
</>
</Box>
</Tooltip>
);
};
Expand Down

0 comments on commit bd14e77

Please sign in to comment.