@wipco/sdui 0.25.0 → 0.27.0

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.
@@ -0,0 +1,135 @@
1
+ import React, { useRef, useEffect, useSyncExternalStore } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ // src/overlay.tsx
6
+ var OVERLAY_ROOT_ID = "wp-overlay-root";
7
+ var DOCUMENT_POSITION_FOLLOWING = 4;
8
+ function getOverlayRoot() {
9
+ if (typeof document === "undefined") return null;
10
+ const existing = document.getElementById(OVERLAY_ROOT_ID);
11
+ if (existing) return existing;
12
+ const created = document.createElement("div");
13
+ created.id = OVERLAY_ROOT_ID;
14
+ document.body.appendChild(created);
15
+ return created;
16
+ }
17
+ var layers = [];
18
+ var nextId = 0;
19
+ var subscribers = /* @__PURE__ */ new Set();
20
+ var keyListenerBound = false;
21
+ function emit() {
22
+ layers = layers.slice();
23
+ subscribers.forEach((fn) => fn());
24
+ }
25
+ function topLayer(list) {
26
+ let best;
27
+ let bestNode = null;
28
+ for (const layer of list) {
29
+ const node = layer.node();
30
+ if (!best) {
31
+ best = layer;
32
+ bestNode = node;
33
+ continue;
34
+ }
35
+ if (!node) continue;
36
+ if (!bestNode) {
37
+ best = layer;
38
+ bestNode = node;
39
+ continue;
40
+ }
41
+ if (bestNode.compareDocumentPosition(node) & DOCUMENT_POSITION_FOLLOWING) {
42
+ best = layer;
43
+ bestNode = node;
44
+ }
45
+ }
46
+ return best;
47
+ }
48
+ function layerHoldsTop(list, id) {
49
+ const top = topLayer(list);
50
+ if (!top) return false;
51
+ if (top.id === id) return true;
52
+ const mine = list.find((l) => l.id === id)?.node();
53
+ const topNode = top.node();
54
+ return !!mine && !!topNode && mine.contains(topNode);
55
+ }
56
+ function escapeTopmost() {
57
+ topLayer(layers)?.onEscape();
58
+ }
59
+ function handleKeyDown(event) {
60
+ if (event.key !== "Escape") return;
61
+ escapeTopmost();
62
+ }
63
+ function push(layer) {
64
+ layers.push(layer);
65
+ if (!keyListenerBound && typeof document !== "undefined") {
66
+ document.addEventListener("keydown", handleKeyDown);
67
+ keyListenerBound = true;
68
+ }
69
+ emit();
70
+ }
71
+ function remove(id) {
72
+ layers = layers.filter((l) => l.id !== id);
73
+ emit();
74
+ }
75
+ function subscribe(fn) {
76
+ subscribers.add(fn);
77
+ return () => {
78
+ subscribers.delete(fn);
79
+ };
80
+ }
81
+ var snapshot = () => layers;
82
+ var serverSnapshot = () => [];
83
+ function useOverlayLayer(active, onEscape, nodeRef) {
84
+ const idRef = useRef(0);
85
+ if (idRef.current === 0) idRef.current = ++nextId;
86
+ const escapeRef = useRef(onEscape);
87
+ escapeRef.current = onEscape;
88
+ const nodeRefRef = useRef(nodeRef);
89
+ nodeRefRef.current = nodeRef;
90
+ useEffect(() => {
91
+ if (!active) return;
92
+ const id2 = idRef.current;
93
+ push({
94
+ id: id2,
95
+ onEscape: () => escapeRef.current?.(),
96
+ node: () => nodeRefRef.current?.current ?? null
97
+ });
98
+ return () => remove(id2);
99
+ }, [active]);
100
+ const current = useSyncExternalStore(subscribe, snapshot, serverSnapshot);
101
+ const id = idRef.current;
102
+ return {
103
+ isTop: active && topLayer(current)?.id === id,
104
+ holdsTop: active && layerHoldsTop(current, id)
105
+ };
106
+ }
107
+ var OverlayContainerContext = React.createContext(null);
108
+ function OverlayLayer({
109
+ onClose,
110
+ children
111
+ }) {
112
+ const ref = useRef(null);
113
+ const container = React.useContext(OverlayContainerContext);
114
+ const { holdsTop } = useOverlayLayer(true, onClose, ref);
115
+ useEffect(() => {
116
+ ref.current?.toggleAttribute("inert", !holdsTop);
117
+ }, [holdsTop]);
118
+ const layer = /* @__PURE__ */ jsx(
119
+ "div",
120
+ {
121
+ ref,
122
+ className: "wp-overlay-layer",
123
+ onClick: (event) => {
124
+ if (onClose && event.target instanceof HTMLElement && event.target.classList.contains("wp-overlay")) {
125
+ onClose();
126
+ }
127
+ },
128
+ children
129
+ }
130
+ );
131
+ const root = container ?? getOverlayRoot();
132
+ return root ? createPortal(layer, root) : layer;
133
+ }
134
+
135
+ export { OverlayContainerContext, OverlayLayer, getOverlayRoot, useOverlayLayer };
@@ -0,0 +1,359 @@
1
+ import { TagMultiSelect } from './chunk-QDEZXA34.js';
2
+ import { ApprovalLineEditor, stepTypeIcon, stepLabel } from './chunk-SAPJVLZM.js';
3
+ import { useSduiAdapter, hostFetchOf, defaultAdapter } from './chunk-DVOPZFQS.js';
4
+ import { Card, Icon, Input, IconButton, Field, Button, Badge } from './chunk-WIDDHR7L.js';
5
+ import { boxed } from './chunk-SAN4IX6N.js';
6
+ import React, { useState, useEffect } from 'react';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
+
9
+ function facetsFrom(rows) {
10
+ const titles = /* @__PURE__ */ new Set();
11
+ const grades = /* @__PURE__ */ new Set();
12
+ if (Array.isArray(rows)) {
13
+ for (const row of rows) {
14
+ if (typeof row !== "object" || row === null) continue;
15
+ const title = row.job_title;
16
+ const grade = row.grade;
17
+ if (typeof title === "string" && title.trim()) titles.add(title.trim());
18
+ if (typeof grade === "string" && grade.trim()) grades.add(grade.trim());
19
+ }
20
+ }
21
+ const ko = (a, b) => a.localeCompare(b, "ko");
22
+ return { titles: [...titles].sort(ko), grades: [...grades].sort(ko) };
23
+ }
24
+ var uidCounter = 0;
25
+ var uid = (prefix) => `${prefix}-${Date.now()}-${++uidCounter}`;
26
+ var describeScope = (override) => {
27
+ const identityParts = [];
28
+ if (override.jobTitles.length > 0) identityParts.push(`\uC9C1\uCC45 ${override.jobTitles.join(", ")}`);
29
+ if (override.grades.length > 0) identityParts.push(`\uC9C1\uAE09 ${override.grades.join(", ")}`);
30
+ const legacyEntities = override.entityTypes ?? [];
31
+ const identityPart = identityParts.length > 0 ? identityParts.join(" \uB610\uB294 ") : legacyEntities.length > 0 ? "\uC9C1\uCC45\xB7\uC9C1\uAE09 \uC870\uAC74 \uC5C6\uC74C (\uC804 \uC9C1\uC6D0 \uC801\uC6A9)" : "\uC9C1\uCC45\xB7\uC9C1\uAE09 \uC870\uAC74 \uC5C6\uC74C (\uB9E4\uCE6D\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4)";
32
+ if (legacyEntities.length === 0) return identityPart;
33
+ return `${identityPart} \xB7 \uC5C5\uBB34\uC720\uD615 ${legacyEntities.join(", ")} \uD55C\uC815`;
34
+ };
35
+ var withSelected = (options, selected) => [...options, ...selected.filter((value) => !options.includes(value))].map((value) => ({
36
+ value,
37
+ label: value
38
+ }));
39
+ var orderCircleStyle = {
40
+ display: "inline-flex",
41
+ alignItems: "center",
42
+ justifyContent: "center",
43
+ width: 28,
44
+ height: 28,
45
+ flex: "none",
46
+ borderRadius: "var(--wp-radius-pill)",
47
+ background: "var(--wp-surface-brand-tint)",
48
+ color: "var(--wp-text-brand)"
49
+ };
50
+ function StepSummary({ steps }) {
51
+ if (steps.length === 0) {
52
+ return /* @__PURE__ */ jsx("span", { className: "wp-caption", children: "\uACB0\uC7AC \uB2E8\uACC4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uB9E4\uCE6D \uC2DC \uC790\uB3D9 \uC2B9\uC778\uB429\uB2C8\uB2E4." });
53
+ }
54
+ return /* @__PURE__ */ jsx("div", { className: "wp-row", style: { flexWrap: "wrap", gap: "var(--wp-space-1)" }, children: steps.map((step, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
55
+ /* @__PURE__ */ jsxs(Badge, { tone: "neutral", children: [
56
+ /* @__PURE__ */ jsx(
57
+ Icon,
58
+ {
59
+ name: stepTypeIcon(step.type),
60
+ size: 12,
61
+ style: { marginRight: "var(--wp-space-1)" }
62
+ }
63
+ ),
64
+ stepLabel(step)
65
+ ] }),
66
+ index < steps.length - 1 ? /* @__PURE__ */ jsx(Icon, { name: "arrow-right", size: 12, style: { color: "var(--wp-text-muted)", flex: "none" } }) : null
67
+ ] }, step.id)) });
68
+ }
69
+ function ApprovalOverridesEditorImpl({
70
+ value,
71
+ onChange,
72
+ jobTitleOptions,
73
+ gradeOptions,
74
+ facetsEndpoint,
75
+ searchEndpoint,
76
+ groupSearchEndpoint,
77
+ searchOptions,
78
+ disabled = false
79
+ }) {
80
+ const adapter = useSduiAdapter();
81
+ const api = hostFetchOf(adapter) ?? defaultAdapter.fetch;
82
+ const overrides = value ?? [];
83
+ const [fetchedFacets, setFetchedFacets] = useState(
84
+ null
85
+ );
86
+ useEffect(() => {
87
+ if (!facetsEndpoint) return;
88
+ let alive = true;
89
+ api(facetsEndpoint, { method: "GET" }).then((response) => {
90
+ if (!alive) return;
91
+ const body = response;
92
+ const rows = Array.isArray(response) ? response : body?.data ?? [];
93
+ setFetchedFacets(facetsFrom(rows));
94
+ }).catch(() => {
95
+ });
96
+ return () => {
97
+ alive = false;
98
+ };
99
+ }, [facetsEndpoint]);
100
+ const mergedTitles = [
101
+ ...jobTitleOptions ?? [],
102
+ ...(fetchedFacets?.titles ?? []).filter((t) => !(jobTitleOptions ?? []).includes(t))
103
+ ];
104
+ const mergedGrades = [
105
+ ...gradeOptions ?? [],
106
+ ...(fetchedFacets?.grades ?? []).filter((g) => !(gradeOptions ?? []).includes(g))
107
+ ];
108
+ const updateOverride = (id, patch) => {
109
+ onChange?.(
110
+ overrides.map((override) => override.id === id ? { ...override, ...patch } : override)
111
+ );
112
+ };
113
+ const addOverride = () => {
114
+ onChange?.([...overrides, { id: uid("line"), name: "", jobTitles: [], grades: [], steps: [] }]);
115
+ };
116
+ const removeOverride = (id) => {
117
+ onChange?.(overrides.filter((override) => override.id !== id));
118
+ };
119
+ const duplicateOverride = (index) => {
120
+ const source = overrides[index];
121
+ if (!source) return;
122
+ const copy = {
123
+ ...source,
124
+ id: uid("line"),
125
+ name: source.name.trim() ? `${source.name} (\uBCF5\uC0AC\uBCF8)` : "",
126
+ jobTitles: [...source.jobTitles],
127
+ grades: [...source.grades],
128
+ steps: source.steps.map((step) => ({
129
+ ...step,
130
+ id: uid("step"),
131
+ customApprovers: step.customApprovers?.map((approver) => ({ ...approver }))
132
+ }))
133
+ };
134
+ const next = [...overrides];
135
+ next.splice(index + 1, 0, copy);
136
+ onChange?.(next);
137
+ };
138
+ const moveOverride = (index, direction) => {
139
+ const target = index + direction;
140
+ if (target < 0 || target >= overrides.length) return;
141
+ const next = [...overrides];
142
+ [next[index], next[target]] = [next[target], next[index]];
143
+ onChange?.(next);
144
+ };
145
+ const [dragIndex, setDragIndex] = useState(null);
146
+ const [dropIndex, setDropIndex] = useState(null);
147
+ const finishDrag = () => {
148
+ if (dragIndex !== null && dropIndex !== null && dragIndex !== dropIndex) {
149
+ const next = [...overrides];
150
+ const [moved] = next.splice(dragIndex, 1);
151
+ next.splice(dropIndex, 0, moved);
152
+ onChange?.(next);
153
+ }
154
+ setDragIndex(null);
155
+ setDropIndex(null);
156
+ };
157
+ return /* @__PURE__ */ jsxs("div", { className: "wp-col", style: { gap: "var(--wp-space-3)" }, children: [
158
+ /* @__PURE__ */ jsx("span", { className: "wp-caption", children: "\uC694\uCCAD\uC790\uC758 \uC9C1\uCC45\xB7\uC9C1\uAE09\uC5D0 \uB530\uB77C \uAE30\uBCF8 \uACB0\uC7AC\uC120 \uB300\uC2E0 \uC801\uC6A9\uD560 \uACB0\uC7AC\uB77C\uC778\uC785\uB2C8\uB2E4. \uC9C1\uCC45\uACFC \uC9C1\uAE09 \uC911 \uD558\uB098\uB9CC \uB9DE\uC544\uB3C4 \uC801\uC6A9\uB418\uBA70, \uC704\uC5D0\uC11C\uBD80\uD130 \uBA3C\uC800 \uB9E4\uCE6D\uB418\uB294 \uACB0\uC7AC\uB77C\uC778\uC774 \uC6B0\uC120 \uC801\uC6A9\uB429\uB2C8\uB2E4." }),
159
+ overrides.length === 0 ? /* @__PURE__ */ jsx(
160
+ "div",
161
+ {
162
+ className: "wp-body-sm",
163
+ style: {
164
+ border: "var(--wp-border-w) dashed var(--wp-border-default)",
165
+ borderRadius: "var(--wp-radius-lg)",
166
+ padding: "var(--wp-space-4)",
167
+ textAlign: "center",
168
+ color: "var(--wp-text-muted)"
169
+ },
170
+ children: "\uC124\uC815\uB41C \uC9C1\uAE09/\uC9C1\uCC45\uBCC4 \uACB0\uC7AC\uB77C\uC778\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."
171
+ }
172
+ ) : overrides.map((override, index) => /* @__PURE__ */ jsx(
173
+ Card,
174
+ {
175
+ padding: "tight",
176
+ style: {
177
+ // 드롭 목적지 표시 — 삽입될 자리의 카드 위에 브랜드 선을 긋는다.
178
+ boxShadow: dropIndex === index && dragIndex !== null && dragIndex !== index ? "0 calc(-1 * var(--wp-space-1)) 0 0 var(--wp-border-brand)" : void 0,
179
+ opacity: dragIndex === index ? 0.5 : void 0
180
+ },
181
+ onDragOver: (event) => {
182
+ if (dragIndex === null) return;
183
+ event.preventDefault();
184
+ if (dropIndex !== index) setDropIndex(index);
185
+ },
186
+ onDrop: (event) => {
187
+ event.preventDefault();
188
+ finishDrag();
189
+ },
190
+ children: /* @__PURE__ */ jsxs("div", { className: "wp-col", style: { gap: "var(--wp-space-3)" }, children: [
191
+ /* @__PURE__ */ jsxs("div", { className: "wp-row", style: { alignItems: "center" }, children: [
192
+ /* @__PURE__ */ jsx(
193
+ "span",
194
+ {
195
+ draggable: !disabled,
196
+ "aria-hidden": true,
197
+ title: "\uB04C\uC5B4\uC11C \uC6B0\uC120\uC21C\uC704 \uBCC0\uACBD",
198
+ style: {
199
+ cursor: disabled ? "default" : "grab",
200
+ color: "var(--wp-text-muted)",
201
+ display: "inline-flex",
202
+ flex: "none",
203
+ touchAction: "none"
204
+ },
205
+ onDragStart: (event) => {
206
+ event.dataTransfer.setData("text/plain", String(index));
207
+ event.dataTransfer.effectAllowed = "move";
208
+ setDragIndex(index);
209
+ },
210
+ onDragEnd: () => {
211
+ setDragIndex(null);
212
+ setDropIndex(null);
213
+ },
214
+ children: /* @__PURE__ */ jsx(Icon, { name: "grip-vertical", size: 16 })
215
+ }
216
+ ),
217
+ /* @__PURE__ */ jsx("span", { className: "wp-body-sm", style: orderCircleStyle, title: "\uB9E4\uCE6D \uC6B0\uC120\uC21C\uC704", children: index + 1 }),
218
+ /* @__PURE__ */ jsx("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsx(
219
+ Input,
220
+ {
221
+ "aria-label": "\uACB0\uC7AC\uB77C\uC778 \uC774\uB984",
222
+ value: override.name,
223
+ disabled,
224
+ placeholder: "\uC608: \uD300\uC7A5 \uC2B9\uC778 \uC0DD\uB7B5 \uB77C\uC778",
225
+ onChange: (event) => updateOverride(override.id, { name: event.target.value })
226
+ }
227
+ ) }),
228
+ /* @__PURE__ */ jsxs("div", { className: "wp-row", style: { flex: "none", gap: "var(--wp-space-1)" }, children: [
229
+ /* @__PURE__ */ jsx(
230
+ IconButton,
231
+ {
232
+ type: "button",
233
+ icon: "chevron-up",
234
+ label: "\uC6B0\uC120\uC21C\uC704 \uC62C\uB9AC\uAE30",
235
+ size: "sm",
236
+ disabled: disabled || index === 0,
237
+ onClick: () => moveOverride(index, -1)
238
+ }
239
+ ),
240
+ /* @__PURE__ */ jsx(
241
+ IconButton,
242
+ {
243
+ type: "button",
244
+ icon: "chevron-down",
245
+ label: "\uC6B0\uC120\uC21C\uC704 \uB0B4\uB9AC\uAE30",
246
+ size: "sm",
247
+ disabled: disabled || index === overrides.length - 1,
248
+ onClick: () => moveOverride(index, 1)
249
+ }
250
+ ),
251
+ /* @__PURE__ */ jsx(
252
+ IconButton,
253
+ {
254
+ type: "button",
255
+ icon: "copy",
256
+ label: "\uACB0\uC7AC\uB77C\uC778 \uBCF5\uC81C",
257
+ size: "sm",
258
+ disabled,
259
+ onClick: () => duplicateOverride(index)
260
+ }
261
+ ),
262
+ /* @__PURE__ */ jsx(
263
+ IconButton,
264
+ {
265
+ type: "button",
266
+ icon: "trash-2",
267
+ label: "\uACB0\uC7AC\uB77C\uC778 \uC0AD\uC81C",
268
+ variant: "danger",
269
+ size: "sm",
270
+ disabled,
271
+ onClick: () => removeOverride(override.id)
272
+ }
273
+ )
274
+ ] })
275
+ ] }),
276
+ /* @__PURE__ */ jsxs("div", { className: "wp-col", style: { gap: "var(--wp-space-1)" }, children: [
277
+ /* @__PURE__ */ jsx("span", { className: "wp-caption", children: describeScope(override) }),
278
+ /* @__PURE__ */ jsx(StepSummary, { steps: override.steps })
279
+ ] }),
280
+ /* @__PURE__ */ jsx(
281
+ Field,
282
+ {
283
+ label: "\uC801\uC6A9 \uC9C1\uCC45",
284
+ hint: "\uC120\uD0DD\uD55C \uC9C1\uCC45 \uC911 \uD558\uB098\uB77C\uB3C4 \uC77C\uCE58\uD558\uBA74 \uC774 \uACB0\uC7AC\uB77C\uC778\uC774 \uC801\uC6A9\uB429\uB2C8\uB2E4.",
285
+ children: /* @__PURE__ */ jsx(
286
+ TagMultiSelect,
287
+ {
288
+ options: withSelected(mergedTitles, override.jobTitles),
289
+ values: override.jobTitles,
290
+ disabled,
291
+ emptyText: "\uC120\uD0DD \uAC00\uB2A5\uD55C \uC9C1\uCC45\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",
292
+ onChange: (jobTitles) => updateOverride(override.id, { jobTitles })
293
+ }
294
+ )
295
+ }
296
+ ),
297
+ /* @__PURE__ */ jsx(
298
+ Field,
299
+ {
300
+ label: "\uC801\uC6A9 \uC9C1\uAE09",
301
+ hint: "\uC9C1\uCC45 \uC870\uAC74\uACFC OR \u2014 \uC9C1\uAE09\uB9CC \uC77C\uCE58\uD574\uB3C4 \uC801\uC6A9\uB429\uB2C8\uB2E4.",
302
+ children: /* @__PURE__ */ jsx(
303
+ TagMultiSelect,
304
+ {
305
+ options: withSelected(mergedGrades, override.grades),
306
+ values: override.grades,
307
+ disabled,
308
+ emptyText: "\uC120\uD0DD \uAC00\uB2A5\uD55C \uC9C1\uAE09\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",
309
+ onChange: (grades) => updateOverride(override.id, { grades })
310
+ }
311
+ )
312
+ }
313
+ ),
314
+ /* @__PURE__ */ jsxs(
315
+ "div",
316
+ {
317
+ className: "wp-col",
318
+ style: {
319
+ gap: "var(--wp-space-2)",
320
+ borderTop: "var(--wp-border-w) solid var(--wp-divider)",
321
+ paddingTop: "var(--wp-space-3)"
322
+ },
323
+ children: [
324
+ /* @__PURE__ */ jsx("span", { className: "wp-label", children: "\uC774 \uACB0\uC7AC\uB77C\uC778\uC758 \uACB0\uC7AC \uB2E8\uACC4" }),
325
+ /* @__PURE__ */ jsx(
326
+ ApprovalLineEditor,
327
+ {
328
+ value: override.steps,
329
+ onChange: (steps) => updateOverride(override.id, { steps }),
330
+ searchEndpoint,
331
+ groupSearchEndpoint,
332
+ options: searchOptions,
333
+ disabled
334
+ }
335
+ )
336
+ ]
337
+ }
338
+ )
339
+ ] })
340
+ },
341
+ override.id
342
+ )),
343
+ /* @__PURE__ */ jsx("div", { className: "wp-row", children: /* @__PURE__ */ jsx(
344
+ Button,
345
+ {
346
+ type: "button",
347
+ variant: "secondary",
348
+ icon: "plus",
349
+ disabled,
350
+ title: disabled ? "\uBE44\uD65C\uC131\uD654\uB428" : void 0,
351
+ onClick: addOverride,
352
+ children: "\uACB0\uC7AC\uB77C\uC778 \uCD94\uAC00"
353
+ }
354
+ ) })
355
+ ] });
356
+ }
357
+ var ApprovalOverridesEditor = boxed(ApprovalOverridesEditorImpl, "ApprovalOverridesEditor");
358
+
359
+ export { ApprovalOverridesEditor };
package/dist/index.js CHANGED
@@ -1,18 +1,21 @@
1
- import { TimePicker } from './chunk-36MXPCJP.js';
2
- export { TimePicker, loadOptionalModule } from './chunk-36MXPCJP.js';
1
+ import { TimePicker } from './chunk-WXOU7QTN.js';
2
+ export { TimePicker, loadOptionalModule } from './chunk-WXOU7QTN.js';
3
+ import { useSduiDispatch, SduiDialog, useSduiCan, SduiDispatchContext, SduiPermissionProvider } from './chunk-QU7YVMFA.js';
4
+ export { SduiDialog, SduiPermissionProvider, useSduiCan, useSduiDispatch } from './chunk-QU7YVMFA.js';
3
5
  import { ImageViewer } from './chunk-THEP3VWY.js';
4
6
  export { ImageViewer } from './chunk-THEP3VWY.js';
5
- import { normalizeSearchFields, searchValuesFromParams, splitMultiValue, includesLooseSearch, cascadingValuePaths, SearchToolbar, searchFieldKeys, Popover } from './chunk-U7ZK7WYH.js';
6
- export { SearchToolbar, cascadingValuePaths, cleanSearchValues, includesLooseSearch, joinMultiValue, normalizeSearchText, searchFieldKeys, searchValuesFromParams, splitMultiValue } from './chunk-U7ZK7WYH.js';
7
+ import { normalizeSearchFields, searchValuesFromParams, splitMultiValue, includesLooseSearch, cascadingValuePaths, SearchToolbar, searchFieldKeys, Popover } from './chunk-BD75U73S.js';
8
+ export { SearchToolbar, cascadingValuePaths, cleanSearchValues, includesLooseSearch, joinMultiValue, normalizeSearchText, searchFieldKeys, searchValuesFromParams, splitMultiValue } from './chunk-BD75U73S.js';
7
9
  import { DEV, isSafeNavigationTarget, useSduiAdapter, hostFetchOf, useSduiSandbox, resolveAdapter, assetResolverOf, SduiAdapterContext } from './chunk-DVOPZFQS.js';
8
10
  export { defaultAdapter, useSduiAssetResolver, useSduiSandbox } from './chunk-DVOPZFQS.js';
9
- import { HoistedStyle, DateRangePicker, DatePicker, OverlayLayer } from './chunk-XKLUCUVA.js';
10
- export { DatePicker, DateRangePicker, OverlayContainerContext, OverlayLayer, getOverlayRoot, useOverlayLayer } from './chunk-XKLUCUVA.js';
11
- import { EmptyState, Button, Checkbox, SegmentedControl, Spinner, Select, Pagination, Icon, Card, Badge, ProgressBar, Tag, Toast, Textarea, Tabs, Table, Switch, StatCard, Input, IconButton, Field, Alert, warnOnce, Dialog } from './chunk-WIDDHR7L.js';
11
+ import { HoistedStyle, DateRangePicker, DatePicker } from './chunk-EFMKWPZ3.js';
12
+ export { DatePicker, DateRangePicker } from './chunk-EFMKWPZ3.js';
13
+ export { OverlayContainerContext, OverlayLayer, getOverlayRoot, useOverlayLayer } from './chunk-XQPTSEJC.js';
14
+ import { EmptyState, Button, Checkbox, SegmentedControl, Spinner, Select, Pagination, Icon, Card, Badge, ProgressBar, Tag, Toast, Textarea, Tabs, Table, Switch, StatCard, Input, IconButton, Field, Alert, warnOnce } from './chunk-WIDDHR7L.js';
12
15
  export { Alert, Avatar, Badge, Breadcrumb, Button, Card, Checkbox, Dialog, EmptyState, Field, Icon, IconButton, Input, Pagination, ProgressBar, Radio, SegmentedControl, Select, SidebarNav, Spinner, StatCard, Switch, Table, Tabs, Tag, Textarea, Toast, Tooltip } from './chunk-WIDDHR7L.js';
13
16
  import { boxed, mergeStyle, containerLayoutStyle, joinClass, columnsClass, typographyStyle, LAYOUT_CSS, childLayoutFrom, CHILD_LAYOUT_PROPS } from './chunk-SAN4IX6N.js';
14
17
  export { CHILD_LAYOUT_PROPS, LAYOUT_CSS, boxed, childLayoutFrom, columnsClass, containerLayoutStyle, joinClass, mergeStyle, typographyStyle } from './chunk-SAN4IX6N.js';
15
- import React11, { createContext, useState, useMemo, useContext, useRef, useEffect, useCallback } from 'react';
18
+ import React10, { createContext, useState, useMemo, useRef, useEffect, useCallback, useContext } from 'react';
16
19
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
17
20
 
18
21
  // src/asset-url.ts
@@ -109,15 +112,7 @@ function resolveAssetsIn(propName, value, resolve, component) {
109
112
  return out ?? record;
110
113
  }
111
114
  }
112
- var SduiDispatchContext = createContext(null);
113
- function useSduiDispatch() {
114
- const dispatch = useContext(SduiDispatchContext);
115
- if (!dispatch) {
116
- throw new Error("useSduiDispatch\uB294 SduiRenderer \uB0B4\uBD80\uC5D0\uC11C\uB9CC \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.");
117
- }
118
- return dispatch;
119
- }
120
- var NodeErrorBoundary = class extends React11.Component {
115
+ var NodeErrorBoundary = class extends React10.Component {
121
116
  state = { error: null };
122
117
  static getDerivedStateFromError(error) {
123
118
  return { error };
@@ -157,27 +152,6 @@ var NodeErrorBoundary = class extends React11.Component {
157
152
  return this.props.children;
158
153
  }
159
154
  };
160
- var ALLOW_ALL = () => true;
161
- var DENY_ALL = () => false;
162
- var MISSING = () => {
163
- warnOnce(
164
- "permission:missing",
165
- '[sdui] \uAD8C\uD55C \uD310\uC815(can)\uC774 \uC8FC\uC785\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4 \u2014 <Can>\uC774 \uC804\uBD80 \uD1B5\uACFC\uD569\uB2C8\uB2E4. SduiRenderer\uC5D0 can \uCF5C\uBC31\uC744 \uB118\uAE30\uAC70\uB098, \uC138\uC158\uC774 \uC5C6\uB294 \uBBF8\uB9AC\uBCF4\uAE30\uB77C\uBA74 can="allow-all"\uC744 \uBA85\uC2DC\uD558\uC138\uC694.'
166
- );
167
- return true;
168
- };
169
- var SduiPermissionContext = createContext(null);
170
- function SduiPermissionProvider({ can, children }) {
171
- const value = useMemo(() => {
172
- if (can === "allow-all") return ALLOW_ALL;
173
- if (can === "deny-all") return DENY_ALL;
174
- return typeof can === "function" ? can : null;
175
- }, [can]);
176
- return /* @__PURE__ */ jsx(SduiPermissionContext.Provider, { value, children });
177
- }
178
- function useSduiCan() {
179
- return useContext(SduiPermissionContext) ?? MISSING;
180
- }
181
155
  function Can({ entity, action = "read", scope, fallback = null, children }) {
182
156
  const can = useSduiCan();
183
157
  if (typeof entity !== "string" || entity === "") {
@@ -304,7 +278,7 @@ function KeyValueList({ source, items, className, style }) {
304
278
  return /* @__PURE__ */ jsx("div", { className: joinClass("wp-kv", className), style, children: (items ?? []).map((item, index) => {
305
279
  const raw = item.key ? source?.[item.key] : item.value;
306
280
  const content = raw === null || raw === void 0 || raw === "" ? "\u2014" : raw;
307
- return /* @__PURE__ */ jsxs(React11.Fragment, { children: [
281
+ return /* @__PURE__ */ jsxs(React10.Fragment, { children: [
308
282
  /* @__PURE__ */ jsx("span", { className: "wp-kv__k", children: item.label }),
309
283
  /* @__PURE__ */ jsx("span", { className: joinClass("wp-kv__v", item.mono && "wp-mono"), children: content })
310
284
  ] }, index);
@@ -1365,9 +1339,6 @@ function RemoteSearchResultsImpl({
1365
1339
  }
1366
1340
  var SduiSearchResults = boxed(SduiSearchResultsImpl, "SduiSearchResults");
1367
1341
  var RemoteSearchResults = boxed(RemoteSearchResultsImpl, "RemoteSearchResults");
1368
- function SduiDialog(props) {
1369
- return /* @__PURE__ */ jsx(OverlayLayer, { onClose: props.onClose, children: /* @__PURE__ */ jsx(Dialog, { ...props }) });
1370
- }
1371
1342
  var SduiRuntimeContext = createContext(null);
1372
1343
  function useSduiRuntime() {
1373
1344
  const runtime = useContext(SduiRuntimeContext);
@@ -2668,7 +2639,7 @@ function SduiNodeRenderer({
2668
2639
  return /* @__PURE__ */ jsx(Fragment, { children: rows.map((item, rowIndex) => {
2669
2640
  const rowScope = [...scope, { item, index: rowIndex }];
2670
2641
  const rowKey = isPlainObject4(item) && typeof item.id === "string" ? item.id : rowIndex;
2671
- return /* @__PURE__ */ jsx(React11.Fragment, { children: childList?.map((child, i) => renderChild(child, i, rowScope, engine)) }, rowKey);
2642
+ return /* @__PURE__ */ jsx(React10.Fragment, { children: childList?.map((child, i) => renderChild(child, i, rowScope, engine)) }, rowKey);
2672
2643
  }) });
2673
2644
  }
2674
2645
  if (node.component === "Fragment") {
@@ -2744,11 +2715,11 @@ function SduiNodeRenderer({
2744
2715
  const children = childList?.map((child, i) => renderChild(child, i, scope, engine));
2745
2716
  return /* @__PURE__ */ jsx(Component, { ...props, children });
2746
2717
  }
2747
- var SduiFragmentChainContext = React11.createContext([]);
2718
+ var SduiFragmentChainContext = React10.createContext([]);
2748
2719
  var FRAGMENT_MAX_DEPTH = 4;
2749
2720
  function SduiFragment({ node, scope, engine }) {
2750
2721
  const adapter = useSduiAdapter();
2751
- const chain = React11.useContext(SduiFragmentChainContext);
2722
+ const chain = React10.useContext(SduiFragmentChainContext);
2752
2723
  const raw = isPlainObject4(node.props) ? node.props.id : void 0;
2753
2724
  const id = engine.resolveValue(raw, scope);
2754
2725
  if (typeof id !== "string" || id === "") {
@@ -2803,9 +2774,9 @@ function SduiFragmentBody({
2803
2774
  engine
2804
2775
  }) {
2805
2776
  const spec = useSpec(id);
2806
- const nextChain = React11.useMemo(() => [...chain, id], [chain, id]);
2807
- const bodyScope = React11.useMemo(() => [...scope, { args, callSiteScope: scope }], [scope, args]);
2808
- React11.useEffect(() => {
2777
+ const nextChain = React10.useMemo(() => [...chain, id], [chain, id]);
2778
+ const bodyScope = React10.useMemo(() => [...scope, { args, callSiteScope: scope }], [scope, args]);
2779
+ React10.useEffect(() => {
2809
2780
  if (!DEV || !isPlainObject4(spec) || !Array.isArray(spec.body)) return;
2810
2781
  validateSpec(spec, new Set(Object.keys(engine.registry))).forEach(
2811
2782
  (issue) => console.warn(`[sdui:spec:${id}] ${issue.path} \u2014 ${issue.message}`)
@@ -3296,4 +3267,4 @@ function SduiRenderer({
3296
3267
  );
3297
3268
  }
3298
3269
 
3299
- export { Actions, CALC_OPS, Can, Col, Divider, Grid, KeyValueList, NodeErrorBoundary, PageHead, RemoteSearchResults, ResultTable, Row, SduiDialog, SduiForm, SduiPermissionProvider, SduiRenderer, SduiSearchDataProvider, SduiSearchResults, SearchResults, Section, Show, SortHandle, SortableList, Spacer, Text, cellRenderer, createRegistry, defaultRegistry, imageRenderer, normalizePageSizes, sortableDropIndex, sortableMove, useRemoteSearchPage, useSduiCan, useSduiDispatch, useSduiRuntime, useSearchFetcher, validateSpec };
3270
+ export { Actions, CALC_OPS, Can, Col, Divider, Grid, KeyValueList, NodeErrorBoundary, PageHead, RemoteSearchResults, ResultTable, Row, SduiForm, SduiRenderer, SduiSearchDataProvider, SduiSearchResults, SearchResults, Section, Show, SortHandle, SortableList, Spacer, Text, cellRenderer, createRegistry, defaultRegistry, imageRenderer, normalizePageSizes, sortableDropIndex, sortableMove, useRemoteSearchPage, useSduiRuntime, useSearchFetcher, validateSpec };
package/dist/meta.d.ts CHANGED
@@ -424,6 +424,9 @@ declare const richComponentMeta: {
424
424
  */
425
425
 
426
426
  declare const ApprovalStepperMeta: SduiComponentMeta;
427
+ declare const RankBoardMeta: SduiComponentMeta;
428
+ declare const ApprovalLineEditorMeta: SduiComponentMeta;
429
+ declare const ApprovalOverridesEditorMeta: SduiComponentMeta;
427
430
  declare const AutocompleteFieldMeta: SduiComponentMeta;
428
431
  declare const InlineEditMeta: SduiComponentMeta;
429
432
  declare const JsonFieldMeta: SduiComponentMeta;
@@ -457,7 +460,10 @@ declare const StripMeta: SduiComponentMeta;
457
460
  * 프롭을 못 그린다.
458
461
  */
459
462
  declare const widgetComponentMeta: {
463
+ ApprovalLineEditor: SduiComponentMeta;
464
+ ApprovalOverridesEditor: SduiComponentMeta;
460
465
  ApprovalStepper: SduiComponentMeta;
466
+ RankBoard: SduiComponentMeta;
461
467
  AutocompleteField: SduiComponentMeta;
462
468
  ColumnBoard: SduiComponentMeta;
463
469
  DiffView: SduiComponentMeta;
@@ -590,4 +596,4 @@ declare function paletteGroups(catalog?: Record<string, SduiComponentMeta>): Arr
590
596
  items: SduiComponentMeta[];
591
597
  }>;
592
598
 
593
- export { ActionsMeta, AlertMeta, ApprovalStepperMeta, AutocompleteFieldMeta, AvatarMeta, BadgeMeta, BreadcrumbMeta, ButtonMeta, CanMeta, CardMeta, ChartMeta, CheckboxMeta, ColMeta, ColumnBoardMeta, DatePickerMeta, DateRangePickerMeta, DialogMeta, DiffViewMeta, DisclosureMeta, DividerMeta, EmptyStateMeta, EventCalendarMeta, FieldMeta, ForEachMeta, FormMeta, FragmentMeta, GridMeta, IconButtonMeta, IconMeta, ImageLightboxMeta, InlineEditMeta, InputMeta, JsonFieldMeta, KeyValueListMeta, LiveClockMeta, MapPreviewMeta, OrgChartMeta, PageHeadMeta, PaginationMeta, PeriodFilterMeta, PrintSheetMeta, ProgressBarMeta, RadioMeta, RecordSheetMeta, RemoteSearchResultsMeta, RowMeta, SDUI_CATEGORIES, SELF_AXIS_PROPS, type SduiCategory, type SduiChildrenMeta, type SduiComponentMeta, type SduiDomMeta, type SduiEnumOption, type SduiPropGroup, type SduiPropKind, type SduiPropMeta, type SduiResizeMeta, type SduiSlotMeta, SearchResultsMeta, SearchableMultiPickerMeta, SectionMeta, SecureScreenMeta, SegmentedControlMeta, SelectMeta, ShowMeta, SidebarNavMeta, SortHandleMeta, SortableListMeta, SpacerMeta, SpinnerMeta, StackedMeterMeta, StatCardMeta, StripMeta, SummaryTableMeta, SwitchMeta, TableMeta, TabsMeta, TagMeta, TagMultiSelectMeta, TextMeta, TextareaMeta, TimePickerMeta, TimelineMeta, ToastMeta, TooltipMeta, TreePickerMeta, TreeViewMeta, allComponentMeta, builtinComponentMeta, coreComponentMeta, dsComponentMeta, getComponentMeta, paletteGroups, richComponentMeta, slotNamesOf, widgetComponentMeta, withSelfAxis, withSelfAxisAll };
599
+ export { ActionsMeta, AlertMeta, ApprovalLineEditorMeta, ApprovalOverridesEditorMeta, ApprovalStepperMeta, AutocompleteFieldMeta, AvatarMeta, BadgeMeta, BreadcrumbMeta, ButtonMeta, CanMeta, CardMeta, ChartMeta, CheckboxMeta, ColMeta, ColumnBoardMeta, DatePickerMeta, DateRangePickerMeta, DialogMeta, DiffViewMeta, DisclosureMeta, DividerMeta, EmptyStateMeta, EventCalendarMeta, FieldMeta, ForEachMeta, FormMeta, FragmentMeta, GridMeta, IconButtonMeta, IconMeta, ImageLightboxMeta, InlineEditMeta, InputMeta, JsonFieldMeta, KeyValueListMeta, LiveClockMeta, MapPreviewMeta, OrgChartMeta, PageHeadMeta, PaginationMeta, PeriodFilterMeta, PrintSheetMeta, ProgressBarMeta, RadioMeta, RankBoardMeta, RecordSheetMeta, RemoteSearchResultsMeta, RowMeta, SDUI_CATEGORIES, SELF_AXIS_PROPS, type SduiCategory, type SduiChildrenMeta, type SduiComponentMeta, type SduiDomMeta, type SduiEnumOption, type SduiPropGroup, type SduiPropKind, type SduiPropMeta, type SduiResizeMeta, type SduiSlotMeta, SearchResultsMeta, SearchableMultiPickerMeta, SectionMeta, SecureScreenMeta, SegmentedControlMeta, SelectMeta, ShowMeta, SidebarNavMeta, SortHandleMeta, SortableListMeta, SpacerMeta, SpinnerMeta, StackedMeterMeta, StatCardMeta, StripMeta, SummaryTableMeta, SwitchMeta, TableMeta, TabsMeta, TagMeta, TagMultiSelectMeta, TextMeta, TextareaMeta, TimePickerMeta, TimelineMeta, ToastMeta, TooltipMeta, TreePickerMeta, TreeViewMeta, allComponentMeta, builtinComponentMeta, coreComponentMeta, dsComponentMeta, getComponentMeta, paletteGroups, richComponentMeta, slotNamesOf, widgetComponentMeta, withSelfAxis, withSelfAxisAll };