@edu-tosel/design 1.0.25 → 1.0.26

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.
@@ -9,7 +9,7 @@ export interface OverlayProps {
9
9
  export interface HTMLElementFrame {
10
10
  title: string;
11
11
  type: HTMLElementType;
12
- state: State<string> | State<boolean>;
12
+ state: State<any>;
13
13
  selectOptions?: [string | number, string][];
14
14
  labels?: [string | boolean, string][];
15
15
  disabled?: Disabled;
@@ -11,6 +11,8 @@ export default function Manage({ titles, isVisible, event, elements, buttons, })
11
11
  styles: "overflow-y-scroll",
12
12
  };
13
13
  return (_jsxs(OverlayDesign, { titles: titles, event: event, isVisible: isVisible, children: [_jsx("div", { className: cn(body), children: elements?.map(({ title, type, labels, state, selectOptions, disabled }) => {
14
+ if (type === "text")
15
+ return (_jsx(Frame, { title: title, children: _jsx("div", { className: "text-base pl-4", children: state[0] }) }, id + title));
14
16
  if (type === "select")
15
17
  return (_jsx(Frame, { title: title, children: _jsx(Select, { state: state, selectOptions: selectOptions }) }, id + title));
16
18
  if (type === "toggle")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -0,0 +1,2 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ export default function createSetter<T, K extends keyof T>(setter: Dispatch<SetStateAction<T>>, key: K): Dispatch<SetStateAction<T[K]>>;
@@ -0,0 +1,11 @@
1
+ export default function createSetter(setter, key) {
2
+ return (updated) => {
3
+ setter((prev) => ({
4
+ ...prev,
5
+ [key]: isFunction(updated) ? updated(prev[key]) : updated,
6
+ }));
7
+ };
8
+ }
9
+ function isFunction(value) {
10
+ return typeof value === "function";
11
+ }
package/util/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { default as unixToDate } from "./convertUnixTimestampToDate";
3
3
  export { default as isDebug } from "./isDebug";
4
4
  export { default as sortByOrder } from "./sortByOrder";
5
5
  export { default as checkPathMatch } from "./checkPathMatch";
6
+ export { default as createSetter } from "./createSetter";
6
7
  export * from "./colors";
7
8
  export * from "./pattern";
8
9
  export * from "./shape";
package/util/index.js CHANGED
@@ -3,6 +3,7 @@ export { default as unixToDate } from "./convertUnixTimestampToDate";
3
3
  export { default as isDebug } from "./isDebug";
4
4
  export { default as sortByOrder } from "./sortByOrder";
5
5
  export { default as checkPathMatch } from "./checkPathMatch";
6
+ export { default as createSetter } from "./createSetter";
6
7
  export * from "./colors";
7
8
  export * from "./pattern";
8
9
  export * from "./shape";
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.25
1
+ 1.0.26