@sellmate/design-system-react 1.0.62 → 1.0.64

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.
@@ -44,6 +44,7 @@ export const SdBarcodeInput = /*@__PURE__*/ createComponent({
44
44
  focused: 'focused',
45
45
  hovered: 'hovered',
46
46
  label: 'label',
47
+ labelWidth: 'label-width',
47
48
  labelTooltip: 'label-tooltip',
48
49
  rules: 'rules'
49
50
  },
@@ -77,6 +78,7 @@ export const SdButtonV2 = /*@__PURE__*/ createComponent({
77
78
  name: 'name',
78
79
  label: 'label',
79
80
  icon: 'icon',
81
+ rightIcon: 'right-icon',
80
82
  ariaLabel: 'aria-label',
81
83
  disabled: 'disabled',
82
84
  type: 'type'
@@ -108,12 +110,24 @@ export const SdCheckbox = /*@__PURE__*/ createComponent({
108
110
  value: 'value',
109
111
  val: 'val',
110
112
  disabled: 'disabled',
113
+ inverse: 'inverse',
111
114
  label: 'label'
112
115
  },
113
116
  hydrateModule: import('@sellmate/design-system/hydrate'),
114
117
  clientModule: clientComponents.SdCheckbox,
115
118
  serializeShadowRoot,
116
119
  });
120
+ export const SdCircleProgress = /*@__PURE__*/ createComponent({
121
+ tagName: 'sd-circle-progress',
122
+ properties: {
123
+ indeterminate: 'indeterminate',
124
+ value: 'value',
125
+ type: 'type'
126
+ },
127
+ hydrateModule: import('@sellmate/design-system/hydrate'),
128
+ clientModule: clientComponents.SdCircleProgress,
129
+ serializeShadowRoot,
130
+ });
117
131
  export const SdConfirmModal = /*@__PURE__*/ createComponent({
118
132
  tagName: 'sd-confirm-modal',
119
133
  properties: {
@@ -158,6 +172,7 @@ export const SdDatePicker = /*@__PURE__*/ createComponent({
158
172
  disabled: 'disabled',
159
173
  width: 'width',
160
174
  label: 'label',
175
+ labelWidth: 'label-width',
161
176
  addonLabel: 'addon-label',
162
177
  hint: 'hint',
163
178
  errorMessage: 'error-message',
@@ -198,6 +213,7 @@ export const SdDateRangePicker = /*@__PURE__*/ createComponent({
198
213
  disabled: 'disabled',
199
214
  width: 'width',
200
215
  label: 'label',
216
+ labelWidth: 'label-width',
201
217
  addonLabel: 'addon-label',
202
218
  hint: 'hint',
203
219
  errorMessage: 'error-message',
@@ -241,7 +257,9 @@ export const SdField = /*@__PURE__*/ createComponent({
241
257
  hint: 'hint',
242
258
  errorMessage: 'error-message',
243
259
  width: 'width',
260
+ size: 'size',
244
261
  label: 'label',
262
+ labelWidth: 'label-width',
245
263
  addonLabel: 'addon-label',
246
264
  labelTooltip: 'label-tooltip',
247
265
  rules: 'rules'
@@ -263,6 +281,7 @@ export const SdFilePicker = /*@__PURE__*/ createComponent({
263
281
  maxFiles: 'max-files',
264
282
  name: 'name',
265
283
  label: 'label',
284
+ labelWidth: 'label-width',
266
285
  addonLabel: 'addon-label',
267
286
  hint: 'hint',
268
287
  errorMessage: 'error-message',
@@ -365,6 +384,7 @@ export const SdInput = /*@__PURE__*/ createComponent({
365
384
  focused: 'focused',
366
385
  hovered: 'hovered',
367
386
  label: 'label',
387
+ labelWidth: 'label-width',
368
388
  labelTooltip: 'label-tooltip',
369
389
  rules: 'rules'
370
390
  },
@@ -372,11 +392,24 @@ export const SdInput = /*@__PURE__*/ createComponent({
372
392
  clientModule: clientComponents.SdInput,
373
393
  serializeShadowRoot,
374
394
  });
375
- export const SdLoadingSpinner = /*@__PURE__*/ createComponent({
376
- tagName: 'sd-loading-spinner',
377
- properties: { color: 'color' },
395
+ export const SdLoadingContainer = /*@__PURE__*/ createComponent({
396
+ tagName: 'sd-loading-container',
397
+ properties: {},
378
398
  hydrateModule: import('@sellmate/design-system/hydrate'),
379
- clientModule: clientComponents.SdLoadingSpinner,
399
+ clientModule: clientComponents.SdLoadingContainer,
400
+ serializeShadowRoot,
401
+ });
402
+ export const SdLoadingModal = /*@__PURE__*/ createComponent({
403
+ tagName: 'sd-loading-modal',
404
+ properties: {
405
+ state: 'state',
406
+ message: 'message',
407
+ buttonLabel: 'button-label',
408
+ width: 'width',
409
+ height: 'height'
410
+ },
411
+ hydrateModule: import('@sellmate/design-system/hydrate'),
412
+ clientModule: clientComponents.SdLoadingModal,
380
413
  serializeShadowRoot,
381
414
  });
382
415
  export const SdModalContainer = /*@__PURE__*/ createComponent({
@@ -397,6 +430,7 @@ export const SdNumberInput = /*@__PURE__*/ createComponent({
397
430
  useDecimal: 'use-decimal',
398
431
  value: 'value',
399
432
  label: 'label',
433
+ labelWidth: 'label-width',
400
434
  addonLabel: 'addon-label',
401
435
  placeholder: 'placeholder',
402
436
  disabled: 'disabled',
@@ -488,8 +522,8 @@ export const SdRadio = /*@__PURE__*/ createComponent({
488
522
  clientModule: clientComponents.SdRadio,
489
523
  serializeShadowRoot,
490
524
  });
491
- export const SdRadioButtonGroup = /*@__PURE__*/ createComponent({
492
- tagName: 'sd-radio-button-group',
525
+ export const SdRadioButton = /*@__PURE__*/ createComponent({
526
+ tagName: 'sd-radio-button',
493
527
  properties: {
494
528
  value: 'value',
495
529
  size: 'size',
@@ -498,7 +532,7 @@ export const SdRadioButtonGroup = /*@__PURE__*/ createComponent({
498
532
  options: 'options'
499
533
  },
500
534
  hydrateModule: import('@sellmate/design-system/hydrate'),
501
- clientModule: clientComponents.SdRadioButtonGroup,
535
+ clientModule: clientComponents.SdRadioButton,
502
536
  serializeShadowRoot,
503
537
  });
504
538
  export const SdRadioGroup = /*@__PURE__*/ createComponent({
@@ -527,6 +561,7 @@ export const SdSelect = /*@__PURE__*/ createComponent({
527
561
  clearable: 'clearable',
528
562
  searchable: 'searchable',
529
563
  label: 'label',
564
+ labelWidth: 'label-width',
530
565
  addonLabel: 'addon-label',
531
566
  labelTooltip: 'label-tooltip',
532
567
  error: 'error',
@@ -567,6 +602,7 @@ export const SdSelectGroup = /*@__PURE__*/ createComponent({
567
602
  clearable: 'clearable',
568
603
  searchable: 'searchable',
569
604
  label: 'label',
605
+ labelWidth: 'label-width',
570
606
  addonLabel: 'addon-label',
571
607
  labelTooltip: 'label-tooltip',
572
608
  error: 'error',
@@ -591,6 +627,7 @@ export const SdSelectMultiple = /*@__PURE__*/ createComponent({
591
627
  useAll: 'use-all',
592
628
  useCheckbox: 'use-checkbox',
593
629
  label: 'label',
630
+ labelWidth: 'label-width',
594
631
  labelTooltip: 'label-tooltip',
595
632
  error: 'error',
596
633
  value: 'value',
@@ -616,6 +653,7 @@ export const SdSelectMultipleGroup = /*@__PURE__*/ createComponent({
616
653
  allCheckedLabel: 'all-checked-label',
617
654
  allCheckOptionLabel: 'all-check-option-label',
618
655
  label: 'label',
656
+ labelWidth: 'label-width',
619
657
  labelTooltip: 'label-tooltip',
620
658
  error: 'error',
621
659
  value: 'value',
@@ -673,6 +711,7 @@ export const SdSelectV2 = /*@__PURE__*/ createComponent({
673
711
  dropdownHeight: 'dropdown-height',
674
712
  disabled: 'disabled',
675
713
  label: 'label',
714
+ labelWidth: 'label-width',
676
715
  addonLabel: 'addon-label',
677
716
  error: 'error',
678
717
  hint: 'hint',
@@ -734,6 +773,44 @@ export const SdSelectV2Trigger = /*@__PURE__*/ createComponent({
734
773
  clientModule: clientComponents.SdSelectV2Trigger,
735
774
  serializeShadowRoot,
736
775
  });
776
+ export const SdSwitch = /*@__PURE__*/ createComponent({
777
+ tagName: 'sd-switch',
778
+ properties: {
779
+ value: 'value',
780
+ label: 'label',
781
+ disabled: 'disabled'
782
+ },
783
+ hydrateModule: import('@sellmate/design-system/hydrate'),
784
+ clientModule: clientComponents.SdSwitch,
785
+ serializeShadowRoot,
786
+ });
787
+ export const SdTable = /*@__PURE__*/ createComponent({
788
+ tagName: 'sd-table',
789
+ properties: {
790
+ tableId: 'table-id',
791
+ rowKey: 'row-key',
792
+ selectable: 'selectable',
793
+ resizable: 'resizable',
794
+ width: 'width',
795
+ height: 'height',
796
+ stickyHeader: 'sticky-header',
797
+ noDataLabel: 'no-data-label',
798
+ isLoading: 'is-loading',
799
+ useInternalPagination: 'use-internal-pagination',
800
+ useRowsPerPageSelect: 'use-rows-per-page-select',
801
+ useVirtualScroll: 'use-virtual-scroll',
802
+ rowHeight: 'row-height',
803
+ virtualBuffer: 'virtual-buffer',
804
+ virtualEndThreshold: 'virtual-end-threshold',
805
+ columns: 'columns',
806
+ rows: 'rows',
807
+ selected: 'selected',
808
+ rowsPerPageOption: 'rowsPerPageOption'
809
+ },
810
+ hydrateModule: import('@sellmate/design-system/hydrate'),
811
+ clientModule: clientComponents.SdTable,
812
+ serializeShadowRoot,
813
+ });
737
814
  export const SdTabs = /*@__PURE__*/ createComponent({
738
815
  tagName: 'sd-tabs',
739
816
  properties: {
@@ -758,6 +835,26 @@ export const SdTag = /*@__PURE__*/ createComponent({
758
835
  clientModule: clientComponents.SdTag,
759
836
  serializeShadowRoot,
760
837
  });
838
+ export const SdTbody = /*@__PURE__*/ createComponent({
839
+ tagName: 'sd-tbody',
840
+ properties: {
841
+ rows: 'rows'
842
+ },
843
+ hydrateModule: import('@sellmate/design-system/hydrate'),
844
+ clientModule: clientComponents.SdTbody,
845
+ serializeShadowRoot,
846
+ });
847
+ export const SdTd = /*@__PURE__*/ createComponent({
848
+ tagName: 'sd-td',
849
+ properties: {
850
+ field: 'field',
851
+ rowKey: 'row-key',
852
+ align: 'align'
853
+ },
854
+ hydrateModule: import('@sellmate/design-system/hydrate'),
855
+ clientModule: clientComponents.SdTd,
856
+ serializeShadowRoot,
857
+ });
761
858
  export const SdTextLink = /*@__PURE__*/ createComponent({
762
859
  tagName: 'sd-text-link',
763
860
  properties: {
@@ -787,6 +884,7 @@ export const SdTextarea = /*@__PURE__*/ createComponent({
787
884
  spellcheck: 'spellcheck',
788
885
  width: 'width',
789
886
  label: 'label',
887
+ labelWidth: 'label-width',
790
888
  addonLabel: 'addon-label',
791
889
  hint: 'hint',
792
890
  errorMessage: 'error-message',
@@ -801,6 +899,22 @@ export const SdTextarea = /*@__PURE__*/ createComponent({
801
899
  clientModule: clientComponents.SdTextarea,
802
900
  serializeShadowRoot,
803
901
  });
902
+ export const SdThead = /*@__PURE__*/ createComponent({
903
+ tagName: 'sd-thead',
904
+ properties: {
905
+ selectable: 'selectable',
906
+ resizable: 'resizable',
907
+ stickyHeader: 'sticky-header',
908
+ scrolledLeft: 'scrolled-left',
909
+ scrolledRight: 'scrolled-right',
910
+ columns: 'columns',
911
+ rows: 'rows',
912
+ columnWidths: 'columnWidths'
913
+ },
914
+ hydrateModule: import('@sellmate/design-system/hydrate'),
915
+ clientModule: clientComponents.SdThead,
916
+ serializeShadowRoot,
917
+ });
804
918
  export const SdToast = /*@__PURE__*/ createComponent({
805
919
  tagName: 'sd-toast',
806
920
  properties: {
@@ -838,17 +952,6 @@ export const SdToggle = /*@__PURE__*/ createComponent({
838
952
  clientModule: clientComponents.SdToggle,
839
953
  serializeShadowRoot,
840
954
  });
841
- export const SdToggleButton = /*@__PURE__*/ createComponent({
842
- tagName: 'sd-toggle-button',
843
- properties: {
844
- value: 'value',
845
- label: 'label',
846
- disabled: 'disabled'
847
- },
848
- hydrateModule: import('@sellmate/design-system/hydrate'),
849
- clientModule: clientComponents.SdToggleButton,
850
- serializeShadowRoot,
851
- });
852
955
  export const SdTooltip = /*@__PURE__*/ createComponent({
853
956
  tagName: 'sd-tooltip',
854
957
  properties: {
@@ -868,3 +971,26 @@ export const SdTooltip = /*@__PURE__*/ createComponent({
868
971
  clientModule: clientComponents.SdTooltip,
869
972
  serializeShadowRoot,
870
973
  });
974
+ export const SdTr = /*@__PURE__*/ createComponent({
975
+ tagName: 'sd-tr',
976
+ properties: {
977
+ selectable: 'selectable',
978
+ rowKey: 'row-key',
979
+ columns: 'columns'
980
+ },
981
+ hydrateModule: import('@sellmate/design-system/hydrate'),
982
+ clientModule: clientComponents.SdTr,
983
+ serializeShadowRoot,
984
+ });
985
+ export const TableTest = /*@__PURE__*/ createComponent({
986
+ tagName: 'table-test',
987
+ properties: {
988
+ bordered: 'bordered',
989
+ striped: 'striped',
990
+ columns: 'columns',
991
+ rows: 'rows'
992
+ },
993
+ hydrateModule: import('@sellmate/design-system/hydrate'),
994
+ clientModule: clientComponents.TableTest,
995
+ serializeShadowRoot,
996
+ });
@@ -0,0 +1,11 @@
1
+ import { type RefObject } from 'react';
2
+ export interface VirtualRow<T = Record<string, any>> {
3
+ /** 전체 rows 기준 절대 인덱스 — SdTr의 rowKey로 사용 */
4
+ index: number;
5
+ row: T;
6
+ }
7
+ export declare function useSdTableVirtualScroll<T extends Record<string, any>>(tableRef: RefObject<HTMLElement | null>, rows: T[]): {
8
+ virtualRows: VirtualRow<T>[];
9
+ from: number;
10
+ to: number;
11
+ };
@@ -0,0 +1,56 @@
1
+ import { useEffect, useMemo, useState } from 'react';
2
+ export function useSdTableVirtualScroll(tableRef, rows) {
3
+ const [range, setRange] = useState(null);
4
+ useEffect(() => {
5
+ let targetEl = null;
6
+ let rafId = 0;
7
+ const onVirtualUpdate = (e) => {
8
+ const { from, to } = e.detail;
9
+ setRange({ from, to });
10
+ };
11
+ const syncRange = (el) => {
12
+ const currentRange = el.getVirtualScrollRangeSync?.();
13
+ if (currentRange &&
14
+ typeof currentRange.from === 'number' &&
15
+ typeof currentRange.to === 'number') {
16
+ setRange({ from: currentRange.from, to: currentRange.to });
17
+ return true;
18
+ }
19
+ return false;
20
+ };
21
+ const attachWhenReady = () => {
22
+ const el = tableRef.current;
23
+ if (!el) {
24
+ rafId = requestAnimationFrame(attachWhenReady);
25
+ return;
26
+ }
27
+ targetEl = el;
28
+ targetEl.addEventListener('sdVirtualUpdate', onVirtualUpdate);
29
+ const trySync = () => {
30
+ if (!targetEl)
31
+ return;
32
+ if (!syncRange(targetEl)) {
33
+ rafId = requestAnimationFrame(trySync);
34
+ }
35
+ };
36
+ trySync();
37
+ };
38
+ attachWhenReady();
39
+ return () => {
40
+ cancelAnimationFrame(rafId);
41
+ targetEl?.removeEventListener('sdVirtualUpdate', onVirtualUpdate);
42
+ };
43
+ }, [tableRef]);
44
+ const virtualRows = useMemo(() => {
45
+ if (!range)
46
+ return [];
47
+ return rows
48
+ .slice(range.from, range.to)
49
+ .map((row, i) => ({ index: range.from + i, row }));
50
+ }, [rows, range]);
51
+ return {
52
+ virtualRows,
53
+ from: range?.from ?? 0,
54
+ to: range?.to ?? 0,
55
+ };
56
+ }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from './components/components.js';
2
+ export { useSdTableVirtualScroll } from './hooks/useSdTableVirtualScroll';
3
+ export type { VirtualRow } from './hooks/useSdTableVirtualScroll';
2
4
  export { defineCustomElements } from '@sellmate/design-system/loader';
3
- export { SdTable } from './SdTable';
4
- export type { SdTableProps } from './SdTable';
5
5
  export { sdModal } from './sdModal';
6
6
  export type { SdModalCreateOption } from './sdModal';
7
- export type { SdTableSortDir, SdTableColumn, Row as SdTableRow, SelectOption, SelectOptionGroup, SelectEvents, SelectMultipleEvents, SelectStyleProps, RadioValue, RadioOption, ButtonVariant, ButtonSize, ButtonV2Name, DropdownButtonItem, DropdownButtonName, DropdownButtonSize, DropdownButtonValue, Rule, ValidatableField, SdTooltipProps, TagName, ToastType, CheckedType, Type as DateBoxType, TabOption, } from '@sellmate/design-system';
7
+ export { sdLoading } from '@sellmate/design-system/utils';
8
+ export type { SdLoadingShowOptions } from '@sellmate/design-system/utils';
9
+ export type { SdTableColumn, Row as SdTableRow, SelectOption, SelectOptionGroup, SelectEvents, SelectMultipleEvents, SelectStyleProps, RadioValue, RadioOption, ButtonVariant, ButtonSize, ButtonV2Name, DropdownButtonItem, DropdownButtonName, DropdownButtonSize, DropdownButtonValue, Rule, ValidatableField, SdTooltipProps, TagName, ToastType, CheckedType, Type as DateBoxType, TabOption, } from '@sellmate/design-system';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  export * from './components/components.js';
3
+ export { useSdTableVirtualScroll } from './hooks/useSdTableVirtualScroll';
3
4
  export { defineCustomElements } from '@sellmate/design-system/loader';
4
- export { SdTable } from './SdTable';
5
5
  export { sdModal } from './sdModal';
6
+ export { sdLoading } from '@sellmate/design-system/utils';
package/dist/sdModal.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type ComponentType } from 'react';
2
- import { type ConfirmModalOptions, type ModalDialogRef, type SdModalCreateOption as CoreSdModalCreateOption, type SdModalGlobalOptions } from '@sellmate/design-system/utils';
2
+ import { type ConfirmModalOptions, type LoadingModalOptions, type ModalDialogRef, type SdModalCreateOption as CoreSdModalCreateOption, type SdModalGlobalOptions } from '@sellmate/design-system/utils';
3
3
  /**
4
4
  * `sdModal.create` 에 넘기는 입력.
5
5
  *
@@ -29,6 +29,7 @@ export interface SdModalCreateOption extends Omit<CoreSdModalCreateOption, 'comp
29
29
  */
30
30
  export declare const sdModal: {
31
31
  confirm(options: ConfirmModalOptions): ModalDialogRef;
32
+ loading(options?: LoadingModalOptions): ModalDialogRef;
32
33
  configure(options: SdModalGlobalOptions): void;
33
34
  create(input: SdModalCreateOption): ModalDialogRef;
34
35
  };
package/dist/sdModal.js CHANGED
@@ -13,12 +13,7 @@ function mountReactComponent(component, componentProps) {
13
13
  flushSync(() => {
14
14
  root.render(createElement(component, componentProps));
15
15
  });
16
- const el = host.firstElementChild;
17
- if (!el) {
18
- root.unmount();
19
- throw new Error('[sdModal] 전달한 React 컴포넌트의 루트는 단일 요소여야 합니다.');
20
- }
21
- return { el, host, root };
16
+ return { el: host, host, root };
22
17
  }
23
18
  /**
24
19
  * React-aware `sdModal`.
@@ -38,6 +33,9 @@ export const sdModal = {
38
33
  confirm(options) {
39
34
  return coreSdModal.confirm(options);
40
35
  },
36
+ loading(options = {}) {
37
+ return coreSdModal.loading(options);
38
+ },
41
39
  configure(options) {
42
40
  coreSdModal.configure(options);
43
41
  },