@edu-tosel/design 1.0.7 → 1.0.9

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.
@@ -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)) }, key))), _jsx("button", { onClick: () => {
15
15
  setTempData(row);
16
16
  setView("sideMenu");
17
17
  }, children: "click" })] }) }));
@@ -1,2 +1,4 @@
1
- export { default as Exception } from "./Exception";
2
- export { default as LoadingSpinner } from "./LoadingSpinner";
1
+ export { default as Exception } from "./template/Exception";
2
+ export { default as LoadingSpinner } from "./widget/LoadingSpinner";
3
+ export { default as LoadingJumper } from "./widget/LoadingJumper";
4
+ export { default as NoData } from "./widget/NoData";
@@ -1,2 +1,4 @@
1
- export { default as Exception } from "./Exception";
2
- export { default as LoadingSpinner } from "./LoadingSpinner";
1
+ export { default as Exception } from "./template/Exception";
2
+ export { default as LoadingSpinner } from "./widget/LoadingSpinner";
3
+ export { default as LoadingJumper } from "./widget/LoadingJumper";
4
+ export { default as NoData } from "./widget/NoData";
@@ -1,2 +1,2 @@
1
- import { ExceptionProps } from "../interface/Interaction";
1
+ import { ExceptionProps } from "../../interface/Interaction";
2
2
  export default function Exception({ exceptions, children }: ExceptionProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,10 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Fragment } from "react";
2
3
  export default function Exception({ exceptions, children }) {
3
4
  if (!exceptions)
4
5
  return _jsx(_Fragment, { children: children });
5
6
  const trueComponents = exceptions
6
7
  .filter(([exception]) => exception)
7
- .map(([, component]) => component);
8
+ .map(([, Component], index) => (_jsx(Fragment, { children: Component }, index)));
8
9
  return _jsx(_Fragment, { children: trueComponents.length > 0 ? trueComponents : children });
9
10
  }
@@ -0,0 +1 @@
1
+ export default function LoadingJumper(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export default function LoadingJumper() {
3
+ return (_jsxs("div", { className: "w-full h-full flex items-center justify-center mt-10", children: [_jsx("div", { className: "w-6 h-6 mx-2 bg-gradient-to-br from-[#9979F6] to-[#44C5F3] opacity-40 rounded-full animate-bounce" }), _jsx("div", { className: "w-6 h-6 mx-2 bg-gradient-to-br from-[#9979F6] to-[#44C5F3] opacity-40 rounded-full animate-bounce delay-100" }), _jsx("div", { className: "w-6 h-6 mx-2 bg-gradient-to-br from-[#9979F6] to-[#44C5F3] opacity-40 rounded-full animate-bounce delay-200" })] }));
4
+ }
@@ -1,5 +1,6 @@
1
- import { Log, HTMLElementSetting } from "../interface";
1
+ import { Log, HTMLElementSetting, Button } from "../interface";
2
2
  export interface SideMenuProps<K extends string, T extends string | number> {
3
- log: Log<K, T>;
4
3
  setting: HTMLElementSetting;
4
+ log?: Log<K, T>;
5
+ buttons?: Button[];
5
6
  }
@@ -21,7 +21,7 @@ export type Size = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full";
21
21
  * @property {"full"} full - Full size
22
22
  */
23
23
  export type ImageSize = "sub" | "full";
24
- export type OnClick = () => unknown | Promise<unknown>;
24
+ export type OnClick = () => unknown | (() => Promise<unknown>);
25
25
  export type Button = [string, OnClick];
26
26
  export type Scripts = {
27
27
  script: string;
package/menu/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { default as SideMenu } from "./SideMenu";
1
+ export { default as SideMenu } from "./template/SideMenu";
package/menu/index.js CHANGED
@@ -1 +1 @@
1
- export { default as SideMenu } from "./SideMenu";
1
+ export { default as SideMenu } from "./template/SideMenu";
@@ -0,0 +1,2 @@
1
+ import { SideMenuProps } from "../../interface/Menu";
2
+ export default function SideMenu<K extends string, T extends string | number>({ log, setting, buttons, }: SideMenuProps<K, T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useWidgetStore } from "../../store";
3
+ import { cn } from "../../util";
4
+ import HTMLElement from "../widget/HTMLElement";
5
+ export default function SideMenu({ log, setting, buttons, }) {
6
+ const { tempData, setTempData, clearTempData, events, removeView } = useWidgetStore();
7
+ const isOpen = events.some(({ event }) => event === "sideMenu");
8
+ const positions = "absolute top-20 right-0";
9
+ const paddings = "pt-8";
10
+ const sizes = `${isOpen ? "w-160" : "w-0"} h-full xl:h-158`;
11
+ const styles = `${isOpen ? "opacity-100 z-30" : "opacity-0 z-0"} bg-gray-200 duration-500`;
12
+ const { prints, logs } = log ?? {};
13
+ 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: [_jsxs("div", { className: "w-9/10 border-2 border-black p-2 h-80 relative", 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({
14
+ ...tempData,
15
+ [key]: value,
16
+ }) })] }, key))) }), _jsx("div", { className: "absolute bottom-2 right-2 flex justify-end gap-2", children: buttons?.map(([title, onClick]) => (_jsx("button", { onClick: onClick, className: "px-2 py-1 bg-blue-500 text-white", children: title }, title))) })] }), _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: () => {
17
+ clearTempData();
18
+ return removeView("sideMenu");
19
+ }, className: "absolute left-0 top-2/5 text-3xl font-bold", children: ">" })] }) }));
20
+ }
@@ -0,0 +1,8 @@
1
+ import { Dispatch } from "react";
2
+ import { HTMLElementType } from "../../interface";
3
+ export default function HTMLElement({ type, value, options, onChange, }: {
4
+ type: HTMLElementType;
5
+ value: string | number;
6
+ options?: [string, string][];
7
+ onChange?: Dispatch<string>;
8
+ }): import("react/jsx-runtime").JSX.Element | undefined;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export default function HTMLElement({ type, value, options, onChange, }) {
3
+ if (type === "text")
4
+ return _jsx("div", { children: value });
5
+ if (type === "input")
6
+ return (_jsx("input", { className: "w-32", value: value, onChange: (e) => onChange?.(e.target.value) }));
7
+ if (type === "select")
8
+ return (_jsx("select", { value: value, onChange: (e) => onChange?.(e.target.value), children: options?.map(([value, label]) => (_jsx("option", { value: value, children: label }, value))) }));
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -416,6 +416,23 @@ export default {
416
416
  "7/10": "70%",
417
417
  "9/10": "90%",
418
418
  },
419
+ zIndex: {
420
+ "50": "50",
421
+ "49": "49",
422
+ "48": "48",
423
+ "47": "47",
424
+ "46": "46",
425
+ "45": "45",
426
+ "44": "44",
427
+ "43": "43",
428
+ "42": "42",
429
+ "41": "41",
430
+ "40": "40",
431
+ "30": "30",
432
+ "20": "20",
433
+ "10": "10",
434
+ "0": "0",
435
+ },
419
436
  },
420
437
  },
421
438
  safelist: [
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.7
1
+ 1.0.9
@@ -1,2 +0,0 @@
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 DELETED
@@ -1,27 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { useWidgetStore } from "../store";
3
- import { cn } from "../util";
4
- export default function SideMenu({ log, setting, }) {
5
- const { tempData, setTempData, clearTempData, events, removeView } = useWidgetStore();
6
- const isOpen = events.some(({ event }) => event === "sideMenu");
7
- const positions = "absolute top-20 right-0";
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: () => {
16
- clearTempData();
17
- return removeView("sideMenu");
18
- }, className: "absolute left-0 top-2/5 text-3xl font-bold", children: ">" })] }) }));
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
- }
File without changes
File without changes