@edu-tosel/design 1.0.15 → 1.0.16

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.
package/README.md CHANGED
@@ -20,11 +20,6 @@ Card 컴포넌트는 여러가지 요소를 담고 있는 컨테이너이다.
20
20
 
21
21
  일반적으로 가장 최소 단위의 컴포넌트로 사용되며, 다양한 요소를 담을 수 있다.
22
22
 
23
- ### Deck
24
-
25
- Deck 컴포넌트는 여러가지 Card 컴포넌트를 담고 있는 컨테이너이다.
26
-
27
- Deck 컴포넌트는 담고있는 Card 컴포넌트들을 수평 정렬한다.
28
23
 
29
24
  ### Layout
30
25
 
@@ -1,2 +1,2 @@
1
1
  import { AddCardProps } from "../../interface";
2
- export default function AddCard({ onClick, options }: AddCardProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function AddCard({ title, icon, onClick, options, }: AddCardProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,17 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../../util";
3
3
  import { Card } from "../widget/Card";
4
- export default function AddCard({ onClick, options }) {
4
+ export default function AddCard({ title, icon, onClick, options, }) {
5
5
  const { width } = options ?? {};
6
6
  const container = {
7
- displays: "flex justify-center items-center",
8
- text: "text-3xl",
7
+ displays: "flex flex-col justify-center items-center gap-2",
8
+ text: "text-xs",
9
+ styles: "duration-500 hover:bg-gray-light",
9
10
  };
10
- return _jsx(Card, { options: { width, classNames: cn(container), onClick }, children: "+" });
11
+ const iconBody = {
12
+ displays: "flex items-center justify-center ",
13
+ sizes: "w-9 h-9",
14
+ styles: "bg-gray-light rounded-full",
15
+ };
16
+ return (_jsxs(Card, { options: { width, classNames: cn(container), onClick }, children: [icon && (_jsx("div", { className: cn(iconBody), children: _jsx("img", { src: icon }) })), title && _jsx("div", { children: title })] }));
11
17
  }
@@ -21,29 +21,39 @@ export default function Select({ state, selectOptions, options, }) {
21
21
  setIsActive(false);
22
22
  return setIsButton(false);
23
23
  }, [flag]);
24
+ const levelsKey = {
25
+ CoCoon: "CC",
26
+ "Pre-Starter": "PS",
27
+ Starter: "ST",
28
+ Basic: "BA",
29
+ Junior: "JR",
30
+ "High Junior": "HJ",
31
+ };
24
32
  const [isActive, setIsActive] = useState(false);
25
33
  const [isButton, setIsButton] = useState(false);
26
34
  const [selectedItem, setSelectedItem] = useState(null);
27
35
  const handleItemClick = (title) => {
28
36
  setSelectedItem(title);
29
37
  setIsActive(false);
38
+ const selectedValue = levelsKey[title] || title;
39
+ setValue(selectedValue);
30
40
  };
31
41
  // css
32
42
  const levels = [
33
43
  "CoCoon",
34
- "PreStarter",
44
+ "Pre-Starter",
35
45
  "Starter",
36
46
  "Basic",
37
47
  "Junior",
38
- "HighJunior",
48
+ "High Junior",
39
49
  ];
40
50
  const colorMap = {
41
51
  CoCoon: "bg-cocoon-green",
42
- PreStarter: "bg-ps-pink",
52
+ "Pre-Starter": "bg-ps-pink",
43
53
  Starter: "bg-st-orange",
44
54
  Basic: "bg-ba-yellow",
45
55
  Junior: "bg-jr-blue",
46
- HighJunior: "bg-hj-blue",
56
+ "High Junior": "bg-hj-blue",
47
57
  };
48
58
  const isActiveCss = () => {
49
59
  if (isActive)
package/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import "./globals.css";
2
2
  export * from "./board";
3
3
  export * from "./card";
4
- export * from "./deck";
5
4
  export * from "./layout";
6
5
  export * from "./html";
7
6
  export * from "./interaction";
package/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import "./globals.css";
2
2
  export * from "./board";
3
3
  export * from "./card";
4
- export * from "./deck";
5
4
  export * from "./layout";
6
5
  export * from "./html";
7
6
  export * from "./interaction";
@@ -86,6 +86,8 @@ export interface InfoCardProps extends CardProps {
86
86
  } & CardOptions;
87
87
  }
88
88
  export interface AddCardProps extends Omit<CardProps, "children"> {
89
+ title?: string;
90
+ icon?: string;
89
91
  onClick: OnClick;
90
92
  }
91
93
  export interface RowCardProps<T> {
@@ -1,6 +1,7 @@
1
1
  import { Button, Scripts, Size } from "./Property";
2
2
  export interface ModalProps {
3
3
  isVisible?: boolean;
4
+ event?: string;
4
5
  children: React.ReactNode;
5
6
  classNames?: string;
6
7
  options?: {
@@ -1,6 +1,6 @@
1
1
  import { State } from "../../interface";
2
2
  import { ModalProps } from "../../interface/Modal";
3
- export default function Input<T>({ isVisible, title, options, state, }: Omit<ModalProps, "children"> & {
3
+ export default function Input<T>({ isVisible, event, title, options, state, }: Omit<ModalProps, "children"> & {
4
4
  title?: string;
5
5
  state: State<T>;
6
6
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import ModalDesign from "../widget/Modal.design";
3
- export default function Input({ isVisible, title, options, state, }) {
3
+ export default function Input({ isVisible, event, title, options, state, }) {
4
4
  const { buttons } = options ?? {};
5
- return (_jsxs(ModalDesign, { isVisible: isVisible, classNames: "pt-18 px-25", options: { buttons, isCloseButton: true }, children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsx("input", { className: "border-2 border-black w-80 h-8", value: state[0], onChange: (e) => state[1](e.target.value) })] }));
5
+ return (_jsxs(ModalDesign, { isVisible: isVisible, event: event, classNames: "pt-18 px-25", options: { buttons, isCloseButton: true }, children: [_jsx("div", { className: "text-xl font-bold", children: title }), _jsx("input", { className: "border-2 border-black w-80 h-8", value: state[0], onChange: (e) => state[1](e.target.value) })] }));
6
6
  }
@@ -1,2 +1,2 @@
1
1
  import { ModalProps } from "../../interface/Modal";
2
- export default function ModalDesign({ isVisible, children, options, debug, }: ModalProps): import("react").ReactPortal;
2
+ export default function ModalDesign({ isVisible, event, children, options, debug, }: ModalProps): import("react").ReactPortal;
@@ -22,9 +22,9 @@ const heightSize = {
22
22
  "2xl": "w-2/3 min-w-76 max-w-176",
23
23
  full: "h-full",
24
24
  };
25
- export default function ModalDesign({ isVisible, children, options, debug, }) {
25
+ export default function ModalDesign({ isVisible, event, children, options, debug, }) {
26
26
  const { buttons, width, height, closeButtonColor, isCloseButton } = options ?? {};
27
- const { clearModal } = useWidgetStore();
27
+ const { setIsOwn, removeModal } = useWidgetStore();
28
28
  const background = {
29
29
  positions: "z-50 fixed top-0 left-0",
30
30
  displays: "flex items-center justify-center ",
@@ -60,5 +60,5 @@ export default function ModalDesign({ isVisible, children, options, debug, }) {
60
60
  leave: { opacity: 0 },
61
61
  config: { duration: 200 },
62
62
  });
63
- return ReactDOM.createPortal(transitions((styles, item) => item && (_jsx(animated.div, { style: styles, className: cn(background), children: _jsxs("div", { className: cn(container), children: [children, buttons ? (_jsx("div", { className: cn(button.container), children: buttons.map(([text, onClick]) => (_jsx("button", { className: cn(button.body), onClick: onClick, children: text }, text))) })) : null, isCloseButton && (_jsx("button", { className: cn(closeButton), onClick: clearModal, children: _jsx("div", { className: "x-shape" }) }))] }) }))), document.body);
63
+ return ReactDOM.createPortal(transitions((styles, item) => item && (_jsx(animated.div, { style: styles, className: cn(background), onClick: () => setIsOwn(true), children: _jsxs("div", { className: cn(container), children: [children, buttons ? (_jsx("div", { className: cn(button.container), children: buttons.map(([text, onClick]) => (_jsx("button", { className: cn(button.body), onClick: onClick, children: text }, text))) })) : null, isCloseButton && event && (_jsx("button", { className: cn(closeButton), onClick: () => removeModal(event), children: _jsx("div", { className: "x-shape" }) }))] }) }))), document.body);
64
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -84,6 +84,7 @@ export default {
84
84
  "sun-calc": "calc(50% - 6rem)",
85
85
  1: "0.25rem",
86
86
  2.5: "0.625rem",
87
+ 3.5: "0.875rem",
87
88
  3.75: "0.9375rem",
88
89
  4.75: "1.1875rem",
89
90
  6.25: "1.5625rem",
package/util/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { default as cn } from "./classNames";
2
2
  export { default as unixToDate } from "./convertUnixTimestampToDate";
3
3
  export { default as isDebug } from "./isDebug";
4
4
  export { default as sortByOrder } from "./sortByOrder";
5
+ export { default as checkPathMatch } from "./checkPathMatch";
5
6
  export * from "./colors";
6
7
  export * from "./display";
7
8
  export * from "./displayResponsive";
package/util/index.js CHANGED
@@ -2,6 +2,7 @@ export { default as cn } from "./classNames";
2
2
  export { default as unixToDate } from "./convertUnixTimestampToDate";
3
3
  export { default as isDebug } from "./isDebug";
4
4
  export { default as sortByOrder } from "./sortByOrder";
5
+ export { default as checkPathMatch } from "./checkPathMatch";
5
6
  export * from "./colors";
6
7
  export * from "./display";
7
8
  export * from "./displayResponsive";
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.15
1
+ 1.0.16
package/deck/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { default as Deck } from "./template/Deck";
package/deck/index.js DELETED
@@ -1 +0,0 @@
1
- export { default as Deck } from "./template/Deck";
@@ -1,6 +0,0 @@
1
- import { DeckProps } from "../../interface/Deck";
2
- declare function Deck<T extends string | number>(props: DeckProps<T>): import("react/jsx-runtime").JSX.Element;
3
- declare namespace Deck {
4
- var Sub: <T extends string | number>({ titles, children, options, debug, }: DeckProps<T>) => import("react/jsx-runtime").JSX.Element;
5
- }
6
- export default Deck;
@@ -1,2 +0,0 @@
1
- import { DeckProps } from "../../interface/Deck";
2
- export default function DeckDesign<T extends string | number>({ children, titles, options, debug, }: DeckProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,21 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn, isDebug } from "../../util";
3
- import { Deck } from "./../widget/Deck";
4
- export default function DeckDesign({ children, titles, options, debug, }) {
5
- const { title, subtitle, isSub } = titles ?? {};
6
- const { height } = options ?? {};
7
- const container = {
8
- displays: "flex flex-col gap-4",
9
- sizes: `w-full h-${height ?? "auto"} `,
10
- debug: debug && isDebug(`border-2 border-${debug}`),
11
- };
12
- const titleBox = {
13
- container: "flex flex-col gap-1",
14
- title: {
15
- text: isSub ? "text-base xl:text-lg" : "text-xl xl:text-2xl",
16
- font: "font-bold",
17
- },
18
- subtitle: isSub ? "text-xs xl:text-sm" : "text-sm xl:text-base",
19
- };
20
- return (_jsxs("div", { className: cn(container), children: [titles && (_jsxs("div", { children: [_jsx("div", { className: cn(titleBox.title), children: title }), _jsx("div", { className: cn(titleBox.subtitle), children: subtitle })] })), _jsx(Deck, { children: children })] }));
21
- }
@@ -1,11 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import DeckDesign from "./Deck.design";
3
- function Deck(props) {
4
- return _jsx(DeckDesign, { ...props });
5
- }
6
- function Sub({ titles, children, options, debug, }) {
7
- const { title, subtitle } = titles ?? { title: "" };
8
- return (_jsx(DeckDesign, { titles: { title, subtitle, isSub: true }, debug: debug, ...options, children: children }));
9
- }
10
- Deck.Sub = Sub;
11
- export default Deck;
@@ -1,2 +0,0 @@
1
- import { DeckProps } from "../../interface/Deck";
2
- export declare function Deck<T extends string | number>({ children, options, }: DeckProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "../../util";
3
- export function Deck({ children, options, }) {
4
- const { flex, justify, gapX, gapY, overflowScroll } = options ?? {};
5
- const body = {
6
- displays: `flex flex-col flex-wrap gap-y-${gapY ?? 5}`,
7
- flex: flex === "col" ? "sm:flex-col" : "sm:flex-row",
8
- justify: `justify-${justify ?? "start"}`,
9
- gapX: `${`gap-x-${gapX ?? 7.5}`}`,
10
- sizes: "sm:w-full ",
11
- styles: `${overflowScroll ? "overflow-x-scroll" : ""} duration-500`,
12
- };
13
- return _jsx("div", { className: cn(body), children: children });
14
- }
@@ -1,15 +0,0 @@
1
- import { Titles } from "./Property";
2
- export interface DeckProps<T> {
3
- children: React.ReactNode;
4
- titles?: Titles;
5
- options?: {
6
- flex?: "col" | "row";
7
- justify?: "between";
8
- overflowScroll?: boolean;
9
- width?: T;
10
- height?: number;
11
- gapX?: number;
12
- gapY?: number;
13
- };
14
- debug?: string;
15
- }
package/interface/Deck.js DELETED
@@ -1 +0,0 @@
1
- export {};