sellmate-design-system-react 0.12.0 → 1.1.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.
- package/dist/components/SActionModal/SActionModal.cjs +3 -3
- package/dist/components/SActionModal/SActionModal.cjs.map +1 -1
- package/dist/components/SActionModal/SActionModal.js +3 -3
- package/dist/components/SActionModal/SActionModal.js.map +1 -1
- package/dist/components/SBarcodeInput/SBarcodeInput.cjs +1 -1
- package/dist/components/SBarcodeInput/SBarcodeInput.cjs.map +1 -1
- package/dist/components/SBarcodeInput/SBarcodeInput.js +1 -1
- package/dist/components/SBarcodeInput/SBarcodeInput.js.map +1 -1
- package/dist/components/SChipInput/SChipInput.cjs +1 -1
- package/dist/components/SChipInput/SChipInput.cjs.map +1 -1
- package/dist/components/SChipInput/SChipInput.js +1 -1
- package/dist/components/SChipInput/SChipInput.js.map +1 -1
- package/dist/components/SConfirmModal/SConfirmModal.cjs +4 -4
- package/dist/components/SConfirmModal/SConfirmModal.cjs.map +1 -1
- package/dist/components/SConfirmModal/SConfirmModal.js +4 -4
- package/dist/components/SConfirmModal/SConfirmModal.js.map +1 -1
- package/dist/components/SDatePicker/SDatePicker.cjs +1 -1
- package/dist/components/SDatePicker/SDatePicker.cjs.map +1 -1
- package/dist/components/SDatePicker/SDatePicker.js +1 -1
- package/dist/components/SDatePicker/SDatePicker.js.map +1 -1
- package/dist/components/SDateRangePicker/SDateRangePicker.cjs +1 -1
- package/dist/components/SDateRangePicker/SDateRangePicker.cjs.map +1 -1
- package/dist/components/SDateRangePicker/SDateRangePicker.js +1 -1
- package/dist/components/SDateRangePicker/SDateRangePicker.js.map +1 -1
- package/dist/components/SExpansionItem/SExpansionItem.cjs +42 -12
- package/dist/components/SExpansionItem/SExpansionItem.cjs.map +1 -1
- package/dist/components/SExpansionItem/SExpansionItem.d.ts +2 -0
- package/dist/components/SExpansionItem/SExpansionItem.js +43 -13
- package/dist/components/SExpansionItem/SExpansionItem.js.map +1 -1
- package/dist/components/SField/SField.cjs +1 -1
- package/dist/components/SField/SField.cjs.map +1 -1
- package/dist/components/SField/SField.js +1 -1
- package/dist/components/SField/SField.js.map +1 -1
- package/dist/components/SFilePicker/SFilePicker.cjs +1 -1
- package/dist/components/SFilePicker/SFilePicker.cjs.map +1 -1
- package/dist/components/SFilePicker/SFilePicker.js +1 -1
- package/dist/components/SFilePicker/SFilePicker.js.map +1 -1
- package/dist/components/SInput/SInput.cjs +1 -1
- package/dist/components/SInput/SInput.cjs.map +1 -1
- package/dist/components/SInput/SInput.js +1 -1
- package/dist/components/SInput/SInput.js.map +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.cjs +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.cjs.map +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.js +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.js.map +1 -1
- package/dist/components/SLoadingModal/SLoadingModal.cjs +3 -3
- package/dist/components/SLoadingModal/SLoadingModal.cjs.map +1 -1
- package/dist/components/SLoadingModal/SLoadingModal.js +3 -3
- package/dist/components/SLoadingModal/SLoadingModal.js.map +1 -1
- package/dist/components/SModal/SModal.cjs +31 -37
- package/dist/components/SModal/SModal.cjs.map +1 -1
- package/dist/components/SModal/SModal.d.ts +38 -19
- package/dist/components/SModal/SModal.js +31 -37
- package/dist/components/SModal/SModal.js.map +1 -1
- package/dist/components/SModalContainer/SModalContainer.cjs +1 -1
- package/dist/components/SModalContainer/SModalContainer.cjs.map +1 -1
- package/dist/components/SModalContainer/SModalContainer.js +1 -1
- package/dist/components/SModalContainer/SModalContainer.js.map +1 -1
- package/dist/components/SNumberInput/SNumberInput.cjs +1 -1
- package/dist/components/SNumberInput/SNumberInput.cjs.map +1 -1
- package/dist/components/SNumberInput/SNumberInput.js +1 -1
- package/dist/components/SNumberInput/SNumberInput.js.map +1 -1
- package/dist/components/SSelect/SSelect.cjs +1 -1
- package/dist/components/SSelect/SSelect.cjs.map +1 -1
- package/dist/components/SSelect/SSelect.js +1 -1
- package/dist/components/SSelect/SSelect.js.map +1 -1
- package/dist/components/STable/STable.cjs +2 -2
- package/dist/components/STable/STable.cjs.map +1 -1
- package/dist/components/STable/STable.d.ts +2 -1
- package/dist/components/STable/STable.js +2 -2
- package/dist/components/STable/STable.js.map +1 -1
- package/dist/components/STableBar/STableBar.cjs +93 -0
- package/dist/components/STableBar/STableBar.cjs.map +1 -0
- package/dist/components/STableBar/STableBar.d.ts +17 -0
- package/dist/components/STableBar/STableBar.js +91 -0
- package/dist/components/STableBar/STableBar.js.map +1 -0
- package/dist/components/STableBar/index.d.ts +1 -0
- package/dist/components/STextarea/STextarea.cjs +1 -1
- package/dist/components/STextarea/STextarea.cjs.map +1 -1
- package/dist/components/STextarea/STextarea.js +1 -1
- package/dist/components/STextarea/STextarea.js.map +1 -1
- package/dist/components/STimePicker/STimePicker.cjs +1 -1
- package/dist/components/STimePicker/STimePicker.cjs.map +1 -1
- package/dist/components/STimePicker/STimePicker.js +1 -1
- package/dist/components/STimePicker/STimePicker.js.map +1 -1
- package/dist/components/STimeRangePicker/STimeRangePicker.cjs +1 -1
- package/dist/components/STimeRangePicker/STimeRangePicker.cjs.map +1 -1
- package/dist/components/STimeRangePicker/STimeRangePicker.js +1 -1
- package/dist/components/STimeRangePicker/STimeRangePicker.js.map +1 -1
- package/dist/components/STooltip/STooltip.cjs +1 -1
- package/dist/components/STooltip/STooltip.cjs.map +1 -1
- package/dist/components/STooltip/STooltip.js +1 -1
- package/dist/components/STooltip/STooltip.js.map +1 -1
- package/dist/index.cjs +133 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +134 -55
- package/dist/index.js.map +1 -1
- package/dist/styles.css +117 -32
- package/package.json +1 -1
|
@@ -6,29 +6,41 @@ export type SConfirmOptions = Omit<SConfirmModalProps, 'open' | 'onOpenChange' |
|
|
|
6
6
|
/** SModal.loading 옵션 — 제어 흐름을 서비스가 담당하므로 관련 props 는 제외 */
|
|
7
7
|
export type SLoadingOptions = Omit<SLoadingModalProps, 'open' | 'onOpenChange' | 'onClose' | 'onButtonClick'>;
|
|
8
8
|
/**
|
|
9
|
-
* create() 가
|
|
9
|
+
* create() 가 컴포넌트에 주입하는 prop.
|
|
10
|
+
*
|
|
11
|
+
* 컴포넌트는 `open`/`onOpenChange`/`onClose` 를 루트의 SActionModal 에 **그대로 전달**해야 한다.
|
|
12
|
+
* 전달하지 않으면 모달이 열리지도, 닫히지도 않는다.
|
|
13
|
+
*
|
|
10
14
|
* (컴포넌트 문서 생성기 docs:gen 은 `*Props` interface 를 "컴포넌트"로 취급하므로,
|
|
11
15
|
* 서비스인 SModal 이 컴포넌트로 잘못 문서화되지 않도록 type 별칭으로 둔다. README 는 수작성.)
|
|
12
16
|
*/
|
|
13
17
|
export type SModalCreateComponentProps = {
|
|
18
|
+
/** 표시 여부 — SActionModal 의 open 에 그대로 전달 */
|
|
19
|
+
open: boolean;
|
|
20
|
+
/** 표시 상태 변경 — SActionModal 의 onOpenChange 에 그대로 전달 */
|
|
21
|
+
onOpenChange: (open: boolean) => void;
|
|
22
|
+
/** 닫기(X) 클릭 — SActionModal 의 onClose 에 그대로 전달 */
|
|
23
|
+
onClose: () => void;
|
|
14
24
|
/** 모달 제어 핸들. 컴포넌트에서 ok()/cancel()/close()/submit()/onSubmit() 호출 */
|
|
15
25
|
modalRef: SModalRef;
|
|
16
26
|
};
|
|
17
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* SModal.create 옵션 — SActionModal 을 루트로 렌더하는 컴포넌트를 띄운다.
|
|
29
|
+
*
|
|
30
|
+
* 디자인 시스템이 띄우는 모달은 SActionModal / SConfirmModal / SLoadingModal 세 가지뿐이고,
|
|
31
|
+
* 서비스 메서드가 1:1 로 대응한다 — create → SActionModal, confirm → SConfirmModal,
|
|
32
|
+
* loading → SLoadingModal. create 는 컨테이너를 덧씌우지 않고 component 를 그대로 렌더하며,
|
|
33
|
+
* 표시 제어(open/onOpenChange/onClose/modalRef)만 주입하고 닫힘 후 정리를 담당한다.
|
|
34
|
+
*/
|
|
18
35
|
export interface SCreateOptions<P extends object = Record<string, never>> {
|
|
19
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* 띄울 컴포넌트. **루트에 SActionModal 을 렌더**하고 주입받은 open/onOpenChange/onClose 를
|
|
38
|
+
* 그대로 전달해야 한다. 모달 껍데기 없이 본문만 렌더하면 딤·카드 없이 콘텐츠가 그대로
|
|
39
|
+
* 화면에 붙는다 — 개발 모드에서는 이를 감지해 경고한다.
|
|
40
|
+
*/
|
|
20
41
|
component: ComponentType<P & SModalCreateComponentProps>;
|
|
21
|
-
/** component 에 전달할 추가 props (
|
|
42
|
+
/** component 에 전달할 추가 props (주입 prop 과 이름이 겹치면 주입 쪽이 이긴다) */
|
|
22
43
|
componentProps?: P;
|
|
23
|
-
/** 백드롭·ESC 로 안 닫히고 흔들림 */
|
|
24
|
-
persistent?: boolean;
|
|
25
|
-
/** 우측 상단 닫기(X) 버튼 (기본 false) */
|
|
26
|
-
showClose?: boolean;
|
|
27
|
-
width?: number | string;
|
|
28
|
-
height?: number | string;
|
|
29
|
-
className?: string;
|
|
30
|
-
/** 접근성 제목 (스크린리더용) */
|
|
31
|
-
ariaTitle?: string;
|
|
32
44
|
}
|
|
33
45
|
/**
|
|
34
46
|
* SModal.confirm / loading / create 반환 핸들 — 체이닝 콜백 등록 + 트리거/update/close.
|
|
@@ -81,10 +93,16 @@ export interface SModalRef {
|
|
|
81
93
|
* catch { ref.update({ state: 'error', message: '업로드 실패' }).onClick(() => retry()); }
|
|
82
94
|
*
|
|
83
95
|
* @example
|
|
84
|
-
* //
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
96
|
+
* // SActionModal 을 루트로 렌더하는 컴포넌트를 만들어 넘긴다 — 주입 prop 은 그대로 전달
|
|
97
|
+
* function OrderModal({ open, onOpenChange, onClose, modalRef, orderId }: OrderModalProps) {
|
|
98
|
+
* return (
|
|
99
|
+
* <SActionModal open={open} onOpenChange={onOpenChange} onClose={onClose}
|
|
100
|
+
* modalTitle="주문 처리" button={{ label: '처리', onClick: () => modalRef.ok() }}>
|
|
101
|
+
* <OrderBody orderId={orderId} />
|
|
102
|
+
* </SActionModal>
|
|
103
|
+
* );
|
|
104
|
+
* }
|
|
105
|
+
* SModal.create({ component: OrderModal, componentProps: { orderId } }).onOk(() => refetch());
|
|
88
106
|
*/
|
|
89
107
|
export declare const SModal: {
|
|
90
108
|
/** 확인/취소 모달을 즉시 띄운다. 반환 핸들에 onOk/onCancel/onClose/onDismissed 체이닝. */
|
|
@@ -95,8 +113,9 @@ export declare const SModal: {
|
|
|
95
113
|
*/
|
|
96
114
|
loading(options?: SLoadingOptions): SModalRef;
|
|
97
115
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
116
|
+
* SActionModal 을 루트로 렌더하는 컴포넌트를 띄운다. 컨테이너를 덧씌우지 않고 표시 제어
|
|
117
|
+
* (open/onOpenChange/onClose)와 modalRef 만 주입하며, 닫힘 애니메이션 종료 후 자동으로
|
|
118
|
+
* 언마운트한다. 컴포넌트가 모달을 띄우지 않으면 개발 모드에서 경고한다.
|
|
100
119
|
*/
|
|
101
120
|
create<P extends object = Record<string, never>>(options: SCreateOptions<P>): SModalRef;
|
|
102
121
|
};
|
|
@@ -3112,7 +3112,7 @@ function SModalContainer({
|
|
|
3112
3112
|
"div",
|
|
3113
3113
|
{
|
|
3114
3114
|
className: cn(
|
|
3115
|
-
"relative overflow-hidden rounded-[var(--cmp-modal-radius)] bg-[var(--cmp-modal-bg)] shadow-normal-md",
|
|
3115
|
+
"relative flex max-h-[calc(100dvh-48px)] flex-col overflow-hidden rounded-[var(--cmp-modal-radius)] bg-[var(--cmp-modal-bg)] shadow-normal-md",
|
|
3116
3116
|
shaking && "animate-modal-shake",
|
|
3117
3117
|
className
|
|
3118
3118
|
),
|
|
@@ -3370,8 +3370,8 @@ function SConfirmModal({
|
|
|
3370
3370
|
showClose: true,
|
|
3371
3371
|
onClose,
|
|
3372
3372
|
className: "w-fit min-w-[520px]",
|
|
3373
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-[40px] px-[32px] py-[40px]", children: [
|
|
3374
|
-
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col items-center gap-[20px]", children: [
|
|
3373
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-auto flex-col items-center gap-[40px] px-[32px] py-[40px]", children: [
|
|
3374
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full min-h-0 flex-col items-center gap-[20px] overflow-y-auto", children: [
|
|
3375
3375
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-[12px]", children: [
|
|
3376
3376
|
iconName && /* @__PURE__ */ jsx(SIcon, { name: iconName, size: 32, color: TYPE_ICON_COLOR[type] }),
|
|
3377
3377
|
/* @__PURE__ */ jsx(
|
|
@@ -3393,7 +3393,7 @@ function SConfirmModal({
|
|
|
3393
3393
|
optionNode != null && optionNode
|
|
3394
3394
|
] })
|
|
3395
3395
|
] }),
|
|
3396
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-[8px]", children: [
|
|
3396
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 gap-[8px]", children: [
|
|
3397
3397
|
subButtonLabel && /* @__PURE__ */ jsx(
|
|
3398
3398
|
SButton,
|
|
3399
3399
|
{
|
|
@@ -3569,7 +3569,7 @@ function SLoadingModal({
|
|
|
3569
3569
|
ariaTitle: lines[0] || "\uB85C\uB529 \uC911",
|
|
3570
3570
|
width,
|
|
3571
3571
|
height,
|
|
3572
|
-
children: /* @__PURE__ */
|
|
3572
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-auto flex-col overflow-y-auto px-[32px]", children: /* @__PURE__ */ jsxs("div", { className: "m-auto flex flex-col items-center gap-[20px]", children: [
|
|
3573
3573
|
state === "loading" ? progress !== void 0 ? /* @__PURE__ */ jsx(SCircleProgress, { value: progress }) : /* @__PURE__ */ jsx(SCircleProgress, { indeterminate: true }) : /* @__PURE__ */ jsx(SIcon, { name: "warningOutline", size: 80, color: "var(--cmp-modal-confirm-negative-icon)" }),
|
|
3574
3574
|
lines.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-[2px]", children: lines.map((m, i) => /* @__PURE__ */ jsx(
|
|
3575
3575
|
"p",
|
|
@@ -3592,7 +3592,7 @@ function SLoadingModal({
|
|
|
3592
3592
|
label: buttonLabel ?? DEFAULT_BUTTON_LABEL[state]
|
|
3593
3593
|
}
|
|
3594
3594
|
)
|
|
3595
|
-
] })
|
|
3595
|
+
] }) })
|
|
3596
3596
|
}
|
|
3597
3597
|
);
|
|
3598
3598
|
}
|
|
@@ -3675,6 +3675,10 @@ var SModalRefImpl = class {
|
|
|
3675
3675
|
this.root = root;
|
|
3676
3676
|
this.host = host;
|
|
3677
3677
|
}
|
|
3678
|
+
/** @internal create 의 마운트 검사용 host 조회 */
|
|
3679
|
+
_getHost() {
|
|
3680
|
+
return this.host;
|
|
3681
|
+
}
|
|
3678
3682
|
/** @internal 닫힘 시작 표시 — 컴포넌트 버튼·백드롭·ESC 닫힘 경로가 호출(중복 트리거 방지) */
|
|
3679
3683
|
_markDismissed() {
|
|
3680
3684
|
this.dismissRequested = true;
|
|
@@ -3770,46 +3774,35 @@ function LoadingMount({ options, refImpl }) {
|
|
|
3770
3774
|
}
|
|
3771
3775
|
);
|
|
3772
3776
|
}
|
|
3777
|
+
function warnIfNotModal(host, component) {
|
|
3778
|
+
if (typeof process !== "undefined" && process?.env?.NODE_ENV === "production") return;
|
|
3779
|
+
if (!host || host.childElementCount === 0) return;
|
|
3780
|
+
const name = component?.name || "component";
|
|
3781
|
+
console.warn(
|
|
3782
|
+
`[SModal.create] ${name} \uC774(\uAC00) \uBAA8\uB2EC\uC744 \uB744\uC6B0\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. create \uB294 \uCEE8\uD14C\uC774\uB108\uB97C \uB367\uC50C\uC6B0\uC9C0 \uC54A\uC73C\uBBC0\uB85C component \uB294 \uB8E8\uD2B8\uC5D0 SActionModal \uC744 \uB80C\uB354\uD558\uACE0, \uC8FC\uC785\uBC1B\uC740 open/onOpenChange/onClose \uB97C \uADF8\uB300\uB85C \uC804\uB2EC\uD574\uC57C \uD569\uB2C8\uB2E4. \uD655\uC778/\uCDE8\uC18C\uB294 SModal.confirm, \uB85C\uB529\uC740 SModal.loading \uC744 \uC0AC\uC6A9\uD558\uC138\uC694.`
|
|
3783
|
+
);
|
|
3784
|
+
}
|
|
3773
3785
|
function CreateMount({ options, refImpl }) {
|
|
3774
|
-
const {
|
|
3775
|
-
component: Component,
|
|
3776
|
-
componentProps,
|
|
3777
|
-
persistent,
|
|
3778
|
-
showClose,
|
|
3779
|
-
width,
|
|
3780
|
-
height,
|
|
3781
|
-
className,
|
|
3782
|
-
ariaTitle
|
|
3783
|
-
} = options;
|
|
3786
|
+
const { component: Component, componentProps } = options;
|
|
3784
3787
|
const [open, setOpen] = useState(true);
|
|
3785
3788
|
useEffect(() => {
|
|
3786
3789
|
refImpl._bindClose(() => setOpen(false));
|
|
3787
3790
|
refImpl._bindUpdate(() => {
|
|
3788
3791
|
});
|
|
3789
|
-
|
|
3792
|
+
warnIfNotModal(refImpl._getHost(), Component);
|
|
3793
|
+
}, [refImpl, Component]);
|
|
3790
3794
|
useExitTeardown(open, refImpl);
|
|
3791
3795
|
const componentAllProps = {
|
|
3792
3796
|
...componentProps,
|
|
3797
|
+
open,
|
|
3798
|
+
onOpenChange: (o) => {
|
|
3799
|
+
if (!o) refImpl._markDismissed();
|
|
3800
|
+
setOpen(o);
|
|
3801
|
+
},
|
|
3802
|
+
onClose: () => refImpl._emitClose(),
|
|
3793
3803
|
modalRef: refImpl
|
|
3794
3804
|
};
|
|
3795
|
-
return /* @__PURE__ */ jsx(
|
|
3796
|
-
SModalContainer,
|
|
3797
|
-
{
|
|
3798
|
-
open,
|
|
3799
|
-
onOpenChange: (o) => {
|
|
3800
|
-
if (!o) refImpl._markDismissed();
|
|
3801
|
-
setOpen(o);
|
|
3802
|
-
},
|
|
3803
|
-
persistent,
|
|
3804
|
-
showClose,
|
|
3805
|
-
onClose: () => refImpl.close(),
|
|
3806
|
-
ariaTitle,
|
|
3807
|
-
width,
|
|
3808
|
-
height,
|
|
3809
|
-
className,
|
|
3810
|
-
children: /* @__PURE__ */ jsx(Component, { ...componentAllProps })
|
|
3811
|
-
}
|
|
3812
|
-
);
|
|
3805
|
+
return /* @__PURE__ */ jsx(Component, { ...componentAllProps });
|
|
3813
3806
|
}
|
|
3814
3807
|
function mount(render) {
|
|
3815
3808
|
const host = document.createElement("div");
|
|
@@ -3833,8 +3826,9 @@ var SModal = {
|
|
|
3833
3826
|
return mount((refImpl) => /* @__PURE__ */ jsx(LoadingMount, { options: { persistent: true, ...options }, refImpl }));
|
|
3834
3827
|
},
|
|
3835
3828
|
/**
|
|
3836
|
-
*
|
|
3837
|
-
*
|
|
3829
|
+
* SActionModal 을 루트로 렌더하는 컴포넌트를 띄운다. 컨테이너를 덧씌우지 않고 표시 제어
|
|
3830
|
+
* (open/onOpenChange/onClose)와 modalRef 만 주입하며, 닫힘 애니메이션 종료 후 자동으로
|
|
3831
|
+
* 언마운트한다. 컴포넌트가 모달을 띄우지 않으면 개발 모드에서 경고한다.
|
|
3838
3832
|
*/
|
|
3839
3833
|
create(options) {
|
|
3840
3834
|
return mount((refImpl) => /* @__PURE__ */ jsx(CreateMount, { options, refImpl }));
|