@edu-tosel/design 1.0.283 → 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
  }
@@ -35,7 +35,11 @@ interface HeaderSelectToggleWidget<T> {
35
35
  type: "selectToggle";
36
36
  data: SelectToggleProps<T>;
37
37
  }
38
- export type HeaderWidgetType<B> = HeaderInputWidget | HeaderSelectWidget<B> | HeaderSelectToggleWidget<B>;
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;
@@ -53,6 +53,7 @@ export interface SelectToggleProps<T> {
53
53
  state: State<T>;
54
54
  selectOptions: [SelectOptionInput<T>, SelectOptionInput<T>];
55
55
  option?: {
56
+ isText?: boolean;
56
57
  className?: string;
57
58
  };
58
59
  }
@@ -22,7 +22,7 @@ export default function RowDesign({ item, stateAction, dataField, option, onClic
22
22
  className,
23
23
  };
24
24
  const flagBox = {
25
- positions: "absolute left-3.5",
25
+ positions: "absolute left-2",
26
26
  backgrounds: dot && ColorSet[dot],
27
27
  sizes: "w-2 h-2",
28
28
  styles: "rounded-full",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.283",
3
+ "version": "1.0.285",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.283
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
- return (_jsx("button", { onClick: toggle, className: cn(container), children: _jsx("div", { className: cn(controller) }) }));
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
  }