@edu-tosel/design 1.0.263 → 1.0.265

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,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn, isDebug } from "../../util";
3
3
  import { Action, Label } from "../..";
4
+ import { useGalleryContext } from "../../layout/template/GalleryContext";
4
5
  const widthSize = {
5
6
  xs: "w-20",
6
7
  sm: "w-24",
@@ -22,6 +23,7 @@ const heightSize = {
22
23
  auto: "h-auto",
23
24
  };
24
25
  export function Board({ children, action, option, debug, buttons, }) {
26
+ const isUnderGallery = useGalleryContext();
25
27
  const { shows } = action ?? {};
26
28
  const { width, height, isRounded, className, noMobile, background, boundary, } = option ?? {};
27
29
  const container = {
@@ -29,7 +31,11 @@ export function Board({ children, action, option, debug, buttons, }) {
29
31
  width: widthSize[width ?? "full"],
30
32
  noMobile: noMobile && "hidden xl:block",
31
33
  debug: debug && isDebug(`border-2 border-${debug}`),
32
- height: "h-[calc(100%-56px)]",
34
+ height: isUnderGallery
35
+ ? "h-full xl:h-[calc(100%-30px)]"
36
+ : buttons
37
+ ? "h-full xl:h-[calc(100%-100px)]"
38
+ : "h-full xl:h-[calc(100%-30px)]",
33
39
  };
34
40
  const body = {
35
41
  positions: "relative",
@@ -9,7 +9,7 @@ export default function CanvasBoard({ header, children, action, buttons, option,
9
9
  };
10
10
  const body = {
11
11
  displays: "flex flex-col lg:flex-row lg:flex-wrap gap-7.5",
12
- sizes: "h-[calc(100%-60px)]",
12
+ sizes: header ? "h-[calc(100%-60px)]" : "h-full",
13
13
  paddings: `${header ? "pb-5" : "pb-36 xl:pb-6"} px-2 xs:px-4 xl:px-7.5 pt-2 xs:pt-4 xl:pt-7.5`,
14
14
  scrollStyles: "overflow-y-scroll scrollbar-hidden",
15
15
  classNames: option?.className,
@@ -21,6 +21,7 @@ export interface BoardProps<B> {
21
21
  option?: BoardOption;
22
22
  debug?: string;
23
23
  buttons?: LabelWidget[];
24
+ isUnderGallery?: Boolean;
24
25
  }
25
26
  export interface BoardHeaderProps<B> {
26
27
  titles?: Omit<Titles, "subtitle"> & {
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { GalleryProvider } from "./GalleryContext";
2
3
  import Action from "./Action";
3
4
  import Tab from "./Tab";
4
5
  import { cn } from "../../util";
@@ -8,12 +9,15 @@ export default function Gallery({ action, children, option, }) {
8
9
  const container = {
9
10
  displays: "relative flex flex-col-reverse xl:flex-col",
10
11
  position: "top-0 justify-end xl:justify-start",
11
- sizes: "h-[calc(100%)] xl:h-[calc(100%-76px)] w-full",
12
+ sizes: "w-full",
13
+ heightOption: action?.tabs
14
+ ? "h-[calc(100%-56px)] xl:h-[calc(100%-76px)]"
15
+ : "h-[calc(100%-76px)]",
12
16
  };
13
- return (_jsxs("div", { className: cn(container), children: [_jsx(Action.Replace, { actions: action?.replaces, children: _jsx(Action.Show, { actions: action?.shows, children: children }) }), action?.tabs && (_jsx(Tab, { tabs: action?.tabs, option: {
14
- className: cn(tabBox),
15
- text,
16
- background,
17
- boundary,
18
- } }))] }));
17
+ return (_jsx(GalleryProvider, { children: _jsxs("div", { className: cn(container), children: [_jsx(Action.Replace, { actions: action?.replaces, children: _jsx(Action.Show, { actions: action?.shows, children: children }) }), action?.tabs && (_jsx(Tab, { tabs: action?.tabs, option: {
18
+ className: cn(tabBox),
19
+ text,
20
+ background,
21
+ boundary,
22
+ } }))] }) }));
19
23
  }
@@ -0,0 +1,4 @@
1
+ export declare const useGalleryContext: () => boolean;
2
+ export declare const GalleryProvider: ({ children, }: {
3
+ children: React.ReactNode;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from "react";
3
+ const GalleryContext = createContext(null);
4
+ export const useGalleryContext = () => {
5
+ const context = useContext(GalleryContext);
6
+ return context ?? false; // 기본값으로 false 반환
7
+ };
8
+ export const GalleryProvider = ({ children, }) => (_jsx(GalleryContext.Provider, { value: true, children: children }));
@@ -1,15 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect } from "react";
3
- import { useActionStore } from "../../../store";
4
2
  import { cn } from "../../../util";
5
3
  import Action from "../Action";
6
4
  import { useResponsive } from "../../../hook";
7
5
  function Container({ children }) {
8
- const { events } = useActionStore();
9
6
  const isMmd = useResponsive("mmd");
10
- useEffect(() => {
11
- console.log(events);
12
- }, [events]);
13
7
  return (_jsx(Action.Show, { actions: [[isMmd || "dashboardMenu", _jsx(Contents, { children: children })]], children: null }));
14
8
  }
15
9
  function Contents({ children, showAction, }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.263",
3
+ "version": "1.0.265",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
@@ -0,0 +1 @@
1
+ export default function formatKoreanPhoneNumber(phoneNumber: string): string;
@@ -0,0 +1,23 @@
1
+ export default function formatKoreanPhoneNumber(phoneNumber) {
2
+ const cleanedNumber = phoneNumber.replace(/[^\d]/g, "");
3
+ if (/^02\d{7,8}$/.test(cleanedNumber)) {
4
+ return cleanedNumber.length === 9
5
+ ? `${cleanedNumber.slice(0, 2)}-${cleanedNumber.slice(2, 5)}-${cleanedNumber.slice(5)}`
6
+ : `${cleanedNumber.slice(0, 2)}-${cleanedNumber.slice(2, 6)}-${cleanedNumber.slice(6)}`;
7
+ }
8
+ else if (/^0[3-9]\d{8}$/.test(cleanedNumber)) {
9
+ return `${cleanedNumber.slice(0, 3)}-${cleanedNumber.slice(3, 7)}-${cleanedNumber.slice(7)}`;
10
+ }
11
+ else if (/^010\d{8}$/.test(cleanedNumber)) {
12
+ return `${cleanedNumber.slice(0, 3)}-${cleanedNumber.slice(3, 7)}-${cleanedNumber.slice(7)}`;
13
+ }
14
+ else if (/^1\d{4,9}$/.test(cleanedNumber)) {
15
+ return `${cleanedNumber.slice(0, 4)}-${cleanedNumber.slice(4)}`;
16
+ }
17
+ return phoneNumber;
18
+ }
19
+ // console.log(formatKoreanPhoneNumber("01012345678")); // 010-1234-5678
20
+ // console.log(formatKoreanPhoneNumber("0212345678")); // 02-123-4567
21
+ // console.log(formatKoreanPhoneNumber("0311234567")); // 031-123-4567
22
+ // console.log(formatKoreanPhoneNumber("15881234")); // 1588-1234
23
+ // console.log(formatKoreanPhoneNumber("03011123456")); // 030-111-23456
package/util/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export { default as convertDateToString } from "./convertDateToString";
10
10
  export { default as copyToClipboard } from "./copyToClipboard";
11
11
  export { default as createRecord } from "./createRecord";
12
12
  export { default as formatMobileNum } from "./formatPhoneNumberToE164";
13
+ export { default as formatKorPhoneNum } from "./formatKoreanPhoneNumber";
13
14
  export * from "../style/colors";
14
15
  export * from "./pattern";
15
16
  export * from "./shape";
package/util/index.js CHANGED
@@ -10,6 +10,7 @@ export { default as convertDateToString } from "./convertDateToString";
10
10
  export { default as copyToClipboard } from "./copyToClipboard";
11
11
  export { default as createRecord } from "./createRecord";
12
12
  export { default as formatMobileNum } from "./formatPhoneNumberToE164";
13
+ export { default as formatKorPhoneNum } from "./formatKoreanPhoneNumber";
13
14
  export * from "../style/colors";
14
15
  export * from "./pattern";
15
16
  export * from "./shape";
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.263
1
+ 1.0.265