@pop-ui/core 2.2.4 → 2.2.6

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/assets/Montserrat-Bold.woff2 +0 -0
  3. package/dist/assets/Montserrat-Medium.woff2 +0 -0
  4. package/dist/assets/Montserrat-SemiBold.woff2 +0 -0
  5. package/dist/assets/NotoSansKR-Bold.woff2 +0 -0
  6. package/dist/assets/NotoSansKR-Medium.woff2 +0 -0
  7. package/dist/assets/NotoSansKR-Regular.woff2 +0 -0
  8. package/dist/assets/NotoSansKR-SemiBold.woff2 +0 -0
  9. package/dist/assets/OFL-Montserrat.txt +94 -0
  10. package/dist/assets/OFL-NotoSansKR.txt +93 -0
  11. package/dist/core.css +1 -1
  12. package/dist/core.js +58 -3110
  13. package/dist/core.umd.cjs +16 -16
  14. package/dist/esm/components/Button/index.js +75 -0
  15. package/dist/esm/components/Button/style.js +9 -0
  16. package/dist/esm/components/Button/styles.module.scss.js +28 -0
  17. package/dist/esm/components/CalendarDatePicker/index.js +119 -0
  18. package/dist/esm/components/CalendarDatePicker/styles.module.scss.js +34 -0
  19. package/dist/esm/components/CalendarDatePicker/utils.js +82 -0
  20. package/dist/esm/components/Checkbox/index.js +32 -0
  21. package/dist/esm/components/Checkbox/styles.module.scss.js +9 -0
  22. package/dist/esm/components/DatePicker/index.js +203 -0
  23. package/dist/esm/components/DatePicker/styles.module.scss.js +57 -0
  24. package/dist/esm/components/Dropdown/index.js +61 -0
  25. package/dist/esm/components/Dropdown/styles.module.scss.js +21 -0
  26. package/dist/esm/components/ImageInput/ImageInputCropModal.js +91 -0
  27. package/dist/esm/components/ImageInput/helpers.js +46 -0
  28. package/dist/esm/components/ImageInput/index.js +379 -0
  29. package/dist/esm/components/ImageInput/styles.module.scss.js +30 -0
  30. package/dist/esm/components/LottieInput/helpers.js +48 -0
  31. package/dist/esm/components/LottieInput/index.js +233 -0
  32. package/dist/esm/components/LottieInput/styles.module.scss.js +14 -0
  33. package/dist/esm/components/Map/Map.js +48 -0
  34. package/dist/esm/components/Map/NaverMapContext.js +78 -0
  35. package/dist/esm/components/Map/markerClustering.js +305 -0
  36. package/dist/esm/components/Map/markerStyles.js +351 -0
  37. package/dist/esm/components/Map/useLocation.js +40 -0
  38. package/dist/esm/components/Map/useMap.js +95 -0
  39. package/dist/esm/components/MapInfo/index.js +120 -0
  40. package/dist/esm/components/MapInfo/styles.module.scss.js +24 -0
  41. package/dist/esm/components/Modal/index.js +52 -0
  42. package/dist/esm/components/Pagination/index.js +45 -0
  43. package/dist/esm/components/Pagination/style.module.scss.js +13 -0
  44. package/dist/esm/components/Radio/index.js +29 -0
  45. package/dist/esm/components/Radio/styles.module.scss.js +9 -0
  46. package/dist/esm/components/SearchBar/index.js +60 -0
  47. package/dist/esm/components/SearchBar/styles.module.scss.js +25 -0
  48. package/dist/esm/components/SegmentButton/index.js +25 -0
  49. package/dist/esm/components/SegmentButton/styles.module.scss.js +9 -0
  50. package/dist/esm/components/Tab/index.js +14 -0
  51. package/dist/esm/components/Tab/styles.module.scss.js +10 -0
  52. package/dist/esm/components/TextField/index.js +99 -0
  53. package/dist/esm/components/TextField/styles.module.scss.js +28 -0
  54. package/dist/esm/components/TimePicker/index.js +33 -0
  55. package/dist/esm/components/TimePicker/styles.module.scss.js +9 -0
  56. package/dist/esm/components/Toast/index.js +35 -0
  57. package/dist/esm/components/Toast/styles.module.scss.js +14 -0
  58. package/dist/esm/components/Toggle/index.js +48 -0
  59. package/dist/esm/components/Toggle/styles.module.scss.js +9 -0
  60. package/dist/esm/components/Tooltip/index.js +25 -0
  61. package/dist/esm/components/Tooltip/styles.module.scss.js +12 -0
  62. package/dist/esm/components/shared/MultiItemInput/Dropzone.js +30 -0
  63. package/dist/esm/components/shared/MultiItemInput/SortableEmptySlot.js +29 -0
  64. package/dist/esm/components/shared/MultiItemInput/TileShell.js +113 -0
  65. package/dist/esm/components/shared/MultiItemInput/helpers.js +23 -0
  66. package/dist/esm/components/shared/MultiItemInput/styles.module.scss.js +30 -0
  67. package/dist/esm/components/shared/MultiItemInput/usePositionGrid.js +49 -0
  68. package/dist/esm/components/shared/MultiItemInput/useSortableGrid.js +20 -0
  69. package/dist/esm/theme/ThemeProvider.js +46 -0
  70. package/dist/esm/theme/cssVariables.js +29 -0
  71. package/dist/esm/theme/mantineTheme.js +36 -0
  72. package/package.json +2 -2
@@ -0,0 +1,113 @@
1
+ "use client";
2
+ import { jsx as s, jsxs as m } from "react/jsx-runtime";
3
+ import { useSortable as Q, defaultAnimateLayoutChanges as V } from "@dnd-kit/sortable";
4
+ import { CSS as W } from "@dnd-kit/utilities";
5
+ import { Loader as Y } from "@mantine/core";
6
+ import { IconDragMenu as Z, ColorGray600 as _, IconXCircle as U, ColorAqua500 as k } from "@pop-ui/foundation";
7
+ import { useState as H } from "react";
8
+ import e from "./styles.module.scss.js";
9
+ function ot({
10
+ id: C,
11
+ totalCount: N,
12
+ width: p,
13
+ height: g,
14
+ readOnly: r,
15
+ isLoading: o,
16
+ itemIsLoading: a,
17
+ canDelete: S,
18
+ hasLink: h,
19
+ isDragHandleOverlay: n = !1,
20
+ linkUrl: v,
21
+ onLinkClick: f,
22
+ onDelete: T,
23
+ deleteAriaLabel: d = "삭제",
24
+ actionBarExtra: b,
25
+ onTileClick: D,
26
+ onFileDrop: c,
27
+ children: A
28
+ }) {
29
+ const [z, u] = H(!1), B = (t) => {
30
+ !c || r || o || a || t.preventDefault();
31
+ }, $ = (t) => {
32
+ !c || r || o || a || (t.preventDefault(), u(!0));
33
+ }, j = (t) => {
34
+ t.currentTarget.contains(t.relatedTarget) || u(!1);
35
+ }, x = (t) => {
36
+ if (t.preventDefault(), u(!1), !c || r || o || a) return;
37
+ const l = t.dataTransfer.files[0];
38
+ l && c(l);
39
+ }, R = (t) => {
40
+ const { isSorting: l, wasDragging: K } = t;
41
+ return l || K ? !1 : V(t);
42
+ }, {
43
+ attributes: q,
44
+ listeners: w,
45
+ setActivatorNodeRef: E,
46
+ setNodeRef: G,
47
+ transform: M,
48
+ transition: P,
49
+ isDragging: X
50
+ } = Q({ id: C, disabled: r, animateLayoutChanges: R }), i = !r && N > 1 && /* @__PURE__ */ s(
51
+ "button",
52
+ {
53
+ type: "button",
54
+ className: n ? e.DragHandleOverlay : e.DragHandle,
55
+ ref: E,
56
+ ...q,
57
+ ...w,
58
+ "aria-label": "드래그로 순서 변경",
59
+ disabled: n && (!!o || !!a),
60
+ onClick: n ? (t) => t.stopPropagation() : void 0,
61
+ children: /* @__PURE__ */ s(Z, { size: 20, color: _ })
62
+ }
63
+ ), y = !n && !!i || h && !!v && !!f || !!b, J = r || o || a || !D ? "default" : "pointer";
64
+ return /* @__PURE__ */ m(
65
+ "div",
66
+ {
67
+ ref: G,
68
+ className: e.TileContainer,
69
+ style: {
70
+ transform: W.Transform.toString(M),
71
+ transition: P,
72
+ opacity: X ? 0.4 : 1
73
+ },
74
+ children: [
75
+ !r && S && !o && /* @__PURE__ */ s(
76
+ "button",
77
+ {
78
+ type: "button",
79
+ className: e.DeleteButton,
80
+ onClick: T,
81
+ "aria-label": d,
82
+ children: /* @__PURE__ */ s(U, { size: 24 })
83
+ }
84
+ ),
85
+ /* @__PURE__ */ m(
86
+ "div",
87
+ {
88
+ className: `${e.Tile}${z ? ` ${e.TileDragOver}` : ""}`,
89
+ style: { width: p, height: g, cursor: J },
90
+ onClick: () => !r && !o && !a && D?.(),
91
+ onDragOver: B,
92
+ onDragEnter: $,
93
+ onDragLeave: j,
94
+ onDrop: x,
95
+ children: [
96
+ A,
97
+ n && i,
98
+ (o || a) && /* @__PURE__ */ s("div", { className: e.LoadingOverlay, children: /* @__PURE__ */ s(Y, { size: p / 6, color: k }) })
99
+ ]
100
+ }
101
+ ),
102
+ y && /* @__PURE__ */ m("div", { className: e.ActionBar, children: [
103
+ !n && i,
104
+ h && v && f && /* @__PURE__ */ s("button", { type: "button", className: e.LinkButton, onClick: f, children: "링크" }),
105
+ b
106
+ ] })
107
+ ]
108
+ }
109
+ );
110
+ }
111
+ export {
112
+ ot as TileShell
113
+ };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ function t() {
3
+ return crypto.randomUUID();
4
+ }
5
+ function c(l, r, e) {
6
+ const n = [...l], [u] = n.splice(r, 1);
7
+ return n.splice(e, 0, u), n;
8
+ }
9
+ function p(l, r, e) {
10
+ return e != null && l.length >= e ? 0 : r != null && l.length < r ? r - l.length : 1;
11
+ }
12
+ function d(l, r, e) {
13
+ return l.map((n) => {
14
+ const u = n.position;
15
+ return u == null ? n : u === r ? { ...n, position: e } : r < e && u > r && u <= e ? { ...n, position: u - 1 } : r > e && u >= e && u < r ? { ...n, position: u + 1 } : n;
16
+ });
17
+ }
18
+ export {
19
+ t as generateItemId,
20
+ p as getPlaceholderCount,
21
+ d as reorderItemPositions,
22
+ c as reorderItems
23
+ };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ const e = "styles-module__TileContainer___5-y01", l = "styles-module__DeleteButton___0zsXm", _ = "styles-module__Tile___3Cezo", o = "styles-module__TileDragOver___e7GXF", t = "styles-module__LoadingOverlay___4CyDQ", r = "styles-module__ActionBar___mJYpe", n = "styles-module__DragHandle___lzKhb", s = "styles-module__DragHandleOverlay___0nlt3", a = "styles-module__LinkButton___bISyz", d = "styles-module__DropzoneOuter___BIO2N", c = "styles-module__Placeholder___q30Yw", u = "styles-module__PlaceholderError___fCOYe", i = {
3
+ TileContainer: e,
4
+ DeleteButton: l,
5
+ Tile: _,
6
+ TileDragOver: o,
7
+ LoadingOverlay: t,
8
+ ActionBar: r,
9
+ DragHandle: n,
10
+ DragHandleOverlay: s,
11
+ LinkButton: a,
12
+ DropzoneOuter: d,
13
+ Placeholder: c,
14
+ PlaceholderError: u
15
+ };
16
+ export {
17
+ r as ActionBar,
18
+ l as DeleteButton,
19
+ n as DragHandle,
20
+ s as DragHandleOverlay,
21
+ d as DropzoneOuter,
22
+ a as LinkButton,
23
+ t as LoadingOverlay,
24
+ c as Placeholder,
25
+ u as PlaceholderError,
26
+ _ as Tile,
27
+ e as TileContainer,
28
+ o as TileDragOver,
29
+ i as default
30
+ };
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { getPlaceholderCount as M, reorderItemPositions as _, reorderItems as b } from "./helpers.js";
3
+ import { useSortableGrid as S } from "./useSortableGrid.js";
4
+ const a = "__slot-";
5
+ function k({ value: e, length: m, minLength: p, maxLength: x, onChange: l }) {
6
+ const d = m ?? p, i = m ?? x, r = d != null && i != null && d === i, f = r ? 0 : M(e, d, i), g = r ? Array.from({ length: i }, (n, t) => `${a}${t}`) : [], u = r ? g : e.map((n) => n.id), { sensors: P, handleDragEnd: h } = S({
7
+ items: e,
8
+ onReorder: (n, t) => {
9
+ const o = b(e, n, t), s = e[n];
10
+ l?.(o, {
11
+ action: "reorder",
12
+ itemId: s.id,
13
+ index: t,
14
+ previousIndex: n,
15
+ nextIndex: t
16
+ });
17
+ }
18
+ });
19
+ return {
20
+ isPositionMode: r,
21
+ resolvedMinLength: d,
22
+ resolvedMaxLength: i,
23
+ placeholderCount: f,
24
+ slotIds: g,
25
+ sortableItems: u,
26
+ sensors: P,
27
+ handleDragEnd: r ? (n) => {
28
+ const { active: t, over: o } = n;
29
+ if (!o || t.id === o.id) return;
30
+ const s = Number(String(t.id).replace(a, "")), c = Number(String(o.id).replace(a, "")), I = e.find((E) => E.position === s);
31
+ if (!I) return;
32
+ const D = _(e, s, c);
33
+ l?.(D, {
34
+ action: "reorder",
35
+ itemId: I.id,
36
+ index: c,
37
+ previousIndex: s,
38
+ nextIndex: c
39
+ });
40
+ } : h,
41
+ getMetaIndex: (n) => {
42
+ const t = e.find((o) => o.id === n);
43
+ return r && t ? t.position ?? 0 : e.findIndex((o) => o.id === n);
44
+ }
45
+ };
46
+ }
47
+ export {
48
+ k as usePositionGrid
49
+ };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { useSensors as c, useSensor as i, PointerSensor as f, KeyboardSensor as u } from "@dnd-kit/core";
3
+ import { sortableKeyboardCoordinates as l } from "@dnd-kit/sortable";
4
+ function v({
5
+ items: e,
6
+ onReorder: d
7
+ }) {
8
+ return { sensors: c(
9
+ i(f, { activationConstraint: { distance: 8 } }),
10
+ i(u, { coordinateGetter: l })
11
+ ), handleDragEnd: (a) => {
12
+ const { active: r, over: n } = a;
13
+ if (!n || r.id === n.id) return;
14
+ const t = e.findIndex((o) => o.id === r.id), s = e.findIndex((o) => o.id === n.id);
15
+ t !== -1 && s !== -1 && d(t, s);
16
+ } };
17
+ }
18
+ export {
19
+ v as useSortableGrid
20
+ };
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { jsx as o, jsxs as x } from "react/jsx-runtime";
3
+ import { MantineProvider as v } from "@mantine/core";
4
+ import { Notifications as C } from "@mantine/notifications";
5
+ import { useState as P, useEffect as g, createContext as i, useContext as n } from "react";
6
+ import { injectCSSVariables as T } from "./cssVariables.js";
7
+ import { mantineTheme as b } from "./mantineTheme.js";
8
+ const m = i(void 0), s = i({}), k = ({
9
+ children: e,
10
+ defaultTheme: c = "light",
11
+ naverClientId: h,
12
+ notificationPosition: u = "bottom-center",
13
+ notificationLimit: d = 5,
14
+ notificationAutoClose: l,
15
+ notificationZIndex: a
16
+ }) => {
17
+ const [t, r] = P(c);
18
+ g(() => {
19
+ T(t), document.documentElement.setAttribute("data-theme", t);
20
+ }, [t]);
21
+ const f = () => {
22
+ r((p) => p === "light" ? "dark" : "light");
23
+ };
24
+ return /* @__PURE__ */ o(m.Provider, { value: { theme: t, setTheme: r, toggleTheme: f }, children: /* @__PURE__ */ o(s.Provider, { value: { naverClientId: h }, children: /* @__PURE__ */ x(v, { theme: b, children: [
25
+ /* @__PURE__ */ o(
26
+ C,
27
+ {
28
+ position: u,
29
+ limit: d,
30
+ autoClose: l,
31
+ zIndex: a
32
+ }
33
+ ),
34
+ e
35
+ ] }) }) });
36
+ }, z = () => {
37
+ const e = n(m);
38
+ if (!e)
39
+ throw new Error("useTheme must be used within ThemeProvider");
40
+ return e;
41
+ }, A = () => n(s);
42
+ export {
43
+ k as PopUiProvider,
44
+ A as usePopUIConfig,
45
+ z as useTheme
46
+ };
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { colors as c, getCSSVariableName as m } from "@pop-ui/foundation";
3
+ const n = (o = "light") => {
4
+ const e = [];
5
+ return Object.entries(c).forEach(([t, r]) => {
6
+ Object.entries(r).forEach(([a, s]) => {
7
+ const i = m(t, a);
8
+ e.push(`${i}: ${s};`);
9
+ });
10
+ }), e.join(`
11
+ `);
12
+ }, h = (o = "light") => {
13
+ const e = document.getElementById("pop-ui-theme-vars");
14
+ e && e.remove();
15
+ const t = document.createElement("style");
16
+ t.id = "pop-ui-theme-vars", t.textContent = `
17
+ :root {
18
+ ${n("light")}
19
+ }
20
+
21
+ [data-theme="dark"] {
22
+ ${n("dark")}
23
+ }
24
+ `, document.head.appendChild(t);
25
+ };
26
+ export {
27
+ n as generateCSSVariables,
28
+ h as injectCSSVariables
29
+ };
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { createTheme as a } from "@mantine/core";
3
+ import { colors as p, getCSSVariableRef as n } from "@pop-ui/foundation";
4
+ const r = (t) => {
5
+ const l = p[t], e = Object.keys(l).sort((g, s) => Number(g) - Number(s));
6
+ return [
7
+ n(t, e[0] || e[e.length - 1]),
8
+ n(t, e[1] || e[e.length - 1]),
9
+ n(t, e[2] || e[e.length - 1]),
10
+ n(t, e[3] || e[e.length - 1]),
11
+ n(t, e[4] || e[e.length - 1]),
12
+ n(t, e[5] || e[e.length - 1]),
13
+ n(t, e[6] || e[e.length - 1]),
14
+ n(t, e[7] || e[e.length - 1]),
15
+ n(t, e[8] || e[e.length - 1]),
16
+ n(t, e[9] || e[e.length - 1])
17
+ ];
18
+ }, y = a({
19
+ colors: {
20
+ gray: r("gray"),
21
+ aqua: r("aqua"),
22
+ red: r("red"),
23
+ orange: r("orange"),
24
+ yellow: r("yellow"),
25
+ green: r("green"),
26
+ blue: r("blue"),
27
+ purple: r("purple"),
28
+ grape: r("grape")
29
+ },
30
+ primaryColor: "aqua",
31
+ primaryShade: 5,
32
+ fontFamily: 'var(--pop-ui-font-family, Pretendard), -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
33
+ });
34
+ export {
35
+ y as mantineTheme
36
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pop-ui/core",
3
3
  "type": "module",
4
- "version": "2.2.4",
4
+ "version": "2.2.6",
5
5
  "main": "./dist/core.umd.cjs",
6
6
  "module": "./dist/core.js",
7
7
  "types": "./dist/types/index.d.ts",
@@ -47,7 +47,7 @@
47
47
  "@dnd-kit/core": "^6.3.1",
48
48
  "@dnd-kit/sortable": "^10.0.0",
49
49
  "@dnd-kit/utilities": "^3.2.2",
50
- "@pop-ui/foundation": "2.2.4",
50
+ "@pop-ui/foundation": "2.2.6",
51
51
  "dayjs": "^1.11.18",
52
52
  "lottie-react": "^2.4.1",
53
53
  "react-easy-crop": "^5.5.3"