@sellmate/design-system-react 1.0.62 → 1.0.63

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.
@@ -77,6 +77,7 @@ export const SdButtonV2 = /*@__PURE__*/ createComponent({
77
77
  name: 'name',
78
78
  label: 'label',
79
79
  icon: 'icon',
80
+ rightIcon: 'right-icon',
80
81
  ariaLabel: 'aria-label',
81
82
  disabled: 'disabled',
82
83
  type: 'type'
@@ -108,12 +109,24 @@ export const SdCheckbox = /*@__PURE__*/ createComponent({
108
109
  value: 'value',
109
110
  val: 'val',
110
111
  disabled: 'disabled',
112
+ inverse: 'inverse',
111
113
  label: 'label'
112
114
  },
113
115
  hydrateModule: import('@sellmate/design-system/hydrate'),
114
116
  clientModule: clientComponents.SdCheckbox,
115
117
  serializeShadowRoot,
116
118
  });
119
+ export const SdCircleProgress = /*@__PURE__*/ createComponent({
120
+ tagName: 'sd-circle-progress',
121
+ properties: {
122
+ indeterminate: 'indeterminate',
123
+ value: 'value',
124
+ type: 'type'
125
+ },
126
+ hydrateModule: import('@sellmate/design-system/hydrate'),
127
+ clientModule: clientComponents.SdCircleProgress,
128
+ serializeShadowRoot,
129
+ });
117
130
  export const SdConfirmModal = /*@__PURE__*/ createComponent({
118
131
  tagName: 'sd-confirm-modal',
119
132
  properties: {
@@ -241,6 +254,7 @@ export const SdField = /*@__PURE__*/ createComponent({
241
254
  hint: 'hint',
242
255
  errorMessage: 'error-message',
243
256
  width: 'width',
257
+ size: 'size',
244
258
  label: 'label',
245
259
  addonLabel: 'addon-label',
246
260
  labelTooltip: 'label-tooltip',
@@ -372,11 +386,24 @@ export const SdInput = /*@__PURE__*/ createComponent({
372
386
  clientModule: clientComponents.SdInput,
373
387
  serializeShadowRoot,
374
388
  });
375
- export const SdLoadingSpinner = /*@__PURE__*/ createComponent({
376
- tagName: 'sd-loading-spinner',
377
- properties: { color: 'color' },
389
+ export const SdLoadingContainer = /*@__PURE__*/ createComponent({
390
+ tagName: 'sd-loading-container',
391
+ properties: {},
378
392
  hydrateModule: import('@sellmate/design-system/hydrate'),
379
- clientModule: clientComponents.SdLoadingSpinner,
393
+ clientModule: clientComponents.SdLoadingContainer,
394
+ serializeShadowRoot,
395
+ });
396
+ export const SdLoadingModal = /*@__PURE__*/ createComponent({
397
+ tagName: 'sd-loading-modal',
398
+ properties: {
399
+ state: 'state',
400
+ message: 'message',
401
+ buttonLabel: 'button-label',
402
+ width: 'width',
403
+ height: 'height'
404
+ },
405
+ hydrateModule: import('@sellmate/design-system/hydrate'),
406
+ clientModule: clientComponents.SdLoadingModal,
380
407
  serializeShadowRoot,
381
408
  });
382
409
  export const SdModalContainer = /*@__PURE__*/ createComponent({
@@ -488,8 +515,8 @@ export const SdRadio = /*@__PURE__*/ createComponent({
488
515
  clientModule: clientComponents.SdRadio,
489
516
  serializeShadowRoot,
490
517
  });
491
- export const SdRadioButtonGroup = /*@__PURE__*/ createComponent({
492
- tagName: 'sd-radio-button-group',
518
+ export const SdRadioButton = /*@__PURE__*/ createComponent({
519
+ tagName: 'sd-radio-button',
493
520
  properties: {
494
521
  value: 'value',
495
522
  size: 'size',
@@ -498,7 +525,7 @@ export const SdRadioButtonGroup = /*@__PURE__*/ createComponent({
498
525
  options: 'options'
499
526
  },
500
527
  hydrateModule: import('@sellmate/design-system/hydrate'),
501
- clientModule: clientComponents.SdRadioButtonGroup,
528
+ clientModule: clientComponents.SdRadioButton,
502
529
  serializeShadowRoot,
503
530
  });
504
531
  export const SdRadioGroup = /*@__PURE__*/ createComponent({
@@ -734,6 +761,44 @@ export const SdSelectV2Trigger = /*@__PURE__*/ createComponent({
734
761
  clientModule: clientComponents.SdSelectV2Trigger,
735
762
  serializeShadowRoot,
736
763
  });
764
+ export const SdSwitch = /*@__PURE__*/ createComponent({
765
+ tagName: 'sd-switch',
766
+ properties: {
767
+ value: 'value',
768
+ label: 'label',
769
+ disabled: 'disabled'
770
+ },
771
+ hydrateModule: import('@sellmate/design-system/hydrate'),
772
+ clientModule: clientComponents.SdSwitch,
773
+ serializeShadowRoot,
774
+ });
775
+ export const SdTable = /*@__PURE__*/ createComponent({
776
+ tagName: 'sd-table',
777
+ properties: {
778
+ tableId: 'table-id',
779
+ rowKey: 'row-key',
780
+ selectable: 'selectable',
781
+ resizable: 'resizable',
782
+ width: 'width',
783
+ height: 'height',
784
+ stickyHeader: 'sticky-header',
785
+ noDataLabel: 'no-data-label',
786
+ isLoading: 'is-loading',
787
+ useInternalPagination: 'use-internal-pagination',
788
+ useRowsPerPageSelect: 'use-rows-per-page-select',
789
+ useVirtualScroll: 'use-virtual-scroll',
790
+ rowHeight: 'row-height',
791
+ virtualBuffer: 'virtual-buffer',
792
+ virtualEndThreshold: 'virtual-end-threshold',
793
+ columns: 'columns',
794
+ rows: 'rows',
795
+ selected: 'selected',
796
+ rowsPerPageOption: 'rowsPerPageOption'
797
+ },
798
+ hydrateModule: import('@sellmate/design-system/hydrate'),
799
+ clientModule: clientComponents.SdTable,
800
+ serializeShadowRoot,
801
+ });
737
802
  export const SdTabs = /*@__PURE__*/ createComponent({
738
803
  tagName: 'sd-tabs',
739
804
  properties: {
@@ -758,6 +823,26 @@ export const SdTag = /*@__PURE__*/ createComponent({
758
823
  clientModule: clientComponents.SdTag,
759
824
  serializeShadowRoot,
760
825
  });
826
+ export const SdTbody = /*@__PURE__*/ createComponent({
827
+ tagName: 'sd-tbody',
828
+ properties: {
829
+ rows: 'rows'
830
+ },
831
+ hydrateModule: import('@sellmate/design-system/hydrate'),
832
+ clientModule: clientComponents.SdTbody,
833
+ serializeShadowRoot,
834
+ });
835
+ export const SdTd = /*@__PURE__*/ createComponent({
836
+ tagName: 'sd-td',
837
+ properties: {
838
+ field: 'field',
839
+ rowKey: 'row-key',
840
+ align: 'align'
841
+ },
842
+ hydrateModule: import('@sellmate/design-system/hydrate'),
843
+ clientModule: clientComponents.SdTd,
844
+ serializeShadowRoot,
845
+ });
761
846
  export const SdTextLink = /*@__PURE__*/ createComponent({
762
847
  tagName: 'sd-text-link',
763
848
  properties: {
@@ -801,6 +886,22 @@ export const SdTextarea = /*@__PURE__*/ createComponent({
801
886
  clientModule: clientComponents.SdTextarea,
802
887
  serializeShadowRoot,
803
888
  });
889
+ export const SdThead = /*@__PURE__*/ createComponent({
890
+ tagName: 'sd-thead',
891
+ properties: {
892
+ selectable: 'selectable',
893
+ resizable: 'resizable',
894
+ stickyHeader: 'sticky-header',
895
+ scrolledLeft: 'scrolled-left',
896
+ scrolledRight: 'scrolled-right',
897
+ columns: 'columns',
898
+ rows: 'rows',
899
+ columnWidths: 'columnWidths'
900
+ },
901
+ hydrateModule: import('@sellmate/design-system/hydrate'),
902
+ clientModule: clientComponents.SdThead,
903
+ serializeShadowRoot,
904
+ });
804
905
  export const SdToast = /*@__PURE__*/ createComponent({
805
906
  tagName: 'sd-toast',
806
907
  properties: {
@@ -838,17 +939,6 @@ export const SdToggle = /*@__PURE__*/ createComponent({
838
939
  clientModule: clientComponents.SdToggle,
839
940
  serializeShadowRoot,
840
941
  });
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
942
  export const SdTooltip = /*@__PURE__*/ createComponent({
853
943
  tagName: 'sd-tooltip',
854
944
  properties: {
@@ -868,3 +958,26 @@ export const SdTooltip = /*@__PURE__*/ createComponent({
868
958
  clientModule: clientComponents.SdTooltip,
869
959
  serializeShadowRoot,
870
960
  });
961
+ export const SdTr = /*@__PURE__*/ createComponent({
962
+ tagName: 'sd-tr',
963
+ properties: {
964
+ selectable: 'selectable',
965
+ rowKey: 'row-key',
966
+ columns: 'columns'
967
+ },
968
+ hydrateModule: import('@sellmate/design-system/hydrate'),
969
+ clientModule: clientComponents.SdTr,
970
+ serializeShadowRoot,
971
+ });
972
+ export const TableTest = /*@__PURE__*/ createComponent({
973
+ tagName: 'table-test',
974
+ properties: {
975
+ bordered: 'bordered',
976
+ striped: 'striped',
977
+ columns: 'columns',
978
+ rows: 'rows'
979
+ },
980
+ hydrateModule: import('@sellmate/design-system/hydrate'),
981
+ clientModule: clientComponents.TableTest,
982
+ serializeShadowRoot,
983
+ });
@@ -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
  },