@ncds/ui-admin 1.8.22-alpha.1 → 1.8.22-alpha.3

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.
Files changed (45) hide show
  1. package/dist/cjs/assets/scripts/table/scrollbar/const.js +50 -0
  2. package/dist/cjs/assets/scripts/table/scrollbar/drag.js +75 -0
  3. package/dist/cjs/assets/scripts/table/scrollbar/geometry.js +69 -0
  4. package/dist/cjs/assets/scripts/table/scrollbar/isolate.js +36 -0
  5. package/dist/cjs/src/components/data-display/table/Table.js +1 -0
  6. package/dist/cjs/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.js +390 -0
  7. package/dist/cjs/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.js +339 -0
  8. package/dist/cjs/src/components/data-display/table/useTableScrollbars.js +115 -86
  9. package/dist/cjs/src/generated/scoped-css.js +1 -1
  10. package/dist/esm/assets/scripts/table/scrollbar/const.js +44 -0
  11. package/dist/esm/assets/scripts/table/scrollbar/drag.js +67 -0
  12. package/dist/esm/assets/scripts/table/scrollbar/geometry.js +60 -0
  13. package/dist/esm/assets/scripts/table/scrollbar/isolate.js +27 -0
  14. package/dist/esm/src/components/data-display/table/Table.js +1 -0
  15. package/dist/esm/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.js +387 -0
  16. package/dist/esm/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.js +336 -0
  17. package/dist/esm/src/components/data-display/table/useTableScrollbars.js +85 -86
  18. package/dist/esm/src/generated/scoped-css.js +1 -1
  19. package/dist/temp/assets/scripts/table/scrollbar/const.d.ts +46 -0
  20. package/dist/temp/assets/scripts/table/scrollbar/const.js +44 -0
  21. package/dist/temp/assets/scripts/table/scrollbar/drag.d.ts +18 -0
  22. package/dist/temp/assets/scripts/table/scrollbar/drag.js +49 -0
  23. package/dist/temp/assets/scripts/table/scrollbar/geometry.d.ts +47 -0
  24. package/dist/temp/assets/scripts/table/scrollbar/geometry.js +37 -0
  25. package/dist/temp/assets/scripts/table/scrollbar/isolate.d.ts +4 -0
  26. package/dist/temp/assets/scripts/table/scrollbar/isolate.js +30 -0
  27. package/dist/temp/src/components/data-display/table/Table.js +1 -0
  28. package/dist/temp/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.d.ts +1 -0
  29. package/dist/temp/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.js +282 -0
  30. package/dist/temp/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.d.ts +1 -0
  31. package/dist/temp/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.js +244 -0
  32. package/dist/temp/src/components/data-display/table/useTableScrollbars.d.ts +2 -6
  33. package/dist/temp/src/components/data-display/table/useTableScrollbars.js +100 -72
  34. package/dist/temp/src/generated/scoped-css.js +1 -1
  35. package/dist/temp/src/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  36. package/dist/types/assets/scripts/table/scrollbar/const.d.ts +46 -0
  37. package/dist/types/assets/scripts/table/scrollbar/drag.d.ts +18 -0
  38. package/dist/types/assets/scripts/table/scrollbar/geometry.d.ts +47 -0
  39. package/dist/types/assets/scripts/table/scrollbar/isolate.d.ts +4 -0
  40. package/dist/types/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.d.ts +1 -0
  41. package/dist/types/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.d.ts +1 -0
  42. package/dist/types/src/components/data-display/table/useTableScrollbars.d.ts +2 -6
  43. package/dist/types/src/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  44. package/dist/ui-admin/assets/styles/style.css +49 -1
  45. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import { useEffect } from 'react';
2
- export declare const useIsomorphicLayoutEffect: typeof useEffect;
1
+ import { useLayoutEffect } from 'react';
2
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
@@ -0,0 +1,46 @@
1
+ /** Table 커스텀 스크롤바의 클래스명·속성명·수치 상수. React 와 CDN 이 함께 참조한다. */
2
+ /** `_table.scss` 의 `--ncua-table-header-height` 와 같은 값 */
3
+ export declare const TABLE_HEADER_HEIGHT = 40;
4
+ /** `.ncua-table__scrollbar-thumb { height }` 와 같은 값 */
5
+ export declare const SCROLLBAR_THUMB_MIN_HEIGHT = 40;
6
+ /** `.ncua-table__h-scrollbar-thumb { width }` 와 같은 값 */
7
+ export declare const H_SCROLLBAR_THUMB_MIN_WIDTH = 40;
8
+ /** `.ncua-table__h-scrollbar { left/right: var(--spacing-s) }` 와 같은 값 */
9
+ export declare const H_SCROLLBAR_SIDE_GAP = 8;
10
+ /** 세로 트랙 상하 여백 합계. 헤더 회피분은 `TABLE_HEADER_HEIGHT` 로 따로 뺀다 */
11
+ export declare const SCROLLBAR_TRACK_OFFSET = 16;
12
+ export declare const SCROLLBAR_CLASS_NAMES: {
13
+ readonly table: "ncua-table";
14
+ readonly tableWrapper: "ncua-table-wrapper";
15
+ readonly dataGrid: "ncua-data-grid";
16
+ readonly scrollArea: "ncua-table__scroll-area";
17
+ readonly scrollContainer: "ncua-table__scroll-container";
18
+ readonly scrollbar: "ncua-table__scrollbar";
19
+ readonly scrollbarThumb: "ncua-table__scrollbar-thumb";
20
+ readonly hScrollContainer: "ncua-table__h-scroll-container";
21
+ readonly hScrollInner: "ncua-table__h-scroll-inner";
22
+ readonly hScrollbar: "ncua-table__h-scrollbar";
23
+ readonly hScrollbarThumb: "ncua-table__h-scrollbar-thumb";
24
+ readonly tableElement: "ncua-table__table";
25
+ };
26
+ /** `optOut` 을 제외한 전부가 런타임에만 부착된다. 마크업에 직접 기재하지 않는다. */
27
+ export declare const SCROLLBAR_ATTRS: {
28
+ readonly ready: "data-scrollbar-ready";
29
+ /** `ready` 와 항상 함께 부착·제거한다 */
30
+ readonly owner: "data-scrollbar-owner";
31
+ readonly generated: "data-scrollbar-generated";
32
+ readonly fallbackArmed: "data-ncua-scrollbar-fallback";
33
+ readonly dragging: "data-dragging";
34
+ readonly optOut: "data-ncua-scrollbar";
35
+ };
36
+ export declare const SCROLLBAR_OWNERS: {
37
+ readonly cdn: "cdn";
38
+ readonly react: "react";
39
+ };
40
+ export type ScrollbarOwner = (typeof SCROLLBAR_OWNERS)[keyof typeof SCROLLBAR_OWNERS];
41
+ export declare const SCROLLBAR_OWNER_VALUES: readonly string[];
42
+ export declare const OPT_OUT_VALUE = "off";
43
+ export declare const AXIS_VALUES: readonly ["both", "x", "y"];
44
+ export type ScrollbarAxisOption = (typeof AXIS_VALUES)[number];
45
+ export declare const DEFAULT_AXIS: ScrollbarAxisOption;
46
+ export declare const LOG_PREFIX = "[ncua.TableScrollbar]";
@@ -0,0 +1,18 @@
1
+ /** React 합성 이벤트와 DOM 이벤트를 함께 받기 위한 최소 표면 */
2
+ export type DragPointerEvent = {
3
+ readonly clientX: number;
4
+ readonly clientY: number;
5
+ preventDefault: () => void;
6
+ };
7
+ export type ThumbDragInput = {
8
+ readonly axis: 'x' | 'y';
9
+ readonly scrollEl: HTMLElement;
10
+ readonly thumbEl: HTMLElement;
11
+ /** `[data-dragging]` 부착 대상 */
12
+ readonly draggingTarget: HTMLElement;
13
+ /** `DRAG_BASIS` 기준 길이. 축별 산출식이 달라 호출자가 넘긴다 */
14
+ readonly measureDragBasisSize: (clientSize: number) => number;
15
+ /** 바인딩 해제 시 진행 중인 드래그를 함께 끊는 신호 */
16
+ readonly releaseSignal?: AbortSignal;
17
+ };
18
+ export declare const startThumbDrag: (event: DragPointerEvent, input: ThumbDragInput) => void;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * 썸 치수·위치 산출. React 훅과 CDN 바인딩이 공유한다.
3
+ * SSR 경로에서도 평가되므로 `document`·`window` 를 참조하지 않는다.
4
+ */
5
+ export type AxisMetrics = {
6
+ readonly scrollOffset: number;
7
+ readonly scrollSize: number;
8
+ readonly clientSize: number;
9
+ readonly trackSize: number;
10
+ readonly thumbMinSize: number;
11
+ };
12
+ export type ThumbGeometry = {
13
+ /** `false` 이면 트랙·썸을 감춘다 */
14
+ readonly visible: boolean;
15
+ readonly size: number;
16
+ /** 트랙 기준 썸 오프셋 (px) */
17
+ readonly offset: number;
18
+ };
19
+ export declare const computeThumbGeometry: (metrics: AxisMetrics) => ThumbGeometry;
20
+ /** 호출자가 넘겨야 하는 축별 `dragBasisSize` 기준 */
21
+ export declare const DRAG_BASIS: {
22
+ readonly y: "clientSize";
23
+ readonly x: "trackSize";
24
+ };
25
+ export type DragScrollDeltaInput = {
26
+ readonly pointerDelta: number;
27
+ readonly scrollSize: number;
28
+ readonly clientSize: number;
29
+ readonly dragBasisSize: number;
30
+ readonly thumbSize: number;
31
+ };
32
+ /**
33
+ * 포인터 이동량(px) → 스크롤 오프셋 변화량(px).
34
+ * 환산 분모 기준이 축마다 다르므로 `dragBasisSize` 는 호출자가 `DRAG_BASIS` 대로 넘긴다.
35
+ */
36
+ export declare const computeDragScrollDelta: (input: DragScrollDeltaInput) => number;
37
+ export type HorizontalTrackBoxInput = {
38
+ readonly clientWidth: number;
39
+ readonly scrollLeft: number;
40
+ readonly sideGap: number;
41
+ };
42
+ export type HorizontalTrackBox = {
43
+ readonly translateX: number;
44
+ readonly width: number;
45
+ };
46
+ /** 가로 트랙은 스크롤 컨테이너 안에 있어 함께 밀리므로, 되돌릴 오프셋과 폭을 산출한다. */
47
+ export declare const computeHorizontalTrackBox: (input: HorizontalTrackBoxInput) => HorizontalTrackBox;
@@ -0,0 +1,4 @@
1
+ /** 스크롤·리사이즈는 초당 수십 회 불리므로 같은 지점의 실패는 1회만 기록한다 */
2
+ export declare const isolate: <A extends readonly unknown[]>(label: string, run: (...args: A) => void) => (...args: A) => void;
3
+ /** 1회성 호출용. 실패해도 나머지 정리·순회가 이어지도록 한다 */
4
+ export declare const runIsolated: (label: string, run: () => void) => void;
@@ -1,9 +1,6 @@
1
1
  import { type MouseEvent, type RefObject } from 'react';
2
- export declare const TABLE_HEADER_HEIGHT = 40;
3
- export declare const SCROLLBAR_THUMB_MIN_HEIGHT = 40;
4
- export declare const H_SCROLLBAR_THUMB_MIN_WIDTH = 40;
5
- export declare const H_SCROLLBAR_SIDE_GAP = 8;
6
- export declare const SCROLLBAR_TRACK_OFFSET = 16;
2
+ import { H_SCROLLBAR_SIDE_GAP, H_SCROLLBAR_THUMB_MIN_WIDTH, SCROLLBAR_THUMB_MIN_HEIGHT, SCROLLBAR_TRACK_OFFSET, TABLE_HEADER_HEIGHT } from '../../../../assets/scripts/table/scrollbar/const';
3
+ export { H_SCROLLBAR_SIDE_GAP, H_SCROLLBAR_THUMB_MIN_WIDTH, SCROLLBAR_THUMB_MIN_HEIGHT, SCROLLBAR_TRACK_OFFSET, TABLE_HEADER_HEIGHT, };
7
4
  type VerticalScrollbarOptions = {
8
5
  enabled: boolean;
9
6
  layoutKey: unknown;
@@ -24,4 +21,3 @@ type HorizontalScrollbarOptions = {
24
21
  export declare const useTableHorizontalScrollbar: ({ enabled, hScrollContainerRef, hScrollbarRef, hThumbRef, }: HorizontalScrollbarOptions) => {
25
22
  handleHThumbMouseDown: (e: MouseEvent<HTMLDivElement>) => void;
26
23
  };
27
- export {};
@@ -1,2 +1,2 @@
1
- import { useEffect } from 'react';
2
- export declare const useIsomorphicLayoutEffect: typeof useEffect;
1
+ import { useLayoutEffect } from 'react';
2
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
@@ -3900,6 +3900,7 @@ button {
3900
3900
  .ncua-selectbox {
3901
3901
  position: relative;
3902
3902
  display: inline-block;
3903
+ max-width: 100%;
3903
3904
  }
3904
3905
  .ncua-selectbox__content {
3905
3906
  position: relative;
@@ -3918,12 +3919,21 @@ button {
3918
3919
  border-color: var(--gray-400);
3919
3920
  box-shadow: var(--shadow-xs-focused-3px-gray-100);
3920
3921
  }
3922
+ .ncua-selectbox__content-inner {
3923
+ display: flex;
3924
+ align-items: center;
3925
+ width: 100%;
3926
+ min-width: 0;
3927
+ }
3921
3928
  .ncua-selectbox__value {
3922
3929
  flex: 1;
3930
+ min-width: 0;
3931
+ color: var(--gray-700);
3923
3932
  overflow: hidden;
3933
+ display: block;
3924
3934
  text-overflow: ellipsis;
3925
3935
  white-space: nowrap;
3926
- color: var(--gray-700);
3936
+ word-wrap: break-word;
3927
3937
  }
3928
3938
  .ncua-selectbox__value:empty::before {
3929
3939
  content: attr(data-placeholder);
@@ -3933,9 +3943,18 @@ button {
3933
3943
  display: flex;
3934
3944
  align-items: center;
3935
3945
  gap: 4px;
3946
+ min-width: 0;
3947
+ }
3948
+ .ncua-selectbox__value-text {
3949
+ overflow: hidden;
3950
+ display: block;
3951
+ text-overflow: ellipsis;
3952
+ white-space: nowrap;
3953
+ word-wrap: break-word;
3936
3954
  }
3937
3955
  .ncua-selectbox__value-icon {
3938
3956
  display: flex;
3957
+ flex-shrink: 0;
3939
3958
  align-items: center;
3940
3959
  justify-content: center;
3941
3960
  color: currentColor;
@@ -6953,6 +6972,35 @@ button {
6953
6972
  z-index: 2;
6954
6973
  }
6955
6974
 
6975
+ [data-ncua-scrollbar-fallback] .ncua-table__h-scroll-container:not([data-scrollbar-ready]),
6976
+ [data-ncua-scrollbar-fallback] .ncua-table__scroll-container:not([data-scrollbar-ready]) {
6977
+ scrollbar-width: thin;
6978
+ scrollbar-color: var(--gray-300) transparent;
6979
+ }
6980
+ [data-ncua-scrollbar-fallback] .ncua-table__h-scroll-container:not([data-scrollbar-ready])::-webkit-scrollbar,
6981
+ [data-ncua-scrollbar-fallback] .ncua-table__scroll-container:not([data-scrollbar-ready])::-webkit-scrollbar {
6982
+ display: block;
6983
+ width: 8px;
6984
+ height: 8px;
6985
+ }
6986
+ [data-ncua-scrollbar-fallback] .ncua-table__h-scroll-container:not([data-scrollbar-ready])::-webkit-scrollbar-thumb,
6987
+ [data-ncua-scrollbar-fallback] .ncua-table__scroll-container:not([data-scrollbar-ready])::-webkit-scrollbar-thumb {
6988
+ background: var(--gray-300);
6989
+ border-radius: var(--border-radius-md);
6990
+ }
6991
+
6992
+ [data-ncua-scrollbar-fallback] .ncua-table__h-scroll-container:not([data-scrollbar-ready]) > .ncua-table__h-scrollbar {
6993
+ display: none;
6994
+ }
6995
+
6996
+ [data-ncua-scrollbar-fallback] .ncua-table__scroll-area:not(:has(> .ncua-table__scroll-container[data-scrollbar-ready])) > .ncua-table__scrollbar {
6997
+ display: none;
6998
+ }
6999
+
7000
+ [data-ncua-scrollbar-fallback] .ncua-table:not(:has(.ncua-table__scroll-container[data-scrollbar-ready])) > .ncua-table__scrollbar {
7001
+ display: none;
7002
+ }
7003
+
6956
7004
  .ncua-table-dnd-preview {
6957
7005
  position: fixed;
6958
7006
  top: -9999px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ncds/ui-admin",
3
- "version": "1.8.22-alpha.1",
3
+ "version": "1.8.22-alpha.3",
4
4
  "description": "nhn-commerce의 어드민 디자인 시스템입니다.",
5
5
  "scripts": {
6
6
  "barrel": "node barrel.js",