@edu-tosel/design 1.0.5 → 1.0.7

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,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Deck } from "../../deck";
3
- import { SideMenu } from "../../menu";
4
3
  import { cn } from "../../util";
5
4
  import { Board } from "../widget/Board";
6
5
  import BoardHeader from "../widget/Header";
@@ -24,5 +23,5 @@ export default function ManageBoard({ header, data, widgets, }) {
24
23
  }
25
24
  return 0;
26
25
  })
27
- .map((item) => renderItem(item)))) }) }), widgets?.menu && _jsx(SideMenu, {})] }));
26
+ .map((item) => renderItem(item)))) }) }), widgets?.menu] }));
28
27
  }
@@ -13,12 +13,12 @@ export default function BoardDataField({ dataField, }) {
13
13
  const dataFieldContainer = {
14
14
  displays: "flex items-center",
15
15
  sizes: "w-full h-12",
16
- paddings: "px-2 xs:px-4 xl:pl-8 xl:pr-2 ",
16
+ paddings: "px-2 xs:px-4 xl:px-8",
17
17
  styles: "bg-white-off",
18
18
  };
19
19
  const block = {
20
20
  displays: "xl:hidden block ",
21
21
  sizes: container.sizes,
22
22
  };
23
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container.positions, container.displays, container.sizes, container.styles), children: _jsx("div", { className: cn(dataFieldContainer.displays, dataFieldContainer.sizes, dataFieldContainer.paddings, dataFieldContainer.styles), children: Object.entries(fields).map(([key, value]) => (_jsx("div", { className: `w-${`${sizes[key]}/100`} ?? "auto"}`, children: _jsxs("button", { onClick: () => setOrder(key), className: "flex items-center gap-1", children: [_jsx("div", { children: value }), _jsx("div", { className: "text-xs", children: orderBy === key ? (orderHow === "asc" ? "▼" : "▲") : "" })] }) }, key))) }) }), _jsx("div", { className: cn(block.sizes, block.displays) })] }));
23
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(container.positions, container.displays, container.sizes, container.styles), children: _jsx("div", { className: cn(dataFieldContainer.displays, dataFieldContainer.sizes, dataFieldContainer.paddings, dataFieldContainer.styles), children: Object.entries(fields).map(([key, value]) => (_jsx("div", { className: `w-${`${sizes[key]}/100` ?? "auto"}`, children: _jsxs("button", { onClick: () => setOrder(key), className: "flex items-center gap-1", children: [_jsx("div", { children: value }), _jsx("div", { className: "text-xs", children: orderBy === key ? (orderHow === "asc" ? "▼" : "▲") : "" })] }) }, key))) }) }), _jsx("div", { className: cn(block.sizes, block.displays) })] }));
24
24
  }
package/card/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export { default as TrumpCard } from "./template/TrumpCard";
3
3
  export { default as ChartCard } from "./template/ChartCard";
4
4
  export { default as TableCard } from "./template/TableCard";
5
5
  export { default as RowCard } from "./template/RowCard";
6
+ export { default as InfoCard } from "./template/InfoCard";
package/card/index.js CHANGED
@@ -3,3 +3,4 @@ export { default as TrumpCard } from "./template/TrumpCard";
3
3
  export { default as ChartCard } from "./template/ChartCard";
4
4
  export { default as TableCard } from "./template/TableCard";
5
5
  export { default as RowCard } from "./template/RowCard";
6
+ export { default as InfoCard } from "./template/InfoCard";
@@ -0,0 +1,2 @@
1
+ import { InfoCardProps } from "../../interface/Card";
2
+ export default function InfoCard({ type }: InfoCardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Deck } from "../..";
3
+ import { Card } from "../widget/Card";
4
+ export default function InfoCard({ type }) {
5
+ return (_jsxs(Deck, { children: [_jsx(Card, { options: { width: "xs", height: "lg" }, children: _jsxs("div", { className: "p-5", children: [_jsx("div", { children: type }), _jsx("div", {})] }) }), _jsx(Card, { options: { width: "md" }, children: _jsxs("div", { className: "p-5", children: [_jsx("div", { children: type }), _jsx("div", {})] }) })] }));
6
+ }
@@ -11,7 +11,7 @@ export default function RowCard({ row, fields, sizes, }) {
11
11
  height: "xs",
12
12
  boundary: "none",
13
13
  rounded: "none",
14
- }, children: _jsxs("div", { className: "flex items-center h-full", children: [entries.map(([type, key, value]) => (_jsx("div", { className: `w-${`${sizes[key]}/100`} ?? "auto"}`, children: Array.isArray(type) && type[0] === "select" ? (_jsx(Select, { type: type, entry: [key, value], row: rowState, setRow: setRowState }, key + type + value.toString())) : (_jsx("div", { className: "w-full truncate", children: value ?? "No Data" }, key + value.toString())) }, key))), _jsx("button", { onClick: () => {
14
+ }, children: _jsxs("div", { className: "flex items-center h-full", children: [entries.map(([type, key, value]) => (_jsx("div", { className: `w-${`${sizes[key]}/100` ?? "auto"}`, children: Array.isArray(type) && type[0] === "select" ? (_jsx(Select, { type: type, entry: [key, value], row: rowState, setRow: setRowState }, key + type + value.toString())) : (_jsx("div", { className: "w-full truncate", children: value ?? "No Data" }, key + value.toString())) }, key))), _jsx("button", { onClick: () => {
15
15
  setTempData(row);
16
16
  setView("sideMenu");
17
17
  }, children: "click" })] }) }));
@@ -71,3 +71,6 @@ export interface TrumpCardProps {
71
71
  subButton?: [string, string, () => unknown | (() => Promise<unknown>)];
72
72
  };
73
73
  }
74
+ export interface InfoCardProps {
75
+ type: "information" | "profile" | "prpfileSmall";
76
+ }
@@ -1,10 +1,20 @@
1
1
  import { Dispatch } from "react";
2
2
  import { Size } from "./Property";
3
+ export type HTMLElementType = "text" | "input" | "select";
3
4
  export interface HTMLElement {
4
5
  title: string;
5
6
  onChange: Dispatch<string>;
6
7
  width?: Size;
7
8
  }
9
+ export interface HTMLElementSetting {
10
+ [key: string]: {
11
+ label: string;
12
+ type: HTMLElementType;
13
+ placeholder?: string;
14
+ options?: [string, string][];
15
+ onChnage?: Dispatch<string>;
16
+ };
17
+ }
8
18
  export interface HTMLSelectElement extends HTMLElement {
9
19
  selectOptions?: [string | number, string][];
10
20
  }
@@ -0,0 +1,5 @@
1
+ import { Log, HTMLElementSetting } from "../interface";
2
+ export interface SideMenuProps<K extends string, T extends string | number> {
3
+ log: Log<K, T>;
4
+ setting: HTMLElementSetting;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -32,3 +32,9 @@ export type Titles = {
32
32
  subTitle?: string[];
33
33
  color?: string;
34
34
  };
35
+ export interface Log<K extends string, T extends string | number> {
36
+ prints: K[];
37
+ logs: {
38
+ [p in K]: T;
39
+ }[] | undefined;
40
+ }
@@ -1,2 +1,3 @@
1
+ export * from "./HTMLElement";
1
2
  export * from "./Property";
2
3
  export * from "./Widget";
@@ -1,2 +1,3 @@
1
+ export * from "./HTMLElement";
1
2
  export * from "./Property";
2
3
  export * from "./Widget";
@@ -1 +1,2 @@
1
- export default function SideMenu(): import("react/jsx-runtime").JSX.Element;
1
+ import { SideMenuProps } from "../interface/Menu";
2
+ export default function SideMenu<K extends string, T extends string | number>({ log, setting, }: SideMenuProps<K, T>): import("react/jsx-runtime").JSX.Element;
package/menu/SideMenu.js CHANGED
@@ -1,14 +1,27 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useWidgetStore } from "../store";
3
3
  import { cn } from "../util";
4
- export default function SideMenu() {
5
- const { tempData, clearTempData, events, removeView } = useWidgetStore();
4
+ export default function SideMenu({ log, setting, }) {
5
+ const { tempData, setTempData, clearTempData, events, removeView } = useWidgetStore();
6
6
  const isOpen = events.some(({ event }) => event === "sideMenu");
7
7
  const positions = "absolute top-20 right-0";
8
- const sizes = `${isOpen ? "w-160" : "w-0"} h-full bg-gray-200`;
9
- const styles = `${isOpen ? "opacity-100 z-30" : "opacity-0 z-0"} bg-gray-200 duration-500 `;
10
- return (_jsx("div", { className: cn(positions, sizes, styles), children: _jsxs("div", { className: "relative w-full h-full", children: [_jsx("div", { children: Object.entries(tempData).map(([key, value]) => (_jsxs("div", { className: "text-2xl font-bold", children: [key, ": ", value] }, key))) }), _jsx("button", { onClick: () => {
8
+ const paddings = "pt-8";
9
+ const sizes = `${isOpen ? "w-160" : "w-0"} h-full`;
10
+ const styles = `${isOpen ? "opacity-100 z-30" : "opacity-0 z-0"} bg-gray-200 duration-500`;
11
+ const { prints, logs } = log ?? {};
12
+ return (_jsx("div", { className: cn(positions, sizes, styles, paddings), children: _jsxs("div", { className: `relative w-full h-full flex flex-col items-center gap-12 ${isOpen ? "block" : "hidden"}`, children: [_jsx("div", { className: "w-9/10 border-2 border-black p-2 h-80", children: _jsx("div", { className: "grid grid-cols-2", children: Object.entries(setting).map(([key, value]) => (_jsxs("div", { className: "text-base font-bold flex gap-2", children: [_jsxs("div", { className: "w-16", children: [value["label"], ":"] }), _jsx(HTMLElement, { type: value["type"], value: tempData[key], options: value["options"], onChange: (value) => setTempData({
13
+ ...tempData,
14
+ [key]: value,
15
+ }) })] }, key))) }) }), _jsx("div", { className: "border-2 border-black w-9/10 p-2 h-48 overflow-y-scroll", children: logs?.map((log, i) => (_jsx("div", { className: "text-base flex gap-2", children: prints?.map((print) => (_jsx("div", { className: "", children: log[print] }, print))) }, i))) }), _jsx("button", { onClick: () => {
11
16
  clearTempData();
12
17
  return removeView("sideMenu");
13
18
  }, className: "absolute left-0 top-2/5 text-3xl font-bold", children: ">" })] }) }));
14
19
  }
20
+ function HTMLElement({ type, value, options, onChange, }) {
21
+ if (type === "text")
22
+ return _jsx("div", { children: value });
23
+ if (type === "input")
24
+ return (_jsx("input", { className: "w-32", value: value, onChange: (e) => onChange?.(e.target.value) }));
25
+ if (type === "select")
26
+ return (_jsx("select", { value: value, onChange: (e) => onChange?.(e.target.value), children: options?.map(([value, label]) => (_jsx("option", { value: value, children: label }, value))) }));
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.7