@pop-ui/core 2.2.7 → 2.3.1

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.
@@ -14,7 +14,7 @@ import s from "./styles.module.scss.js";
14
14
  import { PlaceholderDropzone as q } from "../shared/MultiItemInput/Dropzone.js";
15
15
  import { SortableEmptySlot as Ce } from "../shared/MultiItemInput/SortableEmptySlot.js";
16
16
  import { TileShell as $e } from "../shared/MultiItemInput/TileShell.js";
17
- import { usePositionGrid as we } from "../shared/MultiItemInput/usePositionGrid.js";
17
+ import { usePositionGrid as De } from "../shared/MultiItemInput/usePositionGrid.js";
18
18
  function J(e) {
19
19
  if (!e) return !1;
20
20
  try {
@@ -24,10 +24,10 @@ function J(e) {
24
24
  return !1;
25
25
  }
26
26
  }
27
- function Ee(e) {
27
+ function we(e) {
28
28
  J(e) && window.open(e, "_blank", "noopener,noreferrer");
29
29
  }
30
- function Se(e) {
30
+ function Ee(e) {
31
31
  return e ? e.join(",") : "image/*";
32
32
  }
33
33
  function X({
@@ -40,7 +40,7 @@ function X({
40
40
  accept: u,
41
41
  canDelete: $,
42
42
  hasLink: P,
43
- hasEdit: w,
43
+ hasEdit: D,
44
44
  readOnly: g,
45
45
  isLoading: b,
46
46
  onLinkClick: v,
@@ -49,7 +49,7 @@ function X({
49
49
  onEdit: y,
50
50
  onPreview: c
51
51
  }) {
52
- const E = Y(null), S = v ? !!e.url : J(e.url);
52
+ const w = Y(null), E = v ? !!e.url : J(e.url);
53
53
  return /* @__PURE__ */ f(
54
54
  $e,
55
55
  {
@@ -60,14 +60,14 @@ function X({
60
60
  readOnly: g,
61
61
  isLoading: b,
62
62
  itemIsLoading: e.isLoading,
63
- canDelete: $,
63
+ canDelete: e.canDelete ?? $,
64
64
  isDragHandleOverlay: !0,
65
- hasLink: P && S,
65
+ hasLink: P && E,
66
66
  linkUrl: e.url,
67
- onLinkClick: P && S ? () => v ? v(e) : e.url && Ee(e.url) : void 0,
67
+ onLinkClick: P && E ? () => v ? v(e) : e.url && we(e.url) : void 0,
68
68
  onDelete: () => B(e.id),
69
69
  deleteAriaLabel: "이미지 삭제",
70
- onTileClick: () => E.current?.click(),
70
+ onTileClick: () => w.current?.click(),
71
71
  onFileDrop: (i) => {
72
72
  if (u) {
73
73
  if (!u.includes(i.type)) return;
@@ -78,13 +78,13 @@ function X({
78
78
  /* @__PURE__ */ r(
79
79
  "input",
80
80
  {
81
- ref: E,
81
+ ref: w,
82
82
  type: "file",
83
- accept: Se(u),
83
+ accept: Ee(u),
84
84
  style: { display: "none" },
85
85
  onChange: (i) => {
86
- const D = i.target.files?.[0];
87
- D && C(e.id, D), i.target.value = "";
86
+ const S = i.target.files?.[0];
87
+ S && C(e.id, S), i.target.value = "";
88
88
  }
89
89
  }
90
90
  ),
@@ -97,7 +97,7 @@ function X({
97
97
  className: s.TileImage
98
98
  }
99
99
  ),
100
- w && !g && /* @__PURE__ */ r(
100
+ D && !g && /* @__PURE__ */ r(
101
101
  "button",
102
102
  {
103
103
  type: "button",
@@ -140,7 +140,7 @@ const Ve = ({
140
140
  placeholder: u = "이미지를 넣어주세요",
141
141
  hasIcon: $ = !0,
142
142
  hasLink: P = !1,
143
- onLinkClick: w,
143
+ onLinkClick: D,
144
144
  hasEdit: g = !1,
145
145
  canDelete: b = !0,
146
146
  minLength: v,
@@ -148,18 +148,18 @@ const Ve = ({
148
148
  errorMsg: C,
149
149
  isLoading: y,
150
150
  readOnly: c,
151
- gap: E = 8
151
+ gap: w = 8
152
152
  }) => {
153
153
  const {
154
- isPositionMode: S,
154
+ isPositionMode: E,
155
155
  resolvedMaxLength: i,
156
- placeholderCount: D,
156
+ placeholderCount: S,
157
157
  slotIds: K,
158
158
  sortableItems: Q,
159
159
  sensors: Z,
160
160
  handleDragEnd: ee,
161
161
  getMetaIndex: M
162
- } = we({ value: e, length: A, minLength: v, maxLength: B, onChange: l }), p = !!C, [z, N] = O(null), [T, R] = O(null), m = T ? e.find((n) => n.id === T.id && n.url === T.url) ?? null : null;
162
+ } = De({ value: e, length: A, minLength: v, maxLength: B, onChange: l }), p = !!C, [z, N] = O(null), [T, R] = O(null), m = T ? e.find((n) => n.id === T.id && n.url === T.url) ?? null : null;
163
163
  T && !m && R(null);
164
164
  const k = Y(e);
165
165
  V(() => {
@@ -201,7 +201,7 @@ const Ve = ({
201
201
  `).map((o, a) => /* @__PURE__ */ r("span", { children: o }, a));
202
202
  };
203
203
  return /* @__PURE__ */ f("div", { children: [
204
- /* @__PURE__ */ r(le, { sensors: Z, collisionDetection: ie, onDragEnd: ee, children: /* @__PURE__ */ r(se, { items: Q, strategy: ae, children: /* @__PURE__ */ r("div", { className: s.Container, style: { gap: E }, children: S ? Array.from({ length: i }, (n, t) => {
204
+ /* @__PURE__ */ r(le, { sensors: Z, collisionDetection: ie, onDragEnd: ee, children: /* @__PURE__ */ r(se, { items: Q, strategy: ae, children: /* @__PURE__ */ r("div", { className: s.Container, style: { gap: w }, children: E ? Array.from({ length: i }, (n, t) => {
205
205
  const o = K[t], a = e.find((I) => I.position === t);
206
206
  return a ? /* @__PURE__ */ r(
207
207
  X,
@@ -218,7 +218,7 @@ const Ve = ({
218
218
  hasEdit: g,
219
219
  readOnly: c ?? !1,
220
220
  isLoading: y,
221
- onLinkClick: w,
221
+ onLinkClick: D,
222
222
  onDelete: U,
223
223
  onReplace: _,
224
224
  onEdit: N,
@@ -264,7 +264,7 @@ const Ve = ({
264
264
  hasEdit: g,
265
265
  readOnly: c ?? !1,
266
266
  isLoading: y,
267
- onLinkClick: w,
267
+ onLinkClick: D,
268
268
  onDelete: U,
269
269
  onReplace: _,
270
270
  onEdit: N,
@@ -274,7 +274,7 @@ const Ve = ({
274
274
  },
275
275
  n.id
276
276
  )),
277
- !c && Array.from({ length: D }, (n, t) => /* @__PURE__ */ f(
277
+ !c && Array.from({ length: S }, (n, t) => /* @__PURE__ */ f(
278
278
  q,
279
279
  {
280
280
  onDrop: te,
@@ -332,12 +332,12 @@ const Ve = ({
332
332
  },
333
333
  body: { padding: "16px" }
334
334
  },
335
- children: m && /* @__PURE__ */ r(De, { item: m }, `${m.id}:${m.url}`)
335
+ children: m && /* @__PURE__ */ r(Se, { item: m }, `${m.id}:${m.url}`)
336
336
  }
337
337
  )
338
338
  ] });
339
339
  };
340
- function De({ item: e }) {
340
+ function Se({ item: e }) {
341
341
  const [l, d] = O(!1);
342
342
  return /* @__PURE__ */ f("div", { className: s.PreviewContent, children: [
343
343
  /* @__PURE__ */ f("div", { className: s.PreviewControls, role: "group", "aria-label": "이미지 크기 보기", children: [
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { jsx as i, jsxs as S, Fragment as d } from "react/jsx-runtime";
3
+ import { Stepper as r } from "@mantine/core";
4
+ import { IconChevronRight as v, ColorAqua800 as m, ColorGray300 as _ } from "@pop-ui/foundation";
5
+ import a from "./styles.module.scss.js";
6
+ const f = ({
7
+ steps: o,
8
+ value: n,
9
+ onChange: p,
10
+ ariaLabel: c,
11
+ className: s
12
+ }) => {
13
+ const l = o.findIndex((e) => e.value === n);
14
+ return /* @__PURE__ */ i("nav", { "aria-label": c, className: [a.StepNavigation, s].filter(Boolean).join(" "), children: /* @__PURE__ */ i(
15
+ r,
16
+ {
17
+ active: l,
18
+ onStepClick: (e) => {
19
+ const t = o[e];
20
+ t && !t.disabled && t.value !== n && p(t.value);
21
+ },
22
+ allowNextStepsSelect: !0,
23
+ wrap: !1,
24
+ iconSize: 28,
25
+ completedIcon: ({ step: e }) => e + 1,
26
+ classNames: {
27
+ steps: a.StepNavigation__Steps,
28
+ separator: a.StepNavigation__Separator,
29
+ step: a.StepNavigation__Step,
30
+ stepBody: a.StepNavigation__StepBody,
31
+ stepLabel: a.StepNavigation__StepLabel,
32
+ stepIcon: a.StepNavigation__StepIcon,
33
+ stepCompletedIcon: a.StepNavigation__CompletedIcon
34
+ },
35
+ children: o.map((e, t) => /* @__PURE__ */ i(
36
+ r.Step,
37
+ {
38
+ disabled: e.disabled,
39
+ "aria-current": t === l ? "step" : void 0,
40
+ label: /* @__PURE__ */ S(d, { children: [
41
+ e.label,
42
+ t < o.length - 1 && /* @__PURE__ */ i(
43
+ v,
44
+ {
45
+ size: 24,
46
+ color: t === l ? m : _,
47
+ "aria-hidden": "true"
48
+ }
49
+ )
50
+ ] })
51
+ },
52
+ e.value
53
+ ))
54
+ }
55
+ ) });
56
+ };
57
+ export {
58
+ f as StepNavigation
59
+ };
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ const t = "styles-module__StepNavigation___ZjuVV", _ = "styles-module__StepNavigation__Steps___q7Ha9", e = "styles-module__StepNavigation__Separator___Ncya0", a = "styles-module__StepNavigation__Step___kPz8V", o = "styles-module__StepNavigation__StepLabel___bR06B", i = "styles-module__StepNavigation__StepBody___AXzjN", p = "styles-module__StepNavigation__StepIcon___TRcPN", S = "styles-module__StepNavigation__CompletedIcon___4-Mgd", n = {
3
+ StepNavigation: t,
4
+ StepNavigation__Steps: _,
5
+ StepNavigation__Separator: e,
6
+ StepNavigation__Step: a,
7
+ StepNavigation__StepLabel: o,
8
+ StepNavigation__StepBody: i,
9
+ StepNavigation__StepIcon: p,
10
+ StepNavigation__CompletedIcon: S
11
+ };
12
+ export {
13
+ t as StepNavigation,
14
+ S as StepNavigation__CompletedIcon,
15
+ e as StepNavigation__Separator,
16
+ a as StepNavigation__Step,
17
+ i as StepNavigation__StepBody,
18
+ p as StepNavigation__StepIcon,
19
+ o as StepNavigation__StepLabel,
20
+ _ as StepNavigation__Steps,
21
+ n as default
22
+ };
@@ -169,6 +169,8 @@ export declare interface IImageInputItem {
169
169
  file?: File;
170
170
  isLoading?: boolean;
171
171
  position?: number;
172
+ /** 이 항목만 삭제 버튼 노출 여부를 따로 정한다. 없으면 컴포넌트의 `canDelete` 를 따른다. */
173
+ canDelete?: boolean;
172
174
  }
173
175
 
174
176
  export declare interface IImageInputProps {
@@ -395,6 +397,20 @@ export declare interface ISegmentButtonProps extends SegmentedControlProps {
395
397
  radius?: number | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
396
398
  }
397
399
 
400
+ export declare interface IStepNavigationProps {
401
+ steps: readonly IStepNavigationStep[];
402
+ value: string;
403
+ onChange: (value: string) => void;
404
+ ariaLabel: string;
405
+ className?: string;
406
+ }
407
+
408
+ export declare interface IStepNavigationStep {
409
+ value: string;
410
+ label: string;
411
+ disabled?: boolean;
412
+ }
413
+
398
414
  export declare interface ITabProps extends TabsProps {
399
415
  tabList: {
400
416
  title: string;
@@ -482,6 +498,8 @@ export declare const SearchBar: ({ label, labelPosition, size, required, tooltip
482
498
 
483
499
  export declare const SegmentButton: ({ size, radius, ...props }: ISegmentButtonProps) => JSX.Element;
484
500
 
501
+ export declare const StepNavigation: ({ steps, value, onChange, ariaLabel, className, }: IStepNavigationProps) => JSX.Element;
502
+
485
503
  export declare const Tab: ({ tabList, containerPaddingTop, ...props }: ITabProps) => JSX.Element;
486
504
 
487
505
  export declare type TButtonSize = 'sm' | 'md' | 'lg';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pop-ui/core",
3
3
  "type": "module",
4
- "version": "2.2.7",
4
+ "version": "2.3.1",
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.7",
50
+ "@pop-ui/foundation": "2.3.1",
51
51
  "dayjs": "^1.11.18",
52
52
  "lottie-react": "^2.4.1",
53
53
  "react-easy-crop": "^5.5.3"