@t3q-ui/design-system 1.67.8 → 1.68.1

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 (88) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +6 -0
  3. package/cli/doctor.mjs +7 -2
  4. package/cli/lib.mjs +23 -2
  5. package/cli/setup.mjs +9 -14
  6. package/cli/t3q-design.mjs +41 -15
  7. package/dist/components/agGridTable/index.cjs +19 -0
  8. package/dist/components/agGridTable/index.cjs.map +1 -1
  9. package/dist/components/agGridTable/index.js +19 -0
  10. package/dist/components/agGridTable/index.js.map +1 -1
  11. package/dist/components/alert.cjs +1 -1
  12. package/dist/components/alert.cjs.map +1 -1
  13. package/dist/components/alert.js +1 -1
  14. package/dist/components/alert.js.map +1 -1
  15. package/dist/components/checkbox.cjs +21 -6
  16. package/dist/components/checkbox.cjs.map +1 -1
  17. package/dist/components/checkbox.js +21 -6
  18. package/dist/components/checkbox.js.map +1 -1
  19. package/dist/components/columnFilter/ColumnFilterTag.cjs +20 -14
  20. package/dist/components/columnFilter/ColumnFilterTag.cjs.map +1 -1
  21. package/dist/components/columnFilter/ColumnFilterTag.js +20 -14
  22. package/dist/components/columnFilter/ColumnFilterTag.js.map +1 -1
  23. package/dist/components/columnVisibilityFilter.cjs +71 -36
  24. package/dist/components/columnVisibilityFilter.cjs.map +1 -1
  25. package/dist/components/columnVisibilityFilter.js +73 -38
  26. package/dist/components/columnVisibilityFilter.js.map +1 -1
  27. package/dist/components/command.cjs +2 -2
  28. package/dist/components/command.cjs.map +1 -1
  29. package/dist/components/command.js +2 -2
  30. package/dist/components/command.js.map +1 -1
  31. package/dist/components/form.cjs +20 -2
  32. package/dist/components/form.cjs.map +1 -1
  33. package/dist/components/form.js +20 -2
  34. package/dist/components/form.js.map +1 -1
  35. package/dist/components/iconSelect/index.cjs +2 -2
  36. package/dist/components/iconSelect/index.cjs.map +1 -1
  37. package/dist/components/iconSelect/index.js +2 -2
  38. package/dist/components/iconSelect/index.js.map +1 -1
  39. package/dist/components/multiSelect/multiSelectTrigger.cjs +1 -1
  40. package/dist/components/multiSelect/multiSelectTrigger.cjs.map +1 -1
  41. package/dist/components/multiSelect/multiSelectTrigger.js +1 -1
  42. package/dist/components/multiSelect/multiSelectTrigger.js.map +1 -1
  43. package/dist/components/parameterTable/ParameterTable.cjs +148 -90
  44. package/dist/components/parameterTable/ParameterTable.cjs.map +1 -1
  45. package/dist/components/parameterTable/ParameterTable.js +148 -90
  46. package/dist/components/parameterTable/ParameterTable.js.map +1 -1
  47. package/dist/components/parameterTable/ParameterTableRow.cjs +6 -1
  48. package/dist/components/parameterTable/ParameterTableRow.cjs.map +1 -1
  49. package/dist/components/parameterTable/ParameterTableRow.js +6 -1
  50. package/dist/components/parameterTable/ParameterTableRow.js.map +1 -1
  51. package/dist/components/select/selectEmpty.cjs +2 -2
  52. package/dist/components/select/selectEmpty.cjs.map +1 -1
  53. package/dist/components/select/selectEmpty.js +2 -2
  54. package/dist/components/select/selectEmpty.js.map +1 -1
  55. package/dist/components/tableFilterParts.cjs +24 -3
  56. package/dist/components/tableFilterParts.cjs.map +1 -1
  57. package/dist/components/tableFilterParts.js +24 -3
  58. package/dist/components/tableFilterParts.js.map +1 -1
  59. package/dist/components/tag.cjs +2 -1
  60. package/dist/components/tag.cjs.map +1 -1
  61. package/dist/components/tag.js +2 -1
  62. package/dist/components/tag.js.map +1 -1
  63. package/dist/design-system.css +16 -0
  64. package/dist/{index-BC9yt_Mm.d.cts → index-BGcNrSw4.d.cts} +1 -1
  65. package/dist/{index-BC9yt_Mm.d.ts → index-BGcNrSw4.d.ts} +1 -1
  66. package/dist/index.d.cts +8 -19
  67. package/dist/index.d.ts +8 -19
  68. package/dist/patterns/index.d.cts +1 -1
  69. package/dist/patterns/index.d.ts +1 -1
  70. package/dist/styles.css +18 -1
  71. package/dist/utils/cn.cjs +0 -1
  72. package/dist/utils/cn.cjs.map +1 -1
  73. package/dist/utils/cn.js +0 -1
  74. package/dist/utils/cn.js.map +1 -1
  75. package/dist/utils/index.cjs +7 -0
  76. package/dist/utils/index.cjs.map +1 -0
  77. package/dist/utils/index.d.cts +18 -0
  78. package/dist/utils/index.d.ts +18 -0
  79. package/dist/utils/index.js +7 -0
  80. package/dist/utils/index.js.map +1 -0
  81. package/dist/utils/sanitizeUserText.cjs +0 -1
  82. package/dist/utils/sanitizeUserText.cjs.map +1 -1
  83. package/dist/utils/sanitizeUserText.js +0 -1
  84. package/dist/utils/sanitizeUserText.js.map +1 -1
  85. package/mcp/manifests/components.json +6 -5
  86. package/package.json +19 -4
  87. package/skills/tds/reference/components.md +5 -1
  88. package/skills/tds/rules.md +1 -0
@@ -140,6 +140,10 @@ const ParameterTable = React.forwardRef(
140
140
  const pendingCursorRef = React.useRef(null);
141
141
  const reclickRef = React.useRef(null);
142
142
  const reclickEnteredRef = React.useRef(false);
143
+ const lastFocusRef = React.useRef(null);
144
+ React.useEffect(() => {
145
+ if (selection) lastFocusRef.current = selection.focus;
146
+ }, [selection]);
143
147
  const lastActiveKeyRef = React.useRef(null);
144
148
  React.useEffect(() => {
145
149
  let cell = null;
@@ -278,6 +282,20 @@ const ParameterTable = React.forwardRef(
278
282
  }),
279
283
  [maxRowIdx, totalCols]
280
284
  );
285
+ const selectEntryCell = React.useCallback(() => {
286
+ const rowCount = withAddRow ? rows.length : realRows.length;
287
+ if (rowCount === 0 || totalCols === 0) return;
288
+ const last = lastFocusRef.current;
289
+ let cell = last && last.rowIdx < rowCount && last.colIdx < totalCols ? last : null;
290
+ for (let rowIdx = 0; !cell && rowIdx < rowCount; rowIdx++) {
291
+ for (let colIdx = 0; !cell && colIdx < totalCols; colIdx++) {
292
+ if (isCellEditable({ rowIdx, colIdx })) cell = { rowIdx, colIdx };
293
+ }
294
+ }
295
+ const entry = cell ?? { rowIdx: 0, colIdx: 0 };
296
+ setSelection((prev) => prev ?? { anchor: entry, focus: entry });
297
+ setKeyboardMode(true);
298
+ }, [isCellEditable, realRows.length, rows.length, totalCols, withAddRow]);
281
299
  const setCellValue = React.useCallback(
282
300
  (rowIdx, colId, val) => {
283
301
  const target = rows[rowIdx];
@@ -402,9 +420,9 @@ const ParameterTable = React.forwardRef(
402
420
  reclickRef.current = selection && coordEquals(selection.anchor, coord) && coordEquals(selection.focus, coord) ? coord : null;
403
421
  reclickEnteredRef.current = false;
404
422
  event.preventDefault();
423
+ draggingRef.current = true;
405
424
  focusFloating();
406
425
  setSelection({ anchor: coord, focus: coord });
407
- draggingRef.current = true;
408
426
  },
409
427
  [
410
428
  columns,
@@ -640,7 +658,13 @@ const ParameterTable = React.forwardRef(
640
658
  return;
641
659
  }
642
660
  }
643
- if (!selection) return;
661
+ if (!selection) {
662
+ if (/^(Arrow|Home$|End$|Enter$|F2$)/.test(key) || isPrintableKey(event)) {
663
+ event.preventDefault();
664
+ selectEntryCell();
665
+ }
666
+ return;
667
+ }
644
668
  const focus = selection.focus;
645
669
  if ((key === "Backspace" || key === "Delete") && !isMod && !event.altKey) {
646
670
  event.preventDefault();
@@ -715,17 +739,21 @@ const ParameterTable = React.forwardRef(
715
739
  return;
716
740
  }
717
741
  if (key === "Tab") {
718
- event.preventDefault();
719
742
  const dc = event.shiftKey ? -1 : 1;
720
743
  let nextCol = focus.colIdx + dc;
721
744
  let nextRow = focus.rowIdx;
722
745
  if (nextCol >= totalCols) {
723
746
  nextCol = 0;
724
- nextRow = Math.min(maxRowIdx, nextRow + 1);
747
+ nextRow += 1;
725
748
  } else if (nextCol < 0) {
726
749
  nextCol = totalCols - 1;
727
- nextRow = Math.max(0, nextRow - 1);
750
+ nextRow -= 1;
728
751
  }
752
+ if (nextRow < 0 || nextRow > maxRowIdx) {
753
+ setSelection(null);
754
+ return;
755
+ }
756
+ event.preventDefault();
729
757
  const next = { rowIdx: nextRow, colIdx: nextCol };
730
758
  setSelection({ anchor: next, focus: next });
731
759
  return;
@@ -756,6 +784,7 @@ const ParameterTable = React.forwardRef(
756
784
  redoLastRowOperation,
757
785
  rows,
758
786
  selection,
787
+ selectEntryCell,
759
788
  totalCols,
760
789
  undoLastRowOperation
761
790
  ]
@@ -764,6 +793,22 @@ const ParameterTable = React.forwardRef(
764
793
  useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
765
794
  useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
766
795
  );
796
+ const dndAccessibility = React.useMemo(() => {
797
+ const rowNo = (id) => realRows.findIndex((r) => r.id === id) + 1;
798
+ const announcements = {
799
+ onDragStart: ({ active }) => `${rowNo(active.id)}행을 들었습니다.`,
800
+ // 들자마자 제자리 위에 있다는 알림은 건너뛴다(undefined) — "들었습니다" 를 덮어쓰지 않게
801
+ onDragOver: ({ active, over }) => !over ? `${rowNo(active.id)}행이 놓을 자리를 벗어났습니다.` : over.id === active.id ? void 0 : `${rowNo(active.id)}행을 ${rowNo(over.id)}행 자리로 옮기는 중입니다.`,
802
+ onDragEnd: ({ active, over }) => !over ? `${rowNo(active.id)}행을 놓았습니다.` : over.id === active.id ? `${rowNo(active.id)}행을 제자리에 놓았습니다.` : `${rowNo(active.id)}행을 ${rowNo(over.id)}행 자리에 놓았습니다.`,
803
+ onDragCancel: ({ active }) => `옮기기를 취소했습니다. ${rowNo(active.id)}행은 제자리에 있습니다.`
804
+ };
805
+ return {
806
+ announcements,
807
+ screenReaderInstructions: {
808
+ draggable: "행 순서를 바꾸려면 스페이스바를 누르세요. 위아래 화살표로 옮기고, 스페이스바로 놓거나 Esc 로 취소합니다."
809
+ }
810
+ };
811
+ }, [realRows]);
767
812
  const handleDragEnd = React.useCallback(
768
813
  (event) => {
769
814
  const { active, over } = event;
@@ -799,6 +844,7 @@ const ParameterTable = React.forwardRef(
799
844
  const focusRow = focusCoord ? rows[focusCoord.rowIdx] : void 0;
800
845
  const focusCol = focusCoord ? columns[focusCoord.colIdx] : void 0;
801
846
  const activeHint = focusCoord && focusRow && focusCol ? cellHint?.(focusRow, focusCoord.rowIdx, focusCol, focusCoord.colIdx) : void 0;
847
+ const editorName = focusCoord && focusCol ? `${focusCoord.rowIdx === rows.length - 1 ? "새 행" : `${focusCoord.rowIdx + 1}행`} ${focusCol.header}` : "파라미터 표 칸 편집";
802
848
  const activeReadonly = focusCoord ? isReadonlyCell(focusCoord) : false;
803
849
  const activeInvalid = Boolean(
804
850
  focusCoord && focusRow && focusCol && focusCoord.rowIdx !== rows.length - 1 && cellErrors?.[focusRow.id]?.[focusCol.id]
@@ -817,94 +863,106 @@ const ParameterTable = React.forwardRef(
817
863
  "aria-disabled": disabled || void 0,
818
864
  children: [
819
865
  caption && /* @__PURE__ */ jsx("div", { className: "mb-[8px] text-base-medium text-sys-text-main", children: caption }),
820
- /* @__PURE__ */ jsxs(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: [
821
- /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Table, { className: "table-fixed !border-separate !border-spacing-0", children: [
822
- /* @__PURE__ */ jsx(TableHeader, { spacing, children: /* @__PURE__ */ jsxs(TableRow, { children: [
823
- withHandle && /* @__PURE__ */ jsx(TableHead, { align: "center", style: { width: `${colWidths.handle}px` }, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "순서 변경" }) }),
824
- columns.map((col) => /* @__PURE__ */ jsxs(
825
- TableHead,
826
- {
827
- align: "left",
828
- style: col.width ? { width: typeof col.width === "number" ? `${col.width}px` : col.width } : void 0,
829
- children: [
830
- col.header,
831
- col.required && /* @__PURE__ */ jsx("span", { className: "ml-[2px] text-small-medium text-danger30", children: "*" })
832
- ]
833
- },
834
- col.id
835
- )),
836
- extraColumns?.map((col) => /* @__PURE__ */ jsx(
837
- TableHead,
866
+ /* @__PURE__ */ jsxs(
867
+ DndContext,
868
+ {
869
+ sensors,
870
+ collisionDetection: closestCenter,
871
+ onDragEnd: handleDragEnd,
872
+ accessibility: dndAccessibility,
873
+ children: [
874
+ /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Table, { className: "table-fixed !border-separate !border-spacing-0", children: [
875
+ /* @__PURE__ */ jsx(TableHeader, { spacing, children: /* @__PURE__ */ jsxs(TableRow, { children: [
876
+ withHandle && /* @__PURE__ */ jsx(TableHead, { align: "center", style: { width: `${colWidths.handle}px` }, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "순서 변경" }) }),
877
+ columns.map((col) => /* @__PURE__ */ jsxs(
878
+ TableHead,
879
+ {
880
+ align: "left",
881
+ style: col.width ? { width: typeof col.width === "number" ? `${col.width}px` : col.width } : void 0,
882
+ children: [
883
+ col.header,
884
+ col.required && /* @__PURE__ */ jsx("span", { className: "ml-[2px] text-small-medium text-danger30", children: "*" })
885
+ ]
886
+ },
887
+ col.id
888
+ )),
889
+ extraColumns?.map((col) => /* @__PURE__ */ jsx(
890
+ TableHead,
891
+ {
892
+ align: "left",
893
+ style: col.width ? { width: typeof col.width === "number" ? `${col.width}px` : col.width } : void 0,
894
+ children: col.header
895
+ },
896
+ col.id
897
+ )),
898
+ /* @__PURE__ */ jsx(TableHead, { align: "center", style: { width: `${colWidths.delete}px` }, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "삭제" }) })
899
+ ] }) }),
900
+ /* @__PURE__ */ jsx(TableBody, { spacing, children: /* @__PURE__ */ jsx(SortableContext, { items: realRowIds, strategy: verticalListSortingStrategy, children: (disabled || !withAddRow ? realRows : rows).map((row, rowIdx) => {
901
+ const isPlaceholder = rowIdx === rows.length - 1;
902
+ return /* @__PURE__ */ jsx(
903
+ ParameterTableRow,
904
+ {
905
+ row,
906
+ rowIdx,
907
+ columns,
908
+ spacing,
909
+ withHandle,
910
+ disabled,
911
+ isPlaceholder,
912
+ isDeleteDisabled: !isRowDeletable(row, rowIdx),
913
+ isReadonlyCell,
914
+ extraColumns,
915
+ cellHint,
916
+ activeCell: keyboardMode ? focusCoord : null,
917
+ selectionRect,
918
+ editingCell: editing,
919
+ cellErrors,
920
+ onCellMouseDown: handleCellMouseDown,
921
+ onCellMouseEnter: handleCellMouseEnter,
922
+ onCellClick: handleCellClick,
923
+ onCellDoubleClick: handleCellDoubleClick,
924
+ onDelete: () => handleDelete(row.id)
925
+ },
926
+ row.id
927
+ );
928
+ }) }) })
929
+ ] }) }),
930
+ /* @__PURE__ */ jsx(
931
+ "input",
838
932
  {
839
- align: "left",
840
- style: col.width ? { width: typeof col.width === "number" ? `${col.width}px` : col.width } : void 0,
841
- children: col.header
842
- },
843
- col.id
844
- )),
845
- /* @__PURE__ */ jsx(TableHead, { align: "center", style: { width: `${colWidths.delete}px` }, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "삭제" }) })
846
- ] }) }),
847
- /* @__PURE__ */ jsx(TableBody, { spacing, children: /* @__PURE__ */ jsx(SortableContext, { items: realRowIds, strategy: verticalListSortingStrategy, children: (disabled || !withAddRow ? realRows : rows).map((row, rowIdx) => {
848
- const isPlaceholder = rowIdx === rows.length - 1;
849
- return /* @__PURE__ */ jsx(
850
- ParameterTableRow,
851
- {
852
- row,
853
- rowIdx,
854
- columns,
855
- spacing,
856
- withHandle,
933
+ ref: floatingInputRef,
934
+ type: "text",
935
+ className: cn(
936
+ "t3q-pt-floating-input text-base-medium",
937
+ editing && "t3q-pt-floating-input--editing"
938
+ ),
939
+ style: floatingInputStyle,
940
+ value: inputValue,
941
+ onChange: (e) => setInputValue(e.target.value),
942
+ onMouseDown: (event) => {
943
+ if (reclickEnteredRef.current && event.detail > 1) event.preventDefault();
944
+ reclickEnteredRef.current = false;
945
+ },
946
+ onFocus: () => {
947
+ if (!selection && !draggingRef.current) selectEntryCell();
948
+ },
949
+ onKeyDown: handleKeyDown,
950
+ onCompositionStart: handleCompositionStart,
951
+ onCompositionEnd: handleCompositionEnd,
952
+ "aria-label": editorName,
953
+ "aria-invalid": activeInvalid || void 0,
954
+ "aria-readonly": activeReadonly || void 0,
955
+ "aria-describedby": activeHint ? hintId : void 0,
956
+ tabIndex: disabled ? -1 : 0,
857
957
  disabled,
858
- isPlaceholder,
859
- isDeleteDisabled: !isRowDeletable(row, rowIdx),
860
- isReadonlyCell,
861
- extraColumns,
862
- cellHint,
863
- activeCell: keyboardMode ? focusCoord : null,
864
- selectionRect,
865
- editingCell: editing,
866
- cellErrors,
867
- onCellMouseDown: handleCellMouseDown,
868
- onCellMouseEnter: handleCellMouseEnter,
869
- onCellClick: handleCellClick,
870
- onCellDoubleClick: handleCellDoubleClick,
871
- onDelete: () => handleDelete(row.id)
872
- },
873
- row.id
874
- );
875
- }) }) })
876
- ] }) }),
877
- /* @__PURE__ */ jsx(
878
- "input",
879
- {
880
- ref: floatingInputRef,
881
- type: "text",
882
- className: cn(
883
- "t3q-pt-floating-input text-base-medium",
884
- editing && "t3q-pt-floating-input--editing"
958
+ autoComplete: "off",
959
+ spellCheck: false
960
+ }
885
961
  ),
886
- style: floatingInputStyle,
887
- value: inputValue,
888
- onChange: (e) => setInputValue(e.target.value),
889
- onMouseDown: (event) => {
890
- if (reclickEnteredRef.current && event.detail > 1) event.preventDefault();
891
- reclickEnteredRef.current = false;
892
- },
893
- onKeyDown: handleKeyDown,
894
- onCompositionStart: handleCompositionStart,
895
- onCompositionEnd: handleCompositionEnd,
896
- "aria-label": editing && columns[editing.colIdx] ? columns[editing.colIdx].header : "Parameter table cell editor",
897
- "aria-invalid": activeInvalid || void 0,
898
- "aria-readonly": activeReadonly || void 0,
899
- "aria-describedby": activeHint ? hintId : void 0,
900
- tabIndex: disabled ? -1 : 0,
901
- disabled,
902
- autoComplete: "off",
903
- spellCheck: false
904
- }
905
- ),
906
- activeHint && /* @__PURE__ */ jsx("span", { id: hintId, className: "sr-only", children: activeHint })
907
- ] })
962
+ activeHint && /* @__PURE__ */ jsx("span", { id: hintId, className: "sr-only", children: activeHint })
963
+ ]
964
+ }
965
+ )
908
966
  ]
909
967
  }
910
968
  );