sellmate-design-system-react 2.1.0 → 2.1.2
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 +8 -2
- package/dist/components/SActionModal/SActionModal.cjs.map +1 -1
- package/dist/components/SActionModal/SActionModal.d.ts +11 -2
- package/dist/components/SActionModal/SActionModal.js +8 -2
- package/dist/components/SActionModal/SActionModal.js.map +1 -1
- package/dist/components/SChipInput/SChipInput.cjs +9 -2
- package/dist/components/SChipInput/SChipInput.cjs.map +1 -1
- package/dist/components/SChipInput/SChipInput.js +9 -2
- package/dist/components/SChipInput/SChipInput.js.map +1 -1
- package/dist/components/SConfirmModal/SConfirmModal.cjs +101 -8
- package/dist/components/SConfirmModal/SConfirmModal.cjs.map +1 -1
- package/dist/components/SConfirmModal/SConfirmModal.d.ts +4 -3
- package/dist/components/SConfirmModal/SConfirmModal.js +101 -8
- package/dist/components/SConfirmModal/SConfirmModal.js.map +1 -1
- package/dist/components/SExpansionItem/SExpansionItem.cjs +11 -11
- package/dist/components/SExpansionItem/SExpansionItem.cjs.map +1 -1
- package/dist/components/SExpansionItem/SExpansionItem.js +11 -11
- package/dist/components/SExpansionItem/SExpansionItem.js.map +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.cjs +20 -19
- package/dist/components/SKeyValueTable/SKeyValueTable.cjs.map +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.d.ts +57 -4
- package/dist/components/SKeyValueTable/SKeyValueTable.js +20 -19
- package/dist/components/SKeyValueTable/SKeyValueTable.js.map +1 -1
- package/dist/components/SLoadingModal/SLoadingModal.cjs +8 -2
- package/dist/components/SLoadingModal/SLoadingModal.cjs.map +1 -1
- package/dist/components/SLoadingModal/SLoadingModal.js +8 -2
- package/dist/components/SLoadingModal/SLoadingModal.js.map +1 -1
- package/dist/components/SModal/SModal.cjs +101 -8
- package/dist/components/SModal/SModal.cjs.map +1 -1
- package/dist/components/SModal/SModal.js +101 -8
- package/dist/components/SModal/SModal.js.map +1 -1
- package/dist/components/SModalContainer/SModalContainer.cjs +8 -2
- package/dist/components/SModalContainer/SModalContainer.cjs.map +1 -1
- package/dist/components/SModalContainer/SModalContainer.js +8 -2
- package/dist/components/SModalContainer/SModalContainer.js.map +1 -1
- package/dist/components/SSelect/SSelect.cjs +20 -19
- package/dist/components/SSelect/SSelect.cjs.map +1 -1
- package/dist/components/SSelect/SSelect.js +20 -19
- package/dist/components/SSelect/SSelect.js.map +1 -1
- package/dist/components/SStepper/SStepper.cjs +1 -1
- package/dist/components/SStepper/SStepper.cjs.map +1 -1
- package/dist/components/SStepper/SStepper.js +1 -1
- package/dist/components/SStepper/SStepper.js.map +1 -1
- package/dist/components/STable/STable.cjs +20 -19
- package/dist/components/STable/STable.cjs.map +1 -1
- package/dist/components/STable/STable.js +20 -19
- package/dist/components/STable/STable.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/index.cjs +75 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +75 -43
- package/dist/index.js.map +1 -1
- package/dist/styles.css +303 -195
- package/dist/theme.css +229 -121
- package/package.json +1 -1
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type SInputProps } from '../SInput';
|
|
3
|
+
import { type STextareaProps } from '../STextarea';
|
|
4
|
+
import { type SNumberInputProps } from '../SNumberInput';
|
|
5
|
+
import { type SSelectProps } from '../SSelect';
|
|
6
|
+
import { type SRadioGroupProps } from '../SRadio';
|
|
7
|
+
import { type SCheckboxProps } from '../SCheckbox';
|
|
8
|
+
import { type SDatePickerProps } from '../SDatePicker';
|
|
9
|
+
import { type SDateRangePickerProps } from '../SDateRangePicker';
|
|
10
|
+
import { type SFilePickerProps } from '../SFilePicker';
|
|
2
11
|
export type SKeyValueFieldType = 'text' | 'input' | 'textarea' | 'number-input' | 'select' | 'radio' | 'checkbox' | 'date-picker' | 'date-range-picker' | 'file-picker';
|
|
3
|
-
|
|
12
|
+
/** field type과 무관한 공통 속성 (레이아웃·레이블·스팬 등) */
|
|
13
|
+
export interface SKeyValueFieldBase {
|
|
4
14
|
name: string;
|
|
5
15
|
label?: string;
|
|
6
|
-
type?: SKeyValueFieldType;
|
|
7
|
-
options?: Record<string, any>;
|
|
8
16
|
required?: boolean;
|
|
9
17
|
helpText?: string[];
|
|
10
18
|
hideTh?: boolean;
|
|
@@ -15,9 +23,53 @@ export interface SKeyValueField {
|
|
|
15
23
|
thWidth?: number | string;
|
|
16
24
|
thClass?: string;
|
|
17
25
|
tdClass?: string;
|
|
18
|
-
/** 셀 커스텀 렌더 (React 확장) */
|
|
26
|
+
/** 셀 커스텀 렌더 (React 확장). 지정 시 type/options는 무시되고 이 노드가 그대로 렌더됩니다. */
|
|
19
27
|
render?: ReactNode;
|
|
20
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* `options`에서 제외되는 키.
|
|
31
|
+
* - `onValueChange`: 테이블이 `onChange`로 승격시키므로 field 단위로 지정할 수 없습니다.
|
|
32
|
+
* - `value`: 지정은 가능하나 `values` prop이 같은 name을 가지면 그쪽이 우선합니다. (타입은 유지)
|
|
33
|
+
*/
|
|
34
|
+
type FieldOptions<P> = Omit<P, 'onValueChange'>;
|
|
35
|
+
/**
|
|
36
|
+
* `type`에 따라 `options`가 해당 컴포넌트의 props로 좁혀지는 discriminated union.
|
|
37
|
+
* `type` 생략 시 `text`로 동작합니다.
|
|
38
|
+
*/
|
|
39
|
+
export type SKeyValueFieldByType = {
|
|
40
|
+
type?: 'text';
|
|
41
|
+
options?: {
|
|
42
|
+
value?: ReactNode;
|
|
43
|
+
};
|
|
44
|
+
} | {
|
|
45
|
+
type: 'input';
|
|
46
|
+
options?: FieldOptions<SInputProps>;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'textarea';
|
|
49
|
+
options?: FieldOptions<STextareaProps>;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'number-input';
|
|
52
|
+
options?: FieldOptions<SNumberInputProps>;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'select';
|
|
55
|
+
options?: FieldOptions<SSelectProps>;
|
|
56
|
+
} | {
|
|
57
|
+
type: 'radio';
|
|
58
|
+
options?: FieldOptions<SRadioGroupProps>;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'checkbox';
|
|
61
|
+
options?: FieldOptions<SCheckboxProps>;
|
|
62
|
+
} | {
|
|
63
|
+
type: 'date-picker';
|
|
64
|
+
options?: FieldOptions<SDatePickerProps>;
|
|
65
|
+
} | {
|
|
66
|
+
type: 'date-range-picker';
|
|
67
|
+
options?: FieldOptions<SDateRangePickerProps>;
|
|
68
|
+
} | {
|
|
69
|
+
type: 'file-picker';
|
|
70
|
+
options?: FieldOptions<SFilePickerProps>;
|
|
71
|
+
};
|
|
72
|
+
export type SKeyValueField = SKeyValueFieldBase & SKeyValueFieldByType;
|
|
21
73
|
/**
|
|
22
74
|
* field type별 `onChange`로 올라오는 값 타입.
|
|
23
75
|
* - `string`: input · textarea · select · radio · date-picker
|
|
@@ -61,3 +113,4 @@ export interface SKeyValueTableProps {
|
|
|
61
113
|
}
|
|
62
114
|
/** SKeyValueTable — sd-key-value-table 포팅. th/td 폼 레이아웃 + 필드 렌더러. */
|
|
63
115
|
export declare function SKeyValueTable({ fields, values, search, radius, onChange, onSearch, className, style, }: SKeyValueTableProps): import("react").JSX.Element | null;
|
|
116
|
+
export {};
|
|
@@ -4428,7 +4428,7 @@ var SSelect = forwardRef(function SSelect2({
|
|
|
4428
4428
|
);
|
|
4429
4429
|
onValueChange(multi ? mapped : mapped[0] ?? (emitValue ? "" : null));
|
|
4430
4430
|
};
|
|
4431
|
-
const commitOpen = (next) => {
|
|
4431
|
+
const commitOpen = (next, valueForRules) => {
|
|
4432
4432
|
setOpen(next);
|
|
4433
4433
|
onOpenChange?.(next);
|
|
4434
4434
|
if (next) {
|
|
@@ -4437,7 +4437,8 @@ var SSelect = forwardRef(function SSelect2({
|
|
|
4437
4437
|
setPendingOpen(false);
|
|
4438
4438
|
setSearch("");
|
|
4439
4439
|
if (rules && rules.length > 0) {
|
|
4440
|
-
|
|
4440
|
+
const current = valueForRules ?? selectedRef.current;
|
|
4441
|
+
setRuleError(runRules(multi ? current : current[0] ?? "", rules));
|
|
4441
4442
|
}
|
|
4442
4443
|
}
|
|
4443
4444
|
};
|
|
@@ -4521,7 +4522,7 @@ var SSelect = forwardRef(function SSelect2({
|
|
|
4521
4522
|
return;
|
|
4522
4523
|
}
|
|
4523
4524
|
emit([nextValue]);
|
|
4524
|
-
commitOpen(false);
|
|
4525
|
+
commitOpen(false, [nextValue]);
|
|
4525
4526
|
};
|
|
4526
4527
|
const handleSelectAll = () => {
|
|
4527
4528
|
emit(allSelected ? [] : allValues);
|
|
@@ -4761,7 +4762,7 @@ var SSelect = forwardRef(function SSelect2({
|
|
|
4761
4762
|
if (index >= 0) setFocusedIndex(index);
|
|
4762
4763
|
}
|
|
4763
4764
|
}
|
|
4764
|
-
) : /* @__PURE__ */ jsx("div", { className: "px-[12px] py-[12px] text-left text-[12px] leading-[20px] text-[color:var(--cmp-
|
|
4765
|
+
) : /* @__PURE__ */ jsx("div", { className: "px-[12px] py-[12px] text-left text-[12px] leading-[20px] text-[color:var(--cmp-listBoxItem-content-disabled)]", children: "\uD45C\uC2DC\uD560 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4." })
|
|
4765
4766
|
]
|
|
4766
4767
|
}
|
|
4767
4768
|
)
|
|
@@ -4789,10 +4790,10 @@ function ItemList({
|
|
|
4789
4790
|
const selectedSet = useMemo(() => new Set(selected), [selected]);
|
|
4790
4791
|
const itemBase = cn(
|
|
4791
4792
|
"group/select-item flex w-full cursor-pointer select-none items-center gap-[8px] border-none bg-transparent text-left text-[12px] leading-[20px] outline-none",
|
|
4792
|
-
"text-[color:var(--cmp-
|
|
4793
|
-
"disabled:cursor-not-allowed disabled:text-[color:var(--cmp-
|
|
4793
|
+
"text-[color:var(--cmp-listBoxItem-content-default)]",
|
|
4794
|
+
"disabled:cursor-not-allowed disabled:text-[color:var(--cmp-listBoxItem-content-disabled)]"
|
|
4794
4795
|
);
|
|
4795
|
-
const activeClass = "hover:bg-[var(--cmp-
|
|
4796
|
+
const activeClass = "hover:bg-[var(--cmp-listBoxItem-bg-hover)] hover:text-[color:var(--cmp-listBoxItem-content-hover)] focus-visible:bg-[var(--cmp-listBoxItem-bg-hover)] focus-visible:text-[color:var(--cmp-listBoxItem-content-hover)]";
|
|
4796
4797
|
return /* @__PURE__ */ jsxs("div", { role: "listbox", "aria-multiselectable": multi || void 0, children: [
|
|
4797
4798
|
showSelectAll && /* @__PURE__ */ jsxs(
|
|
4798
4799
|
"button",
|
|
@@ -4802,7 +4803,7 @@ function ItemList({
|
|
|
4802
4803
|
"data-select-active": focusedValue === "__select_all__" ? "true" : void 0,
|
|
4803
4804
|
className: cn(
|
|
4804
4805
|
itemBase,
|
|
4805
|
-
focusedValue === "__select_all__" && "bg-[var(--cmp-
|
|
4806
|
+
focusedValue === "__select_all__" && "bg-[var(--cmp-listBoxItem-bg-hover)] text-[color:var(--cmp-listBoxItem-content-hover)]"
|
|
4806
4807
|
),
|
|
4807
4808
|
style: { paddingTop: 4, paddingBottom: 4, paddingRight: 12, paddingLeft: 12 },
|
|
4808
4809
|
onMouseEnter: () => onHoverValue("__select_all__"),
|
|
@@ -4819,7 +4820,7 @@ function ItemList({
|
|
|
4819
4820
|
const rowKey = `${o.value}-${idx}`;
|
|
4820
4821
|
if (o.isGroup) {
|
|
4821
4822
|
const isDepth1 = o.depth === 1;
|
|
4822
|
-
const groupTone = isDepth1 ? "border-t border-solid border-[color:var(--cmp-
|
|
4823
|
+
const groupTone = isDepth1 ? "border-t border-solid border-[color:var(--cmp-listBoxItem-depth1-border-color)] bg-[var(--cmp-listBoxItem-depth1-bg-default)] font-bold" : "bg-[var(--cmp-listBoxItem-depth2-middle-bg)] font-medium";
|
|
4823
4824
|
if (multi) {
|
|
4824
4825
|
const leafValues = groupLeafValues.get(idx) ?? [];
|
|
4825
4826
|
const total = leafValues.length;
|
|
@@ -4837,12 +4838,12 @@ function ItemList({
|
|
|
4837
4838
|
"data-select-focused": groupFocused ? "true" : void 0,
|
|
4838
4839
|
"data-select-active": groupFocused ? "true" : void 0,
|
|
4839
4840
|
className: cn(
|
|
4840
|
-
"flex w-full select-none items-center gap-[8px] border-none py-[4px] pr-[12px] text-left text-[12px] leading-[20px] text-[color:var(--cmp-
|
|
4841
|
+
"flex w-full select-none items-center gap-[8px] border-none py-[4px] pr-[12px] text-left text-[12px] leading-[20px] text-[color:var(--cmp-listBoxItem-content-default)]",
|
|
4841
4842
|
groupTone,
|
|
4842
|
-
groupDisabled ? "cursor-not-allowed text-[color:var(--cmp-
|
|
4843
|
-
groupDisabled && isDepth1 && "bg-[var(--cmp-
|
|
4843
|
+
groupDisabled ? "cursor-not-allowed text-[color:var(--cmp-listBoxItem-content-disabled)]" : "cursor-pointer",
|
|
4844
|
+
groupDisabled && isDepth1 && "bg-[var(--cmp-listBoxItem-depth1-bg-disabled)]",
|
|
4844
4845
|
// 포커스 하이라이트는 depth 배경보다 뒤에 둬 tailwind-merge 로 이기게 한다.
|
|
4845
|
-
groupFocused && !groupDisabled && "bg-[var(--cmp-
|
|
4846
|
+
groupFocused && !groupDisabled && "bg-[var(--cmp-listBoxItem-bg-hover)] text-[color:var(--cmp-listBoxItem-content-hover)]"
|
|
4846
4847
|
),
|
|
4847
4848
|
style: { paddingLeft: padLeft },
|
|
4848
4849
|
onMouseEnter: () => onHoverValue(`__group_${idx}__`),
|
|
@@ -4862,7 +4863,7 @@ function ItemList({
|
|
|
4862
4863
|
{
|
|
4863
4864
|
className: cn(
|
|
4864
4865
|
"shrink-0 font-medium",
|
|
4865
|
-
groupFocused ? "text-white" : "text-[color:var(--cmp-
|
|
4866
|
+
groupFocused ? "text-white" : "text-[color:var(--cmp-listBoxItem-content-disabled)]"
|
|
4866
4867
|
),
|
|
4867
4868
|
children: [
|
|
4868
4869
|
"(",
|
|
@@ -4882,12 +4883,12 @@ function ItemList({
|
|
|
4882
4883
|
"div",
|
|
4883
4884
|
{
|
|
4884
4885
|
className: cn(
|
|
4885
|
-
"select-none py-[4px] pr-[12px] text-[12px] leading-[20px] text-[color:var(--cmp-
|
|
4886
|
+
"select-none py-[4px] pr-[12px] text-[12px] leading-[20px] text-[color:var(--cmp-listBoxItem-content-default)]",
|
|
4886
4887
|
groupTone,
|
|
4887
4888
|
// 하위가 전부 비활성이면(select.config 에서 bubble-up) 어미 그룹도 비활성 처리:
|
|
4888
4889
|
// 텍스트는 회색(#888), depth1 그룹은 파란 배경 대신 회색(#EEE)으로 (depth2 는 #F6F6F6 유지)
|
|
4889
|
-
o.disabled && "cursor-not-allowed text-[color:var(--cmp-
|
|
4890
|
-
o.disabled && isDepth1 && "bg-[var(--cmp-
|
|
4890
|
+
o.disabled && "cursor-not-allowed text-[color:var(--cmp-listBoxItem-content-disabled)]",
|
|
4891
|
+
o.disabled && isDepth1 && "bg-[var(--cmp-listBoxItem-depth1-bg-disabled)]"
|
|
4891
4892
|
),
|
|
4892
4893
|
style: { paddingLeft: padLeft },
|
|
4893
4894
|
children: o.label
|
|
@@ -4907,8 +4908,8 @@ function ItemList({
|
|
|
4907
4908
|
"data-select-active": focusedValue === o.value ? "true" : void 0,
|
|
4908
4909
|
className: cn(
|
|
4909
4910
|
itemBase,
|
|
4910
|
-
isSelected && !multi && "font-bold text-[color:var(--cmp-
|
|
4911
|
-
focusedValue === o.value && "bg-[var(--cmp-
|
|
4911
|
+
isSelected && !multi && "font-bold text-[color:var(--cmp-listBoxItem-content-selected)]",
|
|
4912
|
+
focusedValue === o.value && "bg-[var(--cmp-listBoxItem-bg-hover)] text-[color:var(--cmp-listBoxItem-content-hover)]",
|
|
4912
4913
|
// 비활성 항목은 hover/focus 스타일 대상에서 제외한다.
|
|
4913
4914
|
// (:hover 는 disabled 버튼에도 매칭되므로 클래스 자체를 붙이지 않아야 한다)
|
|
4914
4915
|
!o.disabled && activeClass
|