@edu-tosel/design 1.0.284 → 1.0.285
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../../util";
|
|
3
|
-
import { Input, Select } from "../../widget";
|
|
3
|
+
import { Input, Label, Select } from "../../widget";
|
|
4
4
|
export default function BoardHeader({ titles, tag, widgets, option, }) {
|
|
5
5
|
const { title, icon, titleColor } = titles ?? {};
|
|
6
6
|
const { selects, inputs } = tag ?? {};
|
|
@@ -23,8 +23,18 @@ function HeaderWidgetRender(props) {
|
|
|
23
23
|
if (props.type === "select") {
|
|
24
24
|
return _jsx(Select, { ...props.data });
|
|
25
25
|
}
|
|
26
|
+
if (props.type === "button") {
|
|
27
|
+
return (_jsx(Label.Button, { ...props.data, option: {
|
|
28
|
+
...props.data.option,
|
|
29
|
+
width: "xs",
|
|
30
|
+
height: "xs",
|
|
31
|
+
} }));
|
|
32
|
+
}
|
|
26
33
|
if (props.type === "selectToggle") {
|
|
27
|
-
return _jsx(Select.Toggle, { ...props.data
|
|
34
|
+
return (_jsx(Select.Toggle, { ...props.data, option: {
|
|
35
|
+
...props.data.option,
|
|
36
|
+
isText: true,
|
|
37
|
+
} }));
|
|
28
38
|
}
|
|
29
39
|
return null;
|
|
30
40
|
}
|
package/interface/Board.d.ts
CHANGED
|
@@ -35,7 +35,11 @@ interface HeaderSelectToggleWidget<T> {
|
|
|
35
35
|
type: "selectToggle";
|
|
36
36
|
data: SelectToggleProps<T>;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
interface HeaderButtonWidget {
|
|
39
|
+
type: "button";
|
|
40
|
+
data: LabelWidget;
|
|
41
|
+
}
|
|
42
|
+
export type HeaderWidgetType<B> = HeaderInputWidget | HeaderSelectWidget<B> | HeaderSelectToggleWidget<B> | HeaderButtonWidget;
|
|
39
43
|
export interface BoardHeaderProps<B> {
|
|
40
44
|
titles?: Omit<Titles, "subtitle"> & {
|
|
41
45
|
icon?: string;
|
package/package.json
CHANGED
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.285
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SelectToggleProps } from "../../../interface";
|
|
2
|
-
export default function SelectToggle<T>({ state, selectOptions: selectOptionsInput, }: SelectToggleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function SelectToggle<T>({ state, selectOptions: selectOptionsInput, option, }: SelectToggleProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { toSelectOption } from "../../../interface";
|
|
3
3
|
import { cn } from "../../../util";
|
|
4
|
-
export default function SelectToggle({ state, selectOptions: selectOptionsInput, }) {
|
|
4
|
+
export default function SelectToggle({ state, selectOptions: selectOptionsInput, option, }) {
|
|
5
5
|
const selectOptions = selectOptionsInput?.map(toSelectOption);
|
|
6
6
|
const [value, setValue] = state;
|
|
7
7
|
const isOff = value === selectOptions[0].value;
|
|
@@ -25,5 +25,6 @@ export default function SelectToggle({ state, selectOptions: selectOptionsInput,
|
|
|
25
25
|
return setValue(selectOptions[1].value);
|
|
26
26
|
return setValue(selectOptions[0].value);
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
const selectedTitle = selectOptions?.find((option) => option.value === value)?.title;
|
|
29
|
+
return (_jsxs("div", { className: "flex items-center gap-x-1.5 ", children: [selectedTitle && option?.isText && (_jsx("div", { className: "text-sm leading-none", children: selectedTitle })), _jsx("button", { onClick: toggle, className: cn(container), children: _jsx("div", { className: cn(controller) }) })] }));
|
|
29
30
|
}
|