@edu-tosel/design 1.0.329 → 1.0.331

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.
@@ -23,6 +23,9 @@ function HeaderWidgetRender(props) {
23
23
  if (props.type === "select") {
24
24
  return _jsx(Select, { ...props.data });
25
25
  }
26
+ if (props.type === "selectLG") {
27
+ return _jsx(Select.LG, { ...props.data });
28
+ }
26
29
  if (props.type === "button") {
27
30
  return (_jsx(Label.Button, { ...props.data, option: {
28
31
  ...props.data.option,
@@ -17,7 +17,7 @@ const text = {
17
17
  };
18
18
  export default function ProgressCardLG({ titles, checks, displays, theme, option, }) {
19
19
  const contentsWrapper = {
20
- displays: "flex flex-col justify-center items-center",
20
+ displays: "flex flex-col justify-cente r items-center",
21
21
  sizes: "w-full h-full",
22
22
  spacings: "gap-5",
23
23
  };
@@ -26,23 +26,30 @@ export default function ProgressCardLG({ titles, checks, displays, theme, option
26
26
  displays: "hidden sm:flex justify-start items-center",
27
27
  sizes: "w-150 h-19",
28
28
  };
29
- const stepBox = (flag) => ({
29
+ const stepBox = (flag, isCurrent) => ({
30
30
  displays: "flex-1 flex flex-col justify-between",
31
31
  sizes: "h-full",
32
- backgrounds: flag ? bgLight[theme ?? "green"] : "bg-transparent",
32
+ backgrounds: isCurrent ? bgLight[theme ?? "green"] : "bg-transparent",
33
33
  boundaries: "rounded-md p-2.5",
34
- texts: flag ? "text-gray-dark" : "text-gray-medium",
34
+ texts: isCurrent
35
+ ? "text-gray-dark"
36
+ : flag
37
+ ? "text-gray-dark"
38
+ : "text-gray-medium",
35
39
  });
36
40
  const titleBox = {
37
41
  positions: " xl:absolute top-7.5 md:top-12 right-4 md:right-12",
38
42
  displays: "flex flex-col sm:flex-row gap-x-5 xl:flex-col items-center xl:items-end gap-y-3",
39
43
  };
40
44
  const occupied = Math.round((checks.filter((value) => !!value).length / displays.length) * 100);
45
+ // 현재 진행 중인 단계 찾기 (첫 번째 false인 단계)
46
+ const currentStepIndex = checks.findIndex((check) => !check);
47
+ const isCurrentStep = (index) => index === currentStepIndex;
41
48
  return (_jsx(CardDesign, { option: {
42
49
  ...option,
43
50
  width: "full",
44
51
  height: "2xs",
45
- }, children: _jsxs("div", { className: cn(contentsWrapper), children: [_jsx("div", { className: cn(progressBox), children: displays.map(({ title }, index) => (_jsxs("div", { className: cn(stepBox(checks[index])), children: [_jsx("div", { children: title }), _jsx(SVG.Operation.Checked, { flag: checks[index], size: 25, theme: theme })] }, title))) }), _jsxs("div", { className: cn(titleBox), children: [_jsx("div", { className: `text-xl leading-none font-pretendard-bold ${text[theme ?? "green"]}`, children: titles.title }), _jsxs("div", { className: "flex gap-x-3", children: [_jsx("div", { className: "text-base leading-none", children: titles.subtitle }), titles && titles.link && (_jsx("div", { onClick: () => {
52
+ }, children: _jsxs("div", { className: cn(contentsWrapper), children: [_jsx("div", { className: cn(progressBox), children: displays.map(({ title }, index) => (_jsxs("div", { className: cn(stepBox(checks[index], isCurrentStep(index))), children: [_jsx("div", { children: title }), _jsx(SVG.Operation.Checked, { flag: checks[index], size: 25, theme: theme })] }, title))) }), _jsxs("div", { className: cn(titleBox), children: [_jsx("div", { className: `text-xl leading-none font-pretendard-bold ${text[theme ?? "green"]}`, children: titles.title }), _jsxs("div", { className: "flex gap-x-3", children: [_jsx("div", { className: "text-base leading-none", children: titles.subtitle }), titles && titles.link && (_jsx("div", { onClick: () => {
46
53
  if (titles.link)
47
54
  window.location.href = titles.link.path;
48
55
  }, className: "text-base leading-none underline text-gray-medium", children: titles.link.title }))] })] }), _jsx("div", { className: "absolute bottom-0 left-0 bg-gray-light w-full h-2.5", children: _jsx("div", { className: `h-full ${widthSizes[occupied]} ${bg[theme ?? "green"]}` }) })] }) }));
@@ -31,6 +31,10 @@ interface HeaderSelectWidget<B> {
31
31
  type: "select";
32
32
  data: SelectWidget<B>;
33
33
  }
34
+ interface HeaderSelectLGWidget<B> {
35
+ type: "selectLG";
36
+ data: SelectWidget<B>;
37
+ }
34
38
  interface HeaderSelectToggleWidget<T> {
35
39
  type: "selectToggle";
36
40
  data: SelectToggleProps<T>;
@@ -39,7 +43,7 @@ interface HeaderButtonWidget {
39
43
  type: "button";
40
44
  data: LabelWidget;
41
45
  }
42
- export type HeaderWidgetType<B1, B2, B3, B4> = HeaderInputWidget | HeaderSelectWidget<B1> | HeaderSelectToggleWidget<B2> | HeaderButtonWidget;
46
+ export type HeaderWidgetType<B1, B2, B3, B4> = HeaderInputWidget | HeaderSelectWidget<B1> | HeaderSelectLGWidget<B1> | HeaderSelectToggleWidget<B2> | HeaderButtonWidget;
43
47
  export interface BoardHeaderProps<B1, B2, B3, B4> {
44
48
  titles?: Omit<Titles, "subtitle"> & {
45
49
  icon?: string;
@@ -19,5 +19,7 @@ export interface ShelfProps {
19
19
  debug?: string;
20
20
  className?: string;
21
21
  option?: Option;
22
+ scrollAction?: string;
23
+ sticky?: boolean;
22
24
  }
23
25
  export {};
@@ -1,2 +1,2 @@
1
1
  import { ShelfProps } from "../../interface";
2
- export default function Shelf({ children, className, option, titles, debug, }: ShelfProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function Shelf({ children, className, option, titles, debug, scrollAction, }: ShelfProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { LineBreaks } from "../../text";
3
3
  import { cn, isDebug } from "../../util";
4
- export default function Shelf({ children, className, option, titles, debug, }) {
4
+ export default function Shelf({ children, className, option, titles, debug, scrollAction, }) {
5
5
  const { title, titleColor } = titles ?? {};
6
6
  const { titleSize, subtitleSize, isSize, width, height } = option ?? {};
7
7
  const container = {
@@ -9,6 +9,7 @@ export default function Shelf({ children, className, option, titles, debug, }) {
9
9
  optionWidth: width ?? "w-full xl:w-auto",
10
10
  optionHeight: height ?? "h-fit",
11
11
  sizes: isSize && "w-full h-fit",
12
+ scrollAction: scrollAction,
12
13
  debug: debug && isDebug(`border-2 ${debug}`),
13
14
  };
14
15
  const titleBox = {
@@ -5,6 +5,6 @@ declare namespace Shelf {
5
5
  var Row: ({ titles, children, className, debug }: ShelfProps) => import("react/jsx-runtime").JSX.Element;
6
6
  var Col: ({ titles, children, debug, className }: ShelfProps) => import("react/jsx-runtime").JSX.Element;
7
7
  var Fourthird: ({ titles, children, debug, className }: ShelfProps) => import("react/jsx-runtime").JSX.Element;
8
- var Quarter: ({ titles, children, debug, className }: ShelfProps) => import("react/jsx-runtime").JSX.Element;
8
+ var Quarter: ({ titles, children, debug, className, sticky, }: ShelfProps) => import("react/jsx-runtime").JSX.Element;
9
9
  }
10
10
  export default Shelf;
@@ -62,12 +62,12 @@ function Fourthird({ titles, children, debug, className }) {
62
62
  height: "h-fit",
63
63
  }, debug: debug, children: children }));
64
64
  }
65
- function Quarter({ titles, children, debug, className }) {
65
+ function Quarter({ titles, children, debug, className, sticky = false, }) {
66
66
  const container = {
67
67
  displays: "flex flex-col",
68
68
  className: className ?? "gap-y-7.5",
69
69
  };
70
- return (_jsx(ShelfDesign, { titles: titles, className: cn(container), option: {
70
+ return (_jsx(ShelfDesign, { titles: titles, className: cn(container), scrollAction: sticky ? "sticky top-0" : undefined, option: {
71
71
  titleSize: "text-lg xl:text-2xl",
72
72
  subtitleSize: "text-sm",
73
73
  width: "flex-grow basis-[450px] max-w-full min-w-[450px]",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.329",
3
+ "version": "1.0.331",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.329
1
+ 1.0.331
@@ -114,11 +114,11 @@ export default function SelectLG({ state, selectOptions: selectOptionsInput, pla
114
114
  });
115
115
  return (_jsxs("div", { className: cn(container), onClick: () => setIsOwn(true), onKeyDown: onKeyDown, children: [_jsx("button", { onClick: () => setIsOpen(!isOpen), className: cn(button), onMouseEnter: () => setIsHover(true), onMouseLeave: () => setIsHover(false), children: value ? (_jsx("div", { className: cn(label(false)), children: selectOptions?.find((option) => value === option.value)?.title })) : (_jsx("div", { className: "text-xs pl-1", children: placeholder ?? "선택해주세요" })) }), inputTransition((styles, item) => isLong &&
116
116
  item && (_jsx(animated.input, { style: styles, placeholder: "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uC138\uC694", className: cn(input), onChange: (e) => setSearch(e.target.value) }))), bodyTransitions((styles, item) => {
117
- return (item && (_jsx(animated.div, { style: styles, className: cn(body), ref: listRef, children: filteredOptions?.map(({ value, title }, order) => (_jsx("section", { children: _jsx("button", { ref: (el) => (itemRefs.current[order] = el), onClick: () => {
117
+ return (item && (_jsx(animated.div, { style: styles, className: cn(body), ref: listRef, children: filteredOptions && filteredOptions.length > 0 ? (filteredOptions.map(({ value, title }, order) => (_jsx("section", { children: _jsx("button", { ref: (el) => (itemRefs.current[order] = el), onClick: () => {
118
118
  setIndex(order);
119
119
  setValue(value);
120
120
  setText(String(title));
121
121
  return setIsOpen(false);
122
- }, className: cn(label(order === index)), children: title }) }, id + value))) })));
122
+ }, className: cn(label(order === index)), children: title }) }, id + value)))) : (_jsx("div", { className: "flex items-center justify-center py-4 text-xs text-gray-400", children: "\uAC80\uC0C9\uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" })) })));
123
123
  })] }));
124
124
  }