@ceed/cds 1.34.0 → 1.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/SearchBar/SearchBar.d.ts +6 -5
- package/dist/components/SearchBar/index.d.ts +3 -2
- package/dist/components/index.d.ts +1 -2
- package/dist/components/inputs/SearchBar.md +127 -50
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +22 -22
- package/dist/index.js +22 -22
- package/framer/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6978,34 +6978,34 @@ RadioList.displayName = "RadioList";
|
|
|
6978
6978
|
// src/components/SearchBar/SearchBar.tsx
|
|
6979
6979
|
var React43 = __toESM(require("react"));
|
|
6980
6980
|
var import_styles = require("@mui/joy/styles");
|
|
6981
|
+
var import_Box5 = __toESM(require("@mui/joy/Box"));
|
|
6981
6982
|
var import_SearchRounded = __toESM(require("@mui/icons-material/SearchRounded"));
|
|
6982
6983
|
var import_CloseRounded = __toESM(require("@mui/icons-material/CloseRounded"));
|
|
6983
|
-
var SearchBarRoot = (0, import_styles.styled)(
|
|
6984
|
+
var SearchBarRoot = (0, import_styles.styled)(import_Box5.default, {
|
|
6984
6985
|
name: "SearchBar",
|
|
6985
|
-
slot: "root"
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
});
|
|
6986
|
+
slot: "root",
|
|
6987
|
+
shouldForwardProp: (prop) => prop !== "ownerState"
|
|
6988
|
+
})(({ theme, ownerState }) => ({
|
|
6989
|
+
display: "inline-flex",
|
|
6990
|
+
flexDirection: "row",
|
|
6991
|
+
minWidth: "220px",
|
|
6992
|
+
...ownerState.showSelect && { maxWidth: "330px" },
|
|
6993
|
+
backgroundColor: theme.vars.palette.background.surface,
|
|
6994
|
+
borderRadius: theme.vars.radius.sm,
|
|
6995
|
+
border: `1px solid ${theme.vars.palette.neutral.outlinedBorder}`,
|
|
6996
|
+
overflow: "hidden",
|
|
6997
|
+
flexShrink: 0
|
|
6998
|
+
}));
|
|
6999
6999
|
var SearchBar = React43.forwardRef(function SearchBar2(inProps, ref) {
|
|
7000
7000
|
const props = (0, import_styles.useThemeProps)({ props: inProps, name: "SearchBar" });
|
|
7001
|
-
const {
|
|
7001
|
+
const { showSelect = false, options, placeholder: placeholderProp, value, onChange, onSearch, ...other } = props;
|
|
7002
7002
|
const [selectVal, setSelectVal] = React43.useState(options?.[0]?.value ?? "");
|
|
7003
7003
|
const [isHovered, setIsHovered] = React43.useState(false);
|
|
7004
|
-
const ownerState = {
|
|
7004
|
+
const ownerState = { showSelect };
|
|
7005
7005
|
const selectedOption = options?.find((o) => o.value === selectVal);
|
|
7006
|
-
const placeholder = selectedOption?.placeholder ?? "";
|
|
7006
|
+
const placeholder = placeholderProp ?? selectedOption?.placeholder ?? "";
|
|
7007
7007
|
const handleSearch = () => {
|
|
7008
|
-
onSearch?.({ selectValue:
|
|
7008
|
+
onSearch?.({ selectValue: showSelect ? selectVal : void 0, inputValue: value });
|
|
7009
7009
|
};
|
|
7010
7010
|
const handleClear = () => {
|
|
7011
7011
|
onChange("");
|
|
@@ -7015,7 +7015,7 @@ var SearchBar = React43.forwardRef(function SearchBar2(inProps, ref) {
|
|
|
7015
7015
|
handleSearch();
|
|
7016
7016
|
}
|
|
7017
7017
|
};
|
|
7018
|
-
return /* @__PURE__ */ React43.createElement(SearchBarRoot, { ref, ownerState, ...other },
|
|
7018
|
+
return /* @__PURE__ */ React43.createElement(SearchBarRoot, { ref, ownerState, ...other }, showSelect && options && /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(
|
|
7019
7019
|
Select,
|
|
7020
7020
|
{
|
|
7021
7021
|
variant: "plain",
|
|
@@ -7024,14 +7024,14 @@ var SearchBar = React43.forwardRef(function SearchBar2(inProps, ref) {
|
|
|
7024
7024
|
value: selectVal,
|
|
7025
7025
|
options,
|
|
7026
7026
|
onChange: (_, newValue) => setSelectVal(newValue),
|
|
7027
|
-
sx: { flex: 1, maxWidth: "110px" },
|
|
7027
|
+
sx: { flex: 1, minWidth: "80px", maxWidth: "110px" },
|
|
7028
7028
|
slotProps: {
|
|
7029
7029
|
button: {
|
|
7030
7030
|
style: { display: "block", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
|
|
7031
7031
|
}
|
|
7032
7032
|
}
|
|
7033
7033
|
}
|
|
7034
|
-
), /* @__PURE__ */ React43.createElement(Divider, { orientation: "vertical", sx: { height:
|
|
7034
|
+
), /* @__PURE__ */ React43.createElement(Divider, { orientation: "vertical", sx: { height: (theme) => theme.spacing(4), alignSelf: "center" } })), /* @__PURE__ */ React43.createElement(
|
|
7035
7035
|
Input,
|
|
7036
7036
|
{
|
|
7037
7037
|
variant: "plain",
|
package/dist/index.js
CHANGED
|
@@ -6879,34 +6879,34 @@ RadioList.displayName = "RadioList";
|
|
|
6879
6879
|
// src/components/SearchBar/SearchBar.tsx
|
|
6880
6880
|
import * as React43 from "react";
|
|
6881
6881
|
import { styled as styled27, useThemeProps as useThemeProps9 } from "@mui/joy/styles";
|
|
6882
|
+
import Box2 from "@mui/joy/Box";
|
|
6882
6883
|
import SearchRoundedIcon from "@mui/icons-material/SearchRounded";
|
|
6883
6884
|
import CloseRoundedIcon from "@mui/icons-material/CloseRounded";
|
|
6884
|
-
var SearchBarRoot = styled27(
|
|
6885
|
+
var SearchBarRoot = styled27(Box2, {
|
|
6885
6886
|
name: "SearchBar",
|
|
6886
|
-
slot: "root"
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
});
|
|
6887
|
+
slot: "root",
|
|
6888
|
+
shouldForwardProp: (prop) => prop !== "ownerState"
|
|
6889
|
+
})(({ theme, ownerState }) => ({
|
|
6890
|
+
display: "inline-flex",
|
|
6891
|
+
flexDirection: "row",
|
|
6892
|
+
minWidth: "220px",
|
|
6893
|
+
...ownerState.showSelect && { maxWidth: "330px" },
|
|
6894
|
+
backgroundColor: theme.vars.palette.background.surface,
|
|
6895
|
+
borderRadius: theme.vars.radius.sm,
|
|
6896
|
+
border: `1px solid ${theme.vars.palette.neutral.outlinedBorder}`,
|
|
6897
|
+
overflow: "hidden",
|
|
6898
|
+
flexShrink: 0
|
|
6899
|
+
}));
|
|
6900
6900
|
var SearchBar = React43.forwardRef(function SearchBar2(inProps, ref) {
|
|
6901
6901
|
const props = useThemeProps9({ props: inProps, name: "SearchBar" });
|
|
6902
|
-
const {
|
|
6902
|
+
const { showSelect = false, options, placeholder: placeholderProp, value, onChange, onSearch, ...other } = props;
|
|
6903
6903
|
const [selectVal, setSelectVal] = React43.useState(options?.[0]?.value ?? "");
|
|
6904
6904
|
const [isHovered, setIsHovered] = React43.useState(false);
|
|
6905
|
-
const ownerState = {
|
|
6905
|
+
const ownerState = { showSelect };
|
|
6906
6906
|
const selectedOption = options?.find((o) => o.value === selectVal);
|
|
6907
|
-
const placeholder = selectedOption?.placeholder ?? "";
|
|
6907
|
+
const placeholder = placeholderProp ?? selectedOption?.placeholder ?? "";
|
|
6908
6908
|
const handleSearch = () => {
|
|
6909
|
-
onSearch?.({ selectValue:
|
|
6909
|
+
onSearch?.({ selectValue: showSelect ? selectVal : void 0, inputValue: value });
|
|
6910
6910
|
};
|
|
6911
6911
|
const handleClear = () => {
|
|
6912
6912
|
onChange("");
|
|
@@ -6916,7 +6916,7 @@ var SearchBar = React43.forwardRef(function SearchBar2(inProps, ref) {
|
|
|
6916
6916
|
handleSearch();
|
|
6917
6917
|
}
|
|
6918
6918
|
};
|
|
6919
|
-
return /* @__PURE__ */ React43.createElement(SearchBarRoot, { ref, ownerState, ...other },
|
|
6919
|
+
return /* @__PURE__ */ React43.createElement(SearchBarRoot, { ref, ownerState, ...other }, showSelect && options && /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(
|
|
6920
6920
|
Select,
|
|
6921
6921
|
{
|
|
6922
6922
|
variant: "plain",
|
|
@@ -6925,14 +6925,14 @@ var SearchBar = React43.forwardRef(function SearchBar2(inProps, ref) {
|
|
|
6925
6925
|
value: selectVal,
|
|
6926
6926
|
options,
|
|
6927
6927
|
onChange: (_, newValue) => setSelectVal(newValue),
|
|
6928
|
-
sx: { flex: 1, maxWidth: "110px" },
|
|
6928
|
+
sx: { flex: 1, minWidth: "80px", maxWidth: "110px" },
|
|
6929
6929
|
slotProps: {
|
|
6930
6930
|
button: {
|
|
6931
6931
|
style: { display: "block", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
|
|
6932
6932
|
}
|
|
6933
6933
|
}
|
|
6934
6934
|
}
|
|
6935
|
-
), /* @__PURE__ */ React43.createElement(Divider, { orientation: "vertical", sx: { height:
|
|
6935
|
+
), /* @__PURE__ */ React43.createElement(Divider, { orientation: "vertical", sx: { height: (theme) => theme.spacing(4), alignSelf: "center" } })), /* @__PURE__ */ React43.createElement(
|
|
6936
6936
|
Input,
|
|
6937
6937
|
{
|
|
6938
6938
|
variant: "plain",
|