@deepnoid/ui 0.0.95 → 0.0.97

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 (32) hide show
  1. package/dist/{chunk-JWFWFBQM.mjs → chunk-PNFR2J4Q.mjs} +62 -27
  2. package/dist/{chunk-VG4644BG.mjs → chunk-PO3ADNA5.mjs} +6 -6
  3. package/dist/{chunk-PR277HT5.mjs → chunk-QDDEQY63.mjs} +15 -8
  4. package/dist/components/accordion/accordion.test.mjs +3 -3
  5. package/dist/components/button/button-group.test.mjs +3 -3
  6. package/dist/components/button/button.test.mjs +3 -3
  7. package/dist/components/checkbox/checkbox.test.mjs +3 -3
  8. package/dist/components/input/input.test.mjs +1 -1
  9. package/dist/components/modal/modal.test.mjs +1 -1
  10. package/dist/components/select/select.test.mjs +3 -3
  11. package/dist/components/table/index.js +80 -38
  12. package/dist/components/table/index.mjs +3 -3
  13. package/dist/components/table/table-body.d.mts +7 -4
  14. package/dist/components/table/table-body.d.ts +7 -4
  15. package/dist/components/table/table-body.js +15 -8
  16. package/dist/components/table/table-body.mjs +1 -1
  17. package/dist/components/table/table-head.d.mts +4 -4
  18. package/dist/components/table/table-head.d.ts +4 -4
  19. package/dist/components/table/table-head.js +6 -6
  20. package/dist/components/table/table-head.mjs +1 -1
  21. package/dist/components/table/table.d.mts +51 -7
  22. package/dist/components/table/table.d.ts +51 -7
  23. package/dist/components/table/table.js +80 -38
  24. package/dist/components/table/table.mjs +3 -3
  25. package/dist/components/table/table.test.js +80 -38
  26. package/dist/components/table/table.test.mjs +3 -3
  27. package/dist/components/tabs/tabs.test.mjs +3 -3
  28. package/dist/components/textarea/textarea.test.mjs +1 -1
  29. package/dist/components/tooltip/tooltip.test.mjs +3 -3
  30. package/dist/index.js +80 -38
  31. package/dist/index.mjs +32 -32
  32. package/package.json +1 -1
@@ -13,7 +13,9 @@ interface Props extends Omit<React__default.ComponentPropsWithRef<"table">, "ref
13
13
  onRowAction?: (e: React__default.MouseEvent, params: TableRow) => void;
14
14
  }
15
15
  interface TableRef {
16
+ checkedRows: Set<number>;
16
17
  selectedRows: Set<number>;
18
+ setCheckedRows: (rows: Set<number>) => void;
17
19
  setSelectedRows: (rows: Set<number>) => void;
18
20
  }
19
21
  declare const Table: React__default.ForwardRefExoticComponent<Props & TableVariantProps & React__default.RefAttributes<TableRef>>;
@@ -65,7 +67,13 @@ declare const table: tailwind_variants.TVReturnType<{
65
67
  isSelected: {
66
68
  true: {};
67
69
  };
68
- isSelectedRow: {
70
+ isMultiSelect: {
71
+ true: {};
72
+ };
73
+ isChecked: {
74
+ true: {};
75
+ };
76
+ isCheckedRow: {
69
77
  true: {
70
78
  tr: string;
71
79
  };
@@ -151,7 +159,13 @@ declare const table: tailwind_variants.TVReturnType<{
151
159
  isSelected: {
152
160
  true: {};
153
161
  };
154
- isSelectedRow: {
162
+ isMultiSelect: {
163
+ true: {};
164
+ };
165
+ isChecked: {
166
+ true: {};
167
+ };
168
+ isCheckedRow: {
155
169
  true: {
156
170
  tr: string;
157
171
  };
@@ -224,7 +238,13 @@ declare const table: tailwind_variants.TVReturnType<{
224
238
  isSelected: {
225
239
  true: {};
226
240
  };
227
- isSelectedRow: {
241
+ isMultiSelect: {
242
+ true: {};
243
+ };
244
+ isChecked: {
245
+ true: {};
246
+ };
247
+ isCheckedRow: {
228
248
  true: {
229
249
  tr: string;
230
250
  };
@@ -297,7 +317,13 @@ declare const table: tailwind_variants.TVReturnType<{
297
317
  isSelected: {
298
318
  true: {};
299
319
  };
300
- isSelectedRow: {
320
+ isMultiSelect: {
321
+ true: {};
322
+ };
323
+ isChecked: {
324
+ true: {};
325
+ };
326
+ isCheckedRow: {
301
327
  true: {
302
328
  tr: string;
303
329
  };
@@ -383,7 +409,13 @@ declare const table: tailwind_variants.TVReturnType<{
383
409
  isSelected: {
384
410
  true: {};
385
411
  };
386
- isSelectedRow: {
412
+ isMultiSelect: {
413
+ true: {};
414
+ };
415
+ isChecked: {
416
+ true: {};
417
+ };
418
+ isCheckedRow: {
387
419
  true: {
388
420
  tr: string;
389
421
  };
@@ -469,7 +501,13 @@ declare const table: tailwind_variants.TVReturnType<{
469
501
  isSelected: {
470
502
  true: {};
471
503
  };
472
- isSelectedRow: {
504
+ isMultiSelect: {
505
+ true: {};
506
+ };
507
+ isChecked: {
508
+ true: {};
509
+ };
510
+ isCheckedRow: {
473
511
  true: {
474
512
  tr: string;
475
513
  };
@@ -542,7 +580,13 @@ declare const table: tailwind_variants.TVReturnType<{
542
580
  isSelected: {
543
581
  true: {};
544
582
  };
545
- isSelectedRow: {
583
+ isMultiSelect: {
584
+ true: {};
585
+ };
586
+ isChecked: {
587
+ true: {};
588
+ };
589
+ isCheckedRow: {
546
590
  true: {
547
591
  tr: string;
548
592
  };
@@ -318,10 +318,10 @@ var TableHead = ({
318
318
  size,
319
319
  color,
320
320
  isExpanded,
321
- isSelected,
322
- isAllSelected,
321
+ isChecked,
322
+ isCheckedAll,
323
323
  classNames,
324
- onSelectAll
324
+ onCheckAll
325
325
  }) => {
326
326
  const getTheadProps = (0, import_react2.useCallback)(
327
327
  () => ({
@@ -341,12 +341,12 @@ var TableHead = ({
341
341
  }),
342
342
  [classNames == null ? void 0 : classNames.th, slots]
343
343
  );
344
- const handleClickSelectAll = (e) => {
344
+ const handleClickCheckAll = (e) => {
345
345
  e.preventDefault();
346
- onSelectAll(!isAllSelected);
346
+ onCheckAll(!isCheckedAll);
347
347
  };
348
348
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { ...getTheadProps(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { ...getTrProps(), children: [
349
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "w-[40px]", onClick: handleClickSelectAll, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(checkbox_default, { size, color, checked: isAllSelected, classNames: { wrapper: "bg-background" } }) }),
349
+ isChecked && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "w-[40px]", onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(checkbox_default, { size, color, checked: isCheckedAll, classNames: { wrapper: "bg-background" } }) }),
350
350
  isExpanded && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "w-[40px]" }),
351
351
  columns.map((column, index) => /* @__PURE__ */ (0, import_react3.createElement)("th", { ...getThProps(column), key: column.field + index + "th" }, column.headerName))
352
352
  ] }) });
@@ -3937,13 +3937,16 @@ var TableBody = ({
3937
3937
  columns,
3938
3938
  isExpanded,
3939
3939
  isSelected,
3940
- isSelectedRow,
3940
+ isChecked,
3941
+ isCheckedRow,
3941
3942
  selectedRows,
3943
+ checkedRows,
3942
3944
  emptyContent,
3943
- onSelectRow,
3945
+ onCheckedRow,
3946
+ onSelectedRow,
3944
3947
  onRowAction
3945
3948
  }) => {
3946
- const COL_SPAN_COUNT = columns.length + (isExpanded ? 1 : 0) + (isSelected ? 1 : 0);
3949
+ const COL_SPAN_COUNT = columns.length + (isExpanded ? 1 : 0) + (isChecked ? 1 : 0);
3947
3950
  const [expandedRows, setExpandedRows] = (0, import_react4.useState)(/* @__PURE__ */ new Set());
3948
3951
  (0, import_react4.useEffect)(() => {
3949
3952
  setExpandedRows(/* @__PURE__ */ new Set());
@@ -3956,11 +3959,14 @@ var TableBody = ({
3956
3959
  );
3957
3960
  const getTrProps = (0, import_react4.useCallback)(
3958
3961
  (index) => ({
3959
- className: clsx(slots.tr({ class: classNames == null ? void 0 : classNames.tr })),
3962
+ className: clsx(
3963
+ slots.tr({ class: [classNames == null ? void 0 : classNames.tr, (isSelected || isCheckedRow || isExpanded) && "cursor-pointer"] })
3964
+ ),
3960
3965
  "data-odd": index % 2 !== 0,
3961
- "data-expanded": expandedRows.has(index)
3966
+ "data-expanded": expandedRows.has(index),
3967
+ "data-selected": selectedRows == null ? void 0 : selectedRows.has(index)
3962
3968
  }),
3963
- [classNames == null ? void 0 : classNames.tr, expandedRows, slots]
3969
+ [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, selectedRows, slots]
3964
3970
  );
3965
3971
  const getExpandedContentProps = (0, import_react4.useCallback)(
3966
3972
  () => ({
@@ -4011,7 +4017,8 @@ var TableBody = ({
4011
4017
  e.stopPropagation();
4012
4018
  e.preventDefault();
4013
4019
  if (isExpanded) onChangeExpandedRow(index);
4014
- if (isSelected && isSelectedRow) onSelectRow(index);
4020
+ if (isSelected) onSelectedRow(index);
4021
+ if (isChecked && isCheckedRow) onCheckedRow(index);
4015
4022
  const row = rows[index];
4016
4023
  if (row) {
4017
4024
  (_a = row.onRowAction) == null ? void 0 : _a.call(row, e, row);
@@ -4021,7 +4028,7 @@ var TableBody = ({
4021
4028
  const keys = Object.keys(row);
4022
4029
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.default.Fragment, { children: [
4023
4030
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { ...getTrProps(rowIndex), onClick: handleRowClick(rowIndex), children: [
4024
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onSelectRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(checkbox_default, { color, size, checked: selectedRows.has(rowIndex) }) }),
4031
+ isChecked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
4025
4032
  isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4026
4033
  Icon_default,
4027
4034
  {
@@ -4044,7 +4051,14 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
4044
4051
  var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4045
4052
  const [props, variantProps] = mapPropsVariants(originalProps, table.variantKeys);
4046
4053
  const { classNames, rows, columns, isLoading, className, emptyContent, onRowAction, ...tableComponentsProps } = props;
4054
+ const [checkedRows, setCheckedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
4047
4055
  const [selectedRows, setSelectedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
4056
+ (0, import_react6.useEffect)(() => {
4057
+ setCheckedRows(/* @__PURE__ */ new Set());
4058
+ }, [rows]);
4059
+ (0, import_react6.useEffect)(() => {
4060
+ setSelectedRows(/* @__PURE__ */ new Set());
4061
+ }, [rows]);
4048
4062
  const slots = (0, import_react6.useMemo)(() => table({ ...variantProps }), [...Object.values(variantProps)]);
4049
4063
  const getBaseProps = (0, import_react6.useCallback)(
4050
4064
  (props2) => ({
@@ -4060,21 +4074,41 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4060
4074
  }),
4061
4075
  [classNames == null ? void 0 : classNames.table, slots]
4062
4076
  );
4063
- const handleSelectAll = (isSelected) => {
4064
- const newSelectedRows = isSelected ? new Set(rows.map((_, index) => index)) : /* @__PURE__ */ new Set();
4065
- setSelectedRows(newSelectedRows);
4077
+ const handleCheckAll = (isChecked) => {
4078
+ const newCheckedRows = isChecked ? new Set(rows.map((_, index) => index)) : /* @__PURE__ */ new Set();
4079
+ setCheckedRows(newCheckedRows);
4080
+ };
4081
+ const handleCheckRow = (index) => {
4082
+ const newCheckedRows = new Set(checkedRows);
4083
+ if (newCheckedRows.has(index)) {
4084
+ newCheckedRows.delete(index);
4085
+ } else {
4086
+ newCheckedRows.add(index);
4087
+ }
4088
+ setCheckedRows(newCheckedRows);
4066
4089
  };
4067
4090
  const handleSelectRow = (index) => {
4068
4091
  const newSelectedRows = new Set(selectedRows);
4069
- if (newSelectedRows.has(index)) {
4070
- newSelectedRows.delete(index);
4092
+ if (originalProps.isMultiSelect) {
4093
+ if (newSelectedRows.has(index)) {
4094
+ newSelectedRows.delete(index);
4095
+ } else {
4096
+ newSelectedRows.add(index);
4097
+ }
4071
4098
  } else {
4072
- newSelectedRows.add(index);
4099
+ if (newSelectedRows.has(index)) {
4100
+ newSelectedRows.delete(index);
4101
+ } else {
4102
+ newSelectedRows.clear();
4103
+ newSelectedRows.add(index);
4104
+ }
4073
4105
  }
4074
4106
  setSelectedRows(newSelectedRows);
4075
4107
  };
4076
4108
  (0, import_react6.useImperativeHandle)(ref, () => ({
4109
+ checkedRows,
4077
4110
  selectedRows,
4111
+ setCheckedRows,
4078
4112
  setSelectedRows
4079
4113
  }));
4080
4114
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, "data-table": "base", ...getBaseProps(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("table", { ...getTableProps(tableComponentsProps), children: [
@@ -4086,10 +4120,10 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4086
4120
  columns,
4087
4121
  size: originalProps.size,
4088
4122
  color: originalProps.color === "neutral" ? "primary" : originalProps.color,
4089
- isSelected: originalProps.isSelected,
4123
+ isChecked: originalProps.isChecked,
4090
4124
  isExpanded: originalProps.isExpanded,
4091
- onSelectAll: handleSelectAll,
4092
- isAllSelected: selectedRows.size === rows.length
4125
+ onCheckAll: handleCheckAll,
4126
+ isCheckedAll: checkedRows.size === rows.length
4093
4127
  }
4094
4128
  ),
4095
4129
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -4101,13 +4135,16 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4101
4135
  size: originalProps.size,
4102
4136
  color: originalProps.color === "neutral" ? "primary" : originalProps.color,
4103
4137
  isSelected: originalProps.isSelected,
4104
- isSelectedRow: originalProps.isSelectedRow,
4138
+ isChecked: originalProps.isChecked,
4139
+ isCheckedRow: originalProps.isCheckedRow,
4105
4140
  isExpanded: originalProps.isExpanded,
4106
4141
  isLoading,
4107
4142
  classNames,
4108
4143
  emptyContent,
4109
4144
  selectedRows,
4110
- onSelectRow: handleSelectRow,
4145
+ checkedRows,
4146
+ onCheckedRow: handleCheckRow,
4147
+ onSelectedRow: handleSelectRow,
4111
4148
  onRowAction
4112
4149
  }
4113
4150
  )
@@ -4118,13 +4155,13 @@ var table_default = Table;
4118
4155
  var table = (0, import_tailwind_variants3.tv)({
4119
4156
  slots: {
4120
4157
  base: "flex flex-col relative gap-4",
4121
- table: "min-w-full h-auto",
4158
+ table: "w-full h-auto",
4122
4159
  thead: "[&>tr]:first:rounded-lg",
4123
- tbody: "",
4124
- tr: ["group", "outline-none"],
4160
+ tbody: "w-full",
4161
+ tr: ["group", "outline-none", "w-full"],
4125
4162
  th: [
4126
4163
  "text-foreground",
4127
- "text-center",
4164
+ "!text-center",
4128
4165
  "align-middle",
4129
4166
  "whitespace-nowrap",
4130
4167
  "font-normal",
@@ -4143,7 +4180,6 @@ var table = (0, import_tailwind_variants3.tv)({
4143
4180
  "[&>*]:z-1",
4144
4181
  "[&>*]:relative",
4145
4182
  "transition duration-200",
4146
- "data-[selected=true]:before:opacity-100",
4147
4183
  "group-data-[disabled=true]:text-default-300"
4148
4184
  ],
4149
4185
  tfoot: "",
@@ -4209,7 +4245,13 @@ var table = (0, import_tailwind_variants3.tv)({
4209
4245
  isSelected: {
4210
4246
  true: {}
4211
4247
  },
4212
- isSelectedRow: {
4248
+ isMultiSelect: {
4249
+ true: {}
4250
+ },
4251
+ isChecked: {
4252
+ true: {}
4253
+ },
4254
+ isCheckedRow: {
4213
4255
  true: {
4214
4256
  tr: "cursor-pointer"
4215
4257
  }
@@ -4241,7 +4283,7 @@ var table = (0, import_tailwind_variants3.tv)({
4241
4283
  color: "primary",
4242
4284
  variant: "solid",
4243
4285
  size: "md",
4244
- isSelected: false,
4286
+ isChecked: false,
4245
4287
  isExpanded: false,
4246
4288
  isCompact: false,
4247
4289
  hideHeader: false,
@@ -4254,7 +4296,7 @@ var table = (0, import_tailwind_variants3.tv)({
4254
4296
  color: "primary",
4255
4297
  class: {
4256
4298
  thead: "[&>tr]:bg-primary-light",
4257
- tr: "data-[expanded=true]:bg-primary-soft"
4299
+ tr: ["data-[expanded=true]:bg-primary-soft", "data-[selected=true]:bg-primary-soft"]
4258
4300
  }
4259
4301
  },
4260
4302
  {
@@ -4262,7 +4304,7 @@ var table = (0, import_tailwind_variants3.tv)({
4262
4304
  color: "secondary",
4263
4305
  class: {
4264
4306
  thead: "[&>tr]:bg-secondary-light",
4265
- tr: "data-[expanded=true]:bg-secondary-soft"
4307
+ tr: ["data-[expanded=true]:bg-secondary-soft", "data-[selected=true]:bg-secondary-soft"]
4266
4308
  }
4267
4309
  },
4268
4310
  {
@@ -4270,7 +4312,7 @@ var table = (0, import_tailwind_variants3.tv)({
4270
4312
  color: "neutral",
4271
4313
  class: {
4272
4314
  thead: "[&>tr]:bg-trans-light",
4273
- tr: "data-[expanded=true]:bg-neutral-soft"
4315
+ tr: ["data-[expanded=true]:bg-neutral-soft", "data-[selected=true]:bg-neutral-soft"]
4274
4316
  }
4275
4317
  },
4276
4318
  {
@@ -4278,7 +4320,7 @@ var table = (0, import_tailwind_variants3.tv)({
4278
4320
  color: "primary",
4279
4321
  class: {
4280
4322
  thead: "border-primary-light",
4281
- tr: "data-[expanded=true]:bg-primary-soft"
4323
+ tr: ["data-[expanded=true]:bg-primary-soft", "data-[selected=true]:bg-primary-soft"]
4282
4324
  }
4283
4325
  },
4284
4326
  {
@@ -4286,7 +4328,7 @@ var table = (0, import_tailwind_variants3.tv)({
4286
4328
  color: "secondary",
4287
4329
  class: {
4288
4330
  thead: "border-secondary-light",
4289
- tr: "data-[expanded=true]:bg-secondary-soft"
4331
+ tr: ["data-[expanded=true]:bg-secondary-soft", "data-[selected=true]:bg-secondary-soft"]
4290
4332
  }
4291
4333
  },
4292
4334
  {
@@ -4294,7 +4336,7 @@ var table = (0, import_tailwind_variants3.tv)({
4294
4336
  color: "neutral",
4295
4337
  class: {
4296
4338
  thead: "border-trans-light",
4297
- tr: "data-[expanded=true]:bg-neutral-soft"
4339
+ tr: ["data-[expanded=true]:bg-neutral-soft", "data-[selected=true]:bg-neutral-soft"]
4298
4340
  }
4299
4341
  },
4300
4342
  {
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  table_default
4
- } from "../../chunk-JWFWFBQM.mjs";
5
- import "../../chunk-PR277HT5.mjs";
6
- import "../../chunk-VG4644BG.mjs";
4
+ } from "../../chunk-PNFR2J4Q.mjs";
5
+ import "../../chunk-QDDEQY63.mjs";
6
+ import "../../chunk-PO3ADNA5.mjs";
7
7
  import "../../chunk-QZ3LVYJW.mjs";
8
8
  import "../../chunk-ANYPMQH4.mjs";
9
9
  import "../../chunk-27Y6K5NK.mjs";