@wipco/sdui 0.24.0 → 0.26.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.
@@ -1,137 +1,10 @@
1
+ import { useOverlayLayer, OverlayContainerContext, getOverlayRoot } from './chunk-XQPTSEJC.js';
1
2
  import { Icon } from './chunk-WIDDHR7L.js';
2
3
  import { boxed } from './chunk-SAN4IX6N.js';
3
- import React, { useState, useRef, useMemo, useEffect, useCallback, useLayoutEffect, useSyncExternalStore } from 'react';
4
- import { createPortal } from 'react-dom';
4
+ import React, { useState, useRef, useMemo, useEffect, useCallback, useLayoutEffect } from 'react';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
+ import { createPortal } from 'react-dom';
6
7
 
7
- var OVERLAY_ROOT_ID = "wp-overlay-root";
8
- var DOCUMENT_POSITION_FOLLOWING = 4;
9
- function getOverlayRoot() {
10
- if (typeof document === "undefined") return null;
11
- const existing = document.getElementById(OVERLAY_ROOT_ID);
12
- if (existing) return existing;
13
- const created = document.createElement("div");
14
- created.id = OVERLAY_ROOT_ID;
15
- document.body.appendChild(created);
16
- return created;
17
- }
18
- var layers = [];
19
- var nextId = 0;
20
- var subscribers = /* @__PURE__ */ new Set();
21
- var keyListenerBound = false;
22
- function emit() {
23
- layers = layers.slice();
24
- subscribers.forEach((fn) => fn());
25
- }
26
- function topLayer(list) {
27
- let best;
28
- let bestNode = null;
29
- for (const layer of list) {
30
- const node = layer.node();
31
- if (!best) {
32
- best = layer;
33
- bestNode = node;
34
- continue;
35
- }
36
- if (!node) continue;
37
- if (!bestNode) {
38
- best = layer;
39
- bestNode = node;
40
- continue;
41
- }
42
- if (bestNode.compareDocumentPosition(node) & DOCUMENT_POSITION_FOLLOWING) {
43
- best = layer;
44
- bestNode = node;
45
- }
46
- }
47
- return best;
48
- }
49
- function layerHoldsTop(list, id) {
50
- const top = topLayer(list);
51
- if (!top) return false;
52
- if (top.id === id) return true;
53
- const mine = list.find((l) => l.id === id)?.node();
54
- const topNode = top.node();
55
- return !!mine && !!topNode && mine.contains(topNode);
56
- }
57
- function escapeTopmost() {
58
- topLayer(layers)?.onEscape();
59
- }
60
- function handleKeyDown(event) {
61
- if (event.key !== "Escape") return;
62
- escapeTopmost();
63
- }
64
- function push(layer) {
65
- layers.push(layer);
66
- if (!keyListenerBound && typeof document !== "undefined") {
67
- document.addEventListener("keydown", handleKeyDown);
68
- keyListenerBound = true;
69
- }
70
- emit();
71
- }
72
- function remove(id) {
73
- layers = layers.filter((l) => l.id !== id);
74
- emit();
75
- }
76
- function subscribe(fn) {
77
- subscribers.add(fn);
78
- return () => {
79
- subscribers.delete(fn);
80
- };
81
- }
82
- var snapshot = () => layers;
83
- var serverSnapshot = () => [];
84
- function useOverlayLayer(active, onEscape, nodeRef) {
85
- const idRef = useRef(0);
86
- if (idRef.current === 0) idRef.current = ++nextId;
87
- const escapeRef = useRef(onEscape);
88
- escapeRef.current = onEscape;
89
- const nodeRefRef = useRef(nodeRef);
90
- nodeRefRef.current = nodeRef;
91
- useEffect(() => {
92
- if (!active) return;
93
- const id2 = idRef.current;
94
- push({
95
- id: id2,
96
- onEscape: () => escapeRef.current?.(),
97
- node: () => nodeRefRef.current?.current ?? null
98
- });
99
- return () => remove(id2);
100
- }, [active]);
101
- const current = useSyncExternalStore(subscribe, snapshot, serverSnapshot);
102
- const id = idRef.current;
103
- return {
104
- isTop: active && topLayer(current)?.id === id,
105
- holdsTop: active && layerHoldsTop(current, id)
106
- };
107
- }
108
- var OverlayContainerContext = React.createContext(null);
109
- function OverlayLayer({
110
- onClose,
111
- children
112
- }) {
113
- const ref = useRef(null);
114
- const container = React.useContext(OverlayContainerContext);
115
- const { holdsTop } = useOverlayLayer(true, onClose, ref);
116
- useEffect(() => {
117
- ref.current?.toggleAttribute("inert", !holdsTop);
118
- }, [holdsTop]);
119
- const layer = /* @__PURE__ */ jsx(
120
- "div",
121
- {
122
- ref,
123
- className: "wp-overlay-layer",
124
- onClick: (event) => {
125
- if (onClose && event.target instanceof HTMLElement && event.target.classList.contains("wp-overlay")) {
126
- onClose();
127
- }
128
- },
129
- children
130
- }
131
- );
132
- const root = container ?? getOverlayRoot();
133
- return root ? createPortal(layer, root) : layer;
134
- }
135
8
  function HoistedStyle({ id, css }) {
136
9
  return /* @__PURE__ */ jsx("style", { href: id, precedence: "medium", children: css });
137
10
  }
@@ -357,7 +230,7 @@ function Calendar({
357
230
  const moveFocus = (next) => {
358
231
  onFocusDateChange(clampDate(next, minDate, maxDate));
359
232
  };
360
- const handleKeyDown2 = (event) => {
233
+ const handleKeyDown = (event) => {
361
234
  const deltaDays = event.key === "ArrowLeft" ? -1 : event.key === "ArrowRight" ? 1 : event.key === "ArrowUp" ? -7 : event.key === "ArrowDown" ? 7 : 0;
362
235
  if (deltaDays !== 0) {
363
236
  event.preventDefault();
@@ -375,7 +248,7 @@ function Calendar({
375
248
  moveFocus(addMonths(focusDate, event.key === "PageUp" ? -1 : 1));
376
249
  }
377
250
  };
378
- return /* @__PURE__ */ jsx("div", { className: "wp-dp", children: /* @__PURE__ */ jsxs("div", { className: "wp-dp__months", ref: gridRef, onKeyDown: handleKeyDown2, children: [
251
+ return /* @__PURE__ */ jsx("div", { className: "wp-dp", children: /* @__PURE__ */ jsxs("div", { className: "wp-dp__months", ref: gridRef, onKeyDown: handleKeyDown, children: [
379
252
  /* @__PURE__ */ jsxs("div", { className: "wp-dp__nav", children: [
380
253
  /* @__PURE__ */ jsx(
381
254
  "button",
@@ -553,7 +426,7 @@ function DatePickerImpl({
553
426
  }
554
427
  commit(next);
555
428
  };
556
- const handleKeyDown2 = (event) => {
429
+ const handleKeyDown = (event) => {
557
430
  if (event.key === "ArrowDown") {
558
431
  event.preventDefault();
559
432
  if (open) popRef.current?.querySelector('[tabindex="0"]')?.focus();
@@ -586,7 +459,7 @@ function DatePickerImpl({
586
459
  lead: true,
587
460
  expanded: open,
588
461
  onValueChange: handleTextChange,
589
- onKeyDown: handleKeyDown2,
462
+ onKeyDown: handleKeyDown,
590
463
  onPointerDown: () => {
591
464
  if (!disabled && !open) openCalendar(false);
592
465
  }
@@ -706,7 +579,7 @@ function DateRangePickerImpl({
706
579
  commit(fromDate && parsed.getTime() < fromDate.getTime() ? "" : fromValue, masked);
707
580
  }
708
581
  };
709
- const handleKeyDown2 = (which) => (event) => {
582
+ const handleKeyDown = (which) => (event) => {
710
583
  if (event.key === "ArrowDown") {
711
584
  event.preventDefault();
712
585
  if (open) popRef.current?.querySelector('[tabindex="0"]')?.focus();
@@ -761,7 +634,7 @@ function DateRangePickerImpl({
761
634
  expanded: open,
762
635
  ariaLabel: "\uC2DC\uC791\uC77C",
763
636
  onValueChange: (raw) => handleTextChange("from", raw),
764
- onKeyDown: handleKeyDown2("from"),
637
+ onKeyDown: handleKeyDown("from"),
765
638
  onFocus: () => setEnd("from"),
766
639
  onPointerDown: () => {
767
640
  if (!disabled && !open) openCalendar("from", false);
@@ -783,7 +656,7 @@ function DateRangePickerImpl({
783
656
  expanded: open,
784
657
  ariaLabel: "\uC885\uB8CC\uC77C",
785
658
  onValueChange: (raw) => handleTextChange("to", raw),
786
- onKeyDown: handleKeyDown2("to"),
659
+ onKeyDown: handleKeyDown("to"),
787
660
  onFocus: () => setEnd("to"),
788
661
  onPointerDown: () => {
789
662
  if (!disabled && !open) openCalendar("to", false);
@@ -872,4 +745,4 @@ var DP_CSS = `
872
745
  var DatePicker = boxed(DatePickerImpl, "DatePicker");
873
746
  var DateRangePicker = boxed(DateRangePickerImpl, "DateRangePicker");
874
747
 
875
- export { AnchoredPopoverStyles, DatePicker, DateRangePicker, HoistedStyle, OverlayContainerContext, OverlayLayer, anchorStyle, focusStaysInside, getOverlayRoot, useDismiss, useOverlayLayer, usePopoverAnchor, usePortalTo };
748
+ export { AnchoredPopoverStyles, DatePicker, DateRangePicker, HoistedStyle, anchorStyle, focusStaysInside, useDismiss, usePopoverAnchor, usePortalTo };
@@ -1,4 +1,4 @@
1
- import { DateRangePicker } from './chunk-XKLUCUVA.js';
1
+ import { DateRangePicker } from './chunk-EFMKWPZ3.js';
2
2
  import { SegmentedControl, Select } from './chunk-WIDDHR7L.js';
3
3
  import { boxed } from './chunk-SAN4IX6N.js';
4
4
  import { useState, useMemo } from 'react';
@@ -0,0 +1,39 @@
1
+ import { OverlayLayer } from './chunk-XQPTSEJC.js';
2
+ import { Dialog, warnOnce } from './chunk-WIDDHR7L.js';
3
+ import { createContext, useContext, useMemo } from 'react';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ var SduiDispatchContext = createContext(null);
7
+ function useSduiDispatch() {
8
+ const dispatch = useContext(SduiDispatchContext);
9
+ if (!dispatch) {
10
+ throw new Error("useSduiDispatch\uB294 SduiRenderer \uB0B4\uBD80\uC5D0\uC11C\uB9CC \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.");
11
+ }
12
+ return dispatch;
13
+ }
14
+ var ALLOW_ALL = () => true;
15
+ var DENY_ALL = () => false;
16
+ var MISSING = () => {
17
+ warnOnce(
18
+ "permission:missing",
19
+ '[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.'
20
+ );
21
+ return true;
22
+ };
23
+ var SduiPermissionContext = createContext(null);
24
+ function SduiPermissionProvider({ can, children }) {
25
+ const value = useMemo(() => {
26
+ if (can === "allow-all") return ALLOW_ALL;
27
+ if (can === "deny-all") return DENY_ALL;
28
+ return typeof can === "function" ? can : null;
29
+ }, [can]);
30
+ return /* @__PURE__ */ jsx(SduiPermissionContext.Provider, { value, children });
31
+ }
32
+ function useSduiCan() {
33
+ return useContext(SduiPermissionContext) ?? MISSING;
34
+ }
35
+ function SduiDialog(props) {
36
+ return /* @__PURE__ */ jsx(OverlayLayer, { onClose: props.onClose, children: /* @__PURE__ */ jsx(Dialog, { ...props }) });
37
+ }
38
+
39
+ export { SduiDialog, SduiDispatchContext, SduiPermissionProvider, useSduiCan, useSduiDispatch };
@@ -1,5 +1,5 @@
1
- import { resolveTreeNodes, TreeView } from './chunk-IDUN2ESE.js';
2
- import { OverlayLayer } from './chunk-XKLUCUVA.js';
1
+ import { resolveTreeNodes, TreeView } from './chunk-X5R2HHEN.js';
2
+ import { OverlayLayer } from './chunk-XQPTSEJC.js';
3
3
  import { Field, Dialog, Icon, Button, Input } from './chunk-WIDDHR7L.js';
4
4
  import { boxed } from './chunk-SAN4IX6N.js';
5
5
  import { useState, useMemo, useEffect } from 'react';
@@ -1,4 +1,4 @@
1
- import { useDismiss, usePopoverAnchor, usePortalTo, HoistedStyle, AnchoredPopoverStyles, anchorStyle, focusStaysInside } from './chunk-XKLUCUVA.js';
1
+ import { useDismiss, usePopoverAnchor, usePortalTo, HoistedStyle, AnchoredPopoverStyles, anchorStyle, focusStaysInside } from './chunk-EFMKWPZ3.js';
2
2
  import { Icon, Spinner, EmptyState } from './chunk-WIDDHR7L.js';
3
3
  import { boxed } from './chunk-SAN4IX6N.js';
4
4
  import { useState, useRef, useEffect, useMemo, useCallback } from 'react';
@@ -1,4 +1,4 @@
1
- import { buildCascadingTree } from './chunk-U7ZK7WYH.js';
1
+ import { buildCascadingTree } from './chunk-BD75U73S.js';
2
2
  import { Input, IconButton, EmptyState, Icon, Badge } from './chunk-WIDDHR7L.js';
3
3
  import { boxed } from './chunk-SAN4IX6N.js';
4
4
  import React, { useMemo, useState, useRef, useEffect } from 'react';
@@ -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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { CSSProperties, ReactNode, ComponentType } from 'react';
3
- import { S as SduiPage, a as SduiAction, b as SduiPropValue, c as SduiRule } from './types-DDQh8bKF.js';
4
- export { d as SduiArgRef, e as SduiCalcRef, f as SduiChild, g as SduiIndexRef, h as SduiItemRef, i as SduiNode, j as SduiPageQuery, k as SduiScalar, l as SduiStateRef } from './types-DDQh8bKF.js';
3
+ import { S as SduiPage, a as SduiAction, b as SduiPropValue, c as SduiRule } from './types-Bum2uMjl.js';
4
+ export { d as SduiArgRef, e as SduiCalcRef, f as SduiChild, g as SduiIndexRef, h as SduiItemRef, i as SduiNode, j as SduiPageQuery, k as SduiScalar, l as SduiStateRef } from './types-Bum2uMjl.js';
5
5
  import { S as SduiBoxProps, a as SduiContainerLayoutProps, b as SduiColumnsScale, c as SduiGapScale, d as SduiWeightScale, e as SduiTextAlignScale } from './layout-B1QrIBm6.js';
6
6
  export { C as CHILD_LAYOUT_PROPS, L as LAYOUT_CSS, f as SduiAlignScale, g as SduiChildLayoutProps, h as SduiSizeScale, i as SduiSpanScale, j as childLayoutFrom, k as columnsClass, l as containerLayoutStyle, m as joinClass, n as mergeStyle, t as typographyStyle } from './layout-B1QrIBm6.js';
7
7
  import { D as DatePickerProps, a as DateRangePickerProps, T as TimePickerProps } from './DatePicker-D2EtpvkQ.js';
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);
@@ -2114,10 +2085,16 @@ function deferChainEntry(container, key) {
2114
2085
  return typeof container.action === "string" && (key === "onSuccess" || key === "onError");
2115
2086
  }
2116
2087
  async function runRequestAction(action, deps) {
2088
+ const pendingKey = typeof action.pendingKey === "string" && action.pendingKey !== "" ? action.pendingKey : null;
2089
+ let pendingOn = false;
2117
2090
  try {
2118
2091
  if (typeof action.endpoint !== "string" || action.endpoint === "") {
2119
2092
  throw new Error("request \uC561\uC158\uC758 endpoint\uAC00 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4 \u2014 $state \uCC38\uC870\uC5D0 \uC544\uC9C1 \uAC12\uC774 \uC5C6\uB294\uC9C0 \uD655\uC778\uD558\uC138\uC694");
2120
2093
  }
2094
+ if (pendingKey) {
2095
+ pendingOn = true;
2096
+ deps.dispatch({ action: "setState", key: pendingKey, value: true });
2097
+ }
2121
2098
  const response = await deps.fetch(action.endpoint, {
2122
2099
  method: action.method ?? "POST",
2123
2100
  ...action.body === void 0 ? {} : { body: action.body }
@@ -2144,6 +2121,8 @@ async function runRequestAction(action, deps) {
2144
2121
  } else {
2145
2122
  deps.toast({ tone: "danger", title: "\uC694\uCCAD \uC2E4\uD328", message });
2146
2123
  }
2124
+ } finally {
2125
+ if (pendingKey && pendingOn) deps.dispatch({ action: "setState", key: pendingKey, value: false });
2147
2126
  }
2148
2127
  }
2149
2128
 
@@ -2660,7 +2639,7 @@ function SduiNodeRenderer({
2660
2639
  return /* @__PURE__ */ jsx(Fragment, { children: rows.map((item, rowIndex) => {
2661
2640
  const rowScope = [...scope, { item, index: rowIndex }];
2662
2641
  const rowKey = isPlainObject4(item) && typeof item.id === "string" ? item.id : rowIndex;
2663
- 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);
2664
2643
  }) });
2665
2644
  }
2666
2645
  if (node.component === "Fragment") {
@@ -2736,11 +2715,11 @@ function SduiNodeRenderer({
2736
2715
  const children = childList?.map((child, i) => renderChild(child, i, scope, engine));
2737
2716
  return /* @__PURE__ */ jsx(Component, { ...props, children });
2738
2717
  }
2739
- var SduiFragmentChainContext = React11.createContext([]);
2718
+ var SduiFragmentChainContext = React10.createContext([]);
2740
2719
  var FRAGMENT_MAX_DEPTH = 4;
2741
2720
  function SduiFragment({ node, scope, engine }) {
2742
2721
  const adapter = useSduiAdapter();
2743
- const chain = React11.useContext(SduiFragmentChainContext);
2722
+ const chain = React10.useContext(SduiFragmentChainContext);
2744
2723
  const raw = isPlainObject4(node.props) ? node.props.id : void 0;
2745
2724
  const id = engine.resolveValue(raw, scope);
2746
2725
  if (typeof id !== "string" || id === "") {
@@ -2795,9 +2774,9 @@ function SduiFragmentBody({
2795
2774
  engine
2796
2775
  }) {
2797
2776
  const spec = useSpec(id);
2798
- const nextChain = React11.useMemo(() => [...chain, id], [chain, id]);
2799
- const bodyScope = React11.useMemo(() => [...scope, { args, callSiteScope: scope }], [scope, args]);
2800
- 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(() => {
2801
2780
  if (!DEV || !isPlainObject4(spec) || !Array.isArray(spec.body)) return;
2802
2781
  validateSpec(spec, new Set(Object.keys(engine.registry))).forEach(
2803
2782
  (issue) => console.warn(`[sdui:spec:${id}] ${issue.path} \u2014 ${issue.message}`)
@@ -3288,4 +3267,4 @@ function SduiRenderer({
3288
3267
  );
3289
3268
  }
3290
3269
 
3291
- 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
@@ -1,4 +1,4 @@
1
- import { b as SduiPropValue, i as SduiNode } from './types-DDQh8bKF.js';
1
+ import { b as SduiPropValue, i as SduiNode } from './types-Bum2uMjl.js';
2
2
 
3
3
  /**
4
4
  * 시각 빌더용 컴포넌트 메타데이터 스키마.
@@ -424,6 +424,7 @@ declare const richComponentMeta: {
424
424
  */
425
425
 
426
426
  declare const ApprovalStepperMeta: SduiComponentMeta;
427
+ declare const RankBoardMeta: SduiComponentMeta;
427
428
  declare const AutocompleteFieldMeta: SduiComponentMeta;
428
429
  declare const InlineEditMeta: SduiComponentMeta;
429
430
  declare const JsonFieldMeta: SduiComponentMeta;
@@ -458,6 +459,7 @@ declare const StripMeta: SduiComponentMeta;
458
459
  */
459
460
  declare const widgetComponentMeta: {
460
461
  ApprovalStepper: SduiComponentMeta;
462
+ RankBoard: SduiComponentMeta;
461
463
  AutocompleteField: SduiComponentMeta;
462
464
  ColumnBoard: SduiComponentMeta;
463
465
  DiffView: SduiComponentMeta;
@@ -590,4 +592,4 @@ declare function paletteGroups(catalog?: Record<string, SduiComponentMeta>): Arr
590
592
  items: SduiComponentMeta[];
591
593
  }>;
592
594
 
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 };
595
+ 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, 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 };