@godxjp/ui 11.0.2 → 12.0.0

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 (107) hide show
  1. package/README.md +40 -12
  2. package/dist/app/index.d.ts +1 -5
  3. package/dist/app/index.js +4 -4
  4. package/dist/{checkbox-em-oFM5D.d.ts → checkbox-DPFcnsMZ.d.ts} +1 -1
  5. package/dist/{chunk-QVLUCB47.js → chunk-2JCSS6B4.js} +2 -2
  6. package/dist/{chunk-6CSBMMZS.js → chunk-3ELRYXJK.js} +27 -0
  7. package/dist/{chunk-NXVCI6YB.js → chunk-3LPY7YA4.js} +2 -2
  8. package/dist/chunk-BCBK4FLV.js +83 -0
  9. package/dist/{chunk-FAB3LMTK.js → chunk-F7BEIY7S.js} +3 -3
  10. package/dist/chunk-FK2JDABO.js +318 -0
  11. package/dist/{chunk-X2VY4MOW.js → chunk-FK5QEFVY.js} +2 -11
  12. package/dist/{chunk-SARQRCKO.js → chunk-FOANNF6Z.js} +1 -1
  13. package/dist/{chunk-DNGJHWJZ.js → chunk-FTOG7D4T.js} +4 -2
  14. package/dist/{chunk-PUGEOUWZ.js → chunk-I6HD36IU.js} +2 -2
  15. package/dist/{chunk-2HOTP7RL.js → chunk-JSQOCVM6.js} +4 -78
  16. package/dist/{chunk-Z46J47FY.js → chunk-L2MEN2VK.js} +1 -1
  17. package/dist/{chunk-3Q4A4U2P.js → chunk-MMFIL33F.js} +1 -1
  18. package/dist/{chunk-IHRMOJXD.js → chunk-N6ELT7KB.js} +0 -47
  19. package/dist/{chunk-UNVRNJCB.js → chunk-PO5ISUFA.js} +1 -1
  20. package/dist/{chunk-T2QO2S65.js → chunk-PY3CXDO2.js} +3 -3
  21. package/dist/{chunk-EE5DKOHX.js → chunk-SIUIIIQW.js} +1 -1
  22. package/dist/{chunk-HTG5VHU7.js → chunk-TXRYSMOD.js} +2 -6
  23. package/dist/{chunk-IY347EQA.js → chunk-UDEPO3UF.js} +1 -1
  24. package/dist/{chunk-BG5RNXTH.js → chunk-UJUWAQE5.js} +1 -1
  25. package/dist/{chunk-PDXFQS7M.js → chunk-VWDXRNOK.js} +4 -6
  26. package/dist/{chunk-QR7MITE6.js → chunk-WBUUCU7R.js} +52 -20
  27. package/dist/{chunk-54R5TEXH.js → chunk-WJNR3RAG.js} +40 -20
  28. package/dist/{chunk-USNR424B.js → chunk-XT2AI6WJ.js} +4 -11
  29. package/dist/{chunk-JWGLJXQU.js → chunk-XVD5SLDL.js} +1 -1
  30. package/dist/chunk-YD7V2HGZ.js +13 -0
  31. package/dist/{chunk-VSM44AYE.js → chunk-YGD4CCQC.js} +36 -15
  32. package/dist/components/admin/index.d.ts +7 -15
  33. package/dist/components/admin/index.js +28 -26
  34. package/dist/components/data-display/badge.js +3 -3
  35. package/dist/components/data-display/card.d.ts +2 -2
  36. package/dist/components/data-display/carousel.js +3 -3
  37. package/dist/components/data-display/index.js +8 -7
  38. package/dist/components/data-entry/calendar.d.ts +1 -1
  39. package/dist/components/data-entry/calendar.js +1 -1
  40. package/dist/components/data-entry/cascader.d.ts +1 -1
  41. package/dist/components/data-entry/cascader.js +3 -6
  42. package/dist/components/data-entry/checkbox.d.ts +2 -2
  43. package/dist/components/data-entry/color-picker.d.ts +1 -1
  44. package/dist/components/data-entry/color-picker.js +3 -3
  45. package/dist/components/data-entry/command.d.ts +10 -10
  46. package/dist/components/data-entry/date-picker.d.ts +1 -1
  47. package/dist/components/data-entry/date-picker.js +4 -4
  48. package/dist/components/data-entry/date-range-picker.d.ts +1 -1
  49. package/dist/components/data-entry/date-range-picker.js +4 -4
  50. package/dist/components/data-entry/index.d.ts +3 -3
  51. package/dist/components/data-entry/index.js +18 -17
  52. package/dist/components/data-entry/radio.d.ts +1 -1
  53. package/dist/components/data-entry/select.d.ts +1 -1
  54. package/dist/components/data-entry/select.js +4 -4
  55. package/dist/components/data-entry/slider.d.ts +1 -1
  56. package/dist/components/data-entry/switch.d.ts +1 -1
  57. package/dist/components/data-entry/time-input.js +2 -2
  58. package/dist/components/data-entry/time-picker.d.ts +1 -1
  59. package/dist/components/data-entry/time-picker.js +3 -3
  60. package/dist/components/data-entry/transfer.d.ts +2 -2
  61. package/dist/components/data-entry/transfer.js +5 -4
  62. package/dist/components/data-entry/tree-select.d.ts +1 -1
  63. package/dist/components/data-entry/tree-select.js +3 -3
  64. package/dist/components/data-entry/upload.d.ts +2 -2
  65. package/dist/components/data-entry/upload.js +5 -5
  66. package/dist/components/data-grid/index.d.ts +71 -0
  67. package/dist/components/data-grid/index.js +372 -0
  68. package/dist/components/feedback/alert.js +4 -4
  69. package/dist/components/feedback/dialog.js +3 -3
  70. package/dist/components/feedback/index.d.ts +3 -3
  71. package/dist/components/feedback/index.js +6 -6
  72. package/dist/components/layout/index.d.ts +3 -3
  73. package/dist/components/layout/index.js +5 -5
  74. package/dist/components/navigation/index.d.ts +2 -2
  75. package/dist/components/navigation/index.js +9 -9
  76. package/dist/components/navigation/pagination.d.ts +1 -1
  77. package/dist/components/navigation/pagination.js +5 -5
  78. package/dist/components/navigation/steps.d.ts +2 -2
  79. package/dist/components/navigation/steps.js +3 -3
  80. package/dist/components/query/index.d.ts +1 -2
  81. package/dist/components/query/index.js +4 -4
  82. package/dist/components/ui/index.d.ts +3 -3
  83. package/dist/components/ui/index.js +25 -25
  84. package/dist/{data-entry.prop-BR4vNA1j.d.ts → data-entry.prop-6J0o45se.d.ts} +3 -25
  85. package/dist/{filter-bar-BxjSJJnQ.d.ts → filter-bar-B07JSxME.d.ts} +1 -1
  86. package/dist/{flex-D_EXRFSW.d.ts → flex-DXtIALBh.d.ts} +1 -1
  87. package/dist/i18n/index.d.ts +10 -0
  88. package/dist/i18n/index.js +2 -2
  89. package/dist/index.d.ts +7 -7
  90. package/dist/index.js +37 -35
  91. package/dist/{layout.prop-JE2TcRyL.d.ts → layout.prop-B1yQPUNZ.d.ts} +2 -17
  92. package/dist/lib/datetime/index.js +1 -1
  93. package/dist/{navigation.prop-DMcXkR-J.d.ts → navigation.prop-Dumy196X.d.ts} +1 -5
  94. package/dist/props/components/index.d.ts +4 -4
  95. package/dist/props/index.d.ts +4 -4
  96. package/dist/props/index.js +2 -2
  97. package/dist/props/registry.d.ts +0 -47
  98. package/dist/props/registry.js +1 -1
  99. package/dist/{query.prop-BDdz9L1G.d.ts → query.prop-Dog-EAfG.d.ts} +2 -6
  100. package/dist/{search-input-C_x-JFD3.d.ts → search-input-BR4nAWiT.d.ts} +1 -1
  101. package/dist/styles/control.css +3 -8
  102. package/dist/styles/layout.css +7 -3
  103. package/dist/styles/navigation-layout.css +3 -3
  104. package/dist/styles/shell-layout.css +4 -4
  105. package/package.json +15 -3
  106. package/dist/chunk-5NCFLCM7.js +0 -255
  107. /package/dist/{chunk-7CFO5FFE.js → chunk-GJXOBDER.js} +0 -0
@@ -332,16 +332,6 @@ declare const COMPONENT_PROP_REGISTRY: {
332
332
  readonly file: "components/layout.prop.ts";
333
333
  readonly vocabulary: readonly ["TitleProp", "SubtitleProp", "ExtraProp", "FooterProp", "BreadcrumbProp", "DensityProp", "PageContainerVariantProp"];
334
334
  };
335
- readonly StackProp: {
336
- readonly group: "layout";
337
- readonly file: "components/layout.prop.ts";
338
- readonly vocabulary: readonly ["GapProp"];
339
- };
340
- readonly InlineProp: {
341
- readonly group: "layout";
342
- readonly file: "components/layout.prop.ts";
343
- readonly vocabulary: readonly ["GapProp"];
344
- };
345
335
  readonly FlexDirectionProp: {
346
336
  readonly group: "layout";
347
337
  readonly file: "components/layout.prop.ts";
@@ -428,12 +418,6 @@ declare const COMPONENT_PROP_REGISTRY: {
428
418
  readonly file: "components/layout.prop.ts";
429
419
  readonly vocabulary: readonly ["ChildrenProp", "OnOpenChangeProp", "OnValueChangeProp"];
430
420
  };
431
- readonly PageHeaderProp: {
432
- readonly group: "layout";
433
- readonly file: "components/layout.prop.ts";
434
- readonly vocabulary: readonly ["TitleProp", "SubtitleProp", "ExtraProp", "BreadcrumbProp"];
435
- readonly deprecated: true;
436
- };
437
421
  readonly ButtonProp: {
438
422
  readonly group: "general";
439
423
  readonly file: "components/general.prop.ts";
@@ -524,17 +508,6 @@ declare const COMPONENT_PROP_REGISTRY: {
524
508
  readonly file: "components/data-entry.prop.ts";
525
509
  readonly vocabulary: readonly ["ValueProp", "OnValueChangeProp", "DisabledProp", "IdProp"];
526
510
  };
527
- readonly AutocompleteProp: {
528
- readonly group: "data-entry";
529
- readonly file: "components/data-entry.prop.ts";
530
- readonly vocabulary: readonly ["PlaceholderProp", "ValueProp", "OnValueChangeProp", "DisabledProp", "IdProp", "EmptyMessageProp", "ClassNameProp"];
531
- readonly note: "Deprecated — a thin wrapper over SearchSelect (static options).";
532
- };
533
- readonly AutocompleteOptionProp: {
534
- readonly group: "data-entry";
535
- readonly file: "components/data-entry.prop.ts";
536
- readonly vocabulary: readonly ["ValueProp", "LabelProp"];
537
- };
538
511
  readonly SearchSelectProp: {
539
512
  readonly group: "data-entry";
540
513
  readonly file: "components/data-entry.prop.ts";
@@ -672,11 +645,6 @@ declare const COMPONENT_PROP_REGISTRY: {
672
645
  readonly reason: "Inline pending ReactNode slot, not boolean PendingProp state.";
673
646
  }, "ClassNameProp"];
674
647
  };
675
- readonly MutationFeedbackProp: {
676
- readonly group: "query";
677
- readonly file: "components/query.prop.ts";
678
- readonly vocabulary: readonly ["OnValueChangeProp"];
679
- };
680
648
  readonly ButtonRefetchProp: {
681
649
  readonly group: "query";
682
650
  readonly file: "components/query.prop.ts";
@@ -686,11 +654,6 @@ declare const COMPONENT_PROP_REGISTRY: {
686
654
  readonly reason: "TanStack query refetch handle consumed by this helper.";
687
655
  }, "LabelProp"];
688
656
  };
689
- readonly QueryRefetchButtonProp: {
690
- readonly group: "query";
691
- readonly file: "components/query.prop.ts";
692
- readonly vocabulary: readonly ["LabelProp", "ClassNameProp"];
693
- };
694
657
  readonly InfiniteQueryStateProp: {
695
658
  readonly group: "query";
696
659
  readonly file: "components/query.prop.ts";
@@ -736,16 +699,6 @@ declare const COMPONENT_PROP_REGISTRY: {
736
699
  readonly file: "components/feedback.prop.ts";
737
700
  readonly vocabulary: readonly [];
738
701
  };
739
- readonly FilterBarProp: {
740
- readonly group: "navigation";
741
- readonly file: "components/navigation.prop.ts";
742
- readonly vocabulary: readonly ["OnClearFiltersProp", "HasActiveFiltersProp", "ChildrenProp"];
743
- };
744
- readonly FilterGroupProp: {
745
- readonly group: "navigation";
746
- readonly file: "components/navigation.prop.ts";
747
- readonly vocabulary: readonly ["LabelProp", "ChildrenProp"];
748
- };
749
702
  readonly ToolbarProp: {
750
703
  readonly group: "navigation";
751
704
  readonly file: "components/navigation.prop.ts";
@@ -1 +1 @@
1
- export { COMPONENT_PROP_REGISTRY, PROP_ALIASES_FORBIDDEN, VOCABULARY_REGISTRY } from '../chunk-IHRMOJXD.js';
1
+ export { COMPONENT_PROP_REGISTRY, PROP_ALIASES_FORBIDDEN, VOCABULARY_REGISTRY } from '../chunk-N6ELT7KB.js';
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { UseQueryResult, UseInfiniteQueryResult, InfiniteData, UseMutationResult, QueryKey } from '@tanstack/react-query';
2
+ import { UseQueryResult, UseInfiniteQueryResult, InfiniteData, QueryKey, UseMutationResult } from '@tanstack/react-query';
3
3
  import { LinkProps } from 'react-router-dom';
4
4
  import { B as ButtonProp } from './general.prop-DoHDCRmL.js';
5
5
  import { H as HandlerProp, a as ClassNameProp } from './shared.prop-BsNSXeqD.js';
@@ -29,16 +29,12 @@ type AlertMutationFeedbackProp = {
29
29
  pending?: React.ReactNode;
30
30
  className?: ClassNameProp;
31
31
  };
32
- /** @see MutationFeedback — deprecated alias for AlertMutationFeedback. */
33
- type MutationFeedbackProp = AlertMutationFeedbackProp;
34
32
  type QueryRefetchLike = Pick<UseQueryResult<unknown>, "isFetching" | "refetch">;
35
33
  /** @see ButtonRefetch — Button recipe wired to `query.refetch()`. */
36
34
  type ButtonRefetchProp = Omit<ButtonProp, "onClick" | "disabled"> & {
37
35
  query: QueryRefetchLike;
38
36
  label?: React.ReactNode;
39
37
  };
40
- /** @see QueryRefetchButton — deprecated alias for ButtonRefetch. */
41
- type QueryRefetchButtonProp = ButtonRefetchProp;
42
38
  type InfiniteQueryLike<TPage> = Pick<UseInfiniteQueryResult<InfiniteData<TPage>, unknown>, "isPending" | "isError" | "isFetching" | "isFetchingNextPage" | "error" | "data" | "hasNextPage" | "fetchNextPage" | "refetch">;
43
39
  type InfiniteQueryHelpers = {
44
40
  fetchNextPage: () => void;
@@ -72,4 +68,4 @@ type PrefetchLinkProp = LinkProps & {
72
68
  staleTime?: number;
73
69
  };
74
70
 
75
- export type { AlertMutationFeedbackProp as A, ButtonRefetchProp as B, DataStateProp as D, InfiniteQueryHelpers as I, MutationFeedbackProp as M, PrefetchLinkProp as P, QueryRefetchButtonProp as Q, InfiniteQueryStateProp as a };
71
+ export type { AlertMutationFeedbackProp as A, ButtonRefetchProp as B, DataStateProp as D, InfiniteQueryHelpers as I, PrefetchLinkProp as P, InfiniteQueryStateProp as a };
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { h as FormFieldProp, F as FieldProp } from './data-entry.prop-BR4vNA1j.js';
2
+ import { g as FormFieldProp, F as FieldProp } from './data-entry.prop-6J0o45se.js';
3
3
  import * as React from 'react';
4
4
 
5
5
  declare function FormField({ id, label, required, helper, error, labelAddon, className, children, }: FormFieldProp): react_jsx_runtime.JSX.Element;
@@ -177,11 +177,6 @@
177
177
  padding: 0;
178
178
  }
179
179
 
180
- .ui-button--compact-icon {
181
- width: var(--control-height-xs);
182
- height: var(--control-height-xs);
183
- padding: 0;
184
- }
185
180
 
186
181
  .ui-control {
187
182
  height: var(--control-height);
@@ -616,8 +611,8 @@
616
611
  .ui-otp-slot {
617
612
  position: relative;
618
613
  display: flex;
619
- width: 2.25rem;
620
- height: 2.25rem;
614
+ width: var(--control-height);
615
+ height: var(--control-height);
621
616
  align-items: center;
622
617
  justify-content: center;
623
618
  font-size: 0.875rem;
@@ -719,7 +714,7 @@
719
714
  flex-wrap: wrap;
720
715
  align-items: center;
721
716
  gap: var(--space-1);
722
- min-height: 2.25rem;
717
+ min-height: var(--control-height);
723
718
  padding: var(--space-1) var(--space-2);
724
719
  border: 1px solid hsl(var(--input));
725
720
  border-radius: var(--radius-md);
@@ -483,7 +483,9 @@
483
483
 
484
484
  .ui-pagination-size-trigger {
485
485
  width: var(--pagination-size-width);
486
- height: calc(var(--control-height) - 0.25rem);
486
+ /* Default control height — primitive never picks a sub-default tier; the app
487
+ * overrides via className if it wants smaller. Shared with the page buttons. */
488
+ height: var(--control-height);
487
489
  }
488
490
 
489
491
  .ui-pagination-list {
@@ -500,6 +502,8 @@
500
502
 
501
503
  .ui-pagination-ellipsis {
502
504
  display: flex;
505
+ width: var(--control-height);
506
+ height: var(--control-height);
503
507
  align-items: center;
504
508
  justify-content: center;
505
509
  color: hsl(var(--muted-foreground));
@@ -507,8 +511,8 @@
507
511
 
508
512
  .ui-pagination-link {
509
513
  display: inline-flex;
510
- width: 2rem;
511
- height: 2rem;
514
+ width: var(--control-height);
515
+ height: var(--control-height);
512
516
  align-items: center;
513
517
  justify-content: center;
514
518
  border-radius: var(--radius-sm);
@@ -160,14 +160,14 @@
160
160
 
161
161
  .ui-menubar {
162
162
  display: flex;
163
- min-height: 2.25rem;
163
+ min-height: var(--control-height);
164
164
  align-items: center;
165
165
  gap: var(--space-1);
166
166
  border-radius: var(--radius-md);
167
167
  }
168
168
 
169
169
  .ui-menubar-trigger {
170
- height: 2.25rem;
170
+ height: var(--control-height);
171
171
  padding: 0 var(--space-3);
172
172
  border-radius: var(--radius-md);
173
173
  }
@@ -207,7 +207,7 @@
207
207
  border-radius: var(--radius-md);
208
208
  padding-inline: var(--space-2);
209
209
  padding-block: var(--space-2);
210
- height: 2.25rem;
210
+ height: var(--control-height);
211
211
  font-size: var(--font-size-sm);
212
212
  display: inline-flex;
213
213
  align-items: center;
@@ -482,7 +482,7 @@
482
482
  display: inline-flex;
483
483
  max-width: 15rem;
484
484
  min-width: 0;
485
- height: calc(var(--control-height) - 0.25rem);
485
+ height: var(--control-height-sm);
486
486
  align-items: center;
487
487
  gap: var(--space-1);
488
488
  padding-inline: var(--space-2);
@@ -540,7 +540,7 @@
540
540
  .tb-search {
541
541
  display: flex;
542
542
  width: min(20rem, 30vw);
543
- height: calc(var(--control-height) - 0.25rem);
543
+ height: var(--control-height-sm);
544
544
  align-items: center;
545
545
  gap: var(--space-2);
546
546
  padding-inline: var(--space-2);
@@ -576,8 +576,8 @@
576
576
 
577
577
  .tb-icon-btn {
578
578
  display: grid;
579
- width: calc(var(--control-height) - 0.25rem);
580
- height: calc(var(--control-height) - 0.25rem);
579
+ width: var(--control-height-sm);
580
+ height: var(--control-height-sm);
581
581
  flex: 0 0 auto;
582
582
  place-items: center;
583
583
  border: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godxjp/ui",
3
- "version": "11.0.2",
3
+ "version": "12.0.0",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@10.29.1",
6
6
  "sideEffects": false,
@@ -47,6 +47,10 @@
47
47
  "types": "./dist/components/query/index.d.ts",
48
48
  "import": "./dist/components/query/index.js"
49
49
  },
50
+ "./data-grid": {
51
+ "types": "./dist/components/data-grid/index.d.ts",
52
+ "import": "./dist/components/data-grid/index.js"
53
+ },
50
54
  "./ui": {
51
55
  "types": "./dist/components/ui/index.d.ts",
52
56
  "import": "./dist/components/ui/index.js"
@@ -266,12 +270,13 @@
266
270
  "test:watch": "vitest",
267
271
  "test:coverage": "vitest run --coverage",
268
272
  "check:example-imports": "node scripts/check-example-imports.mjs",
269
- "verify": "pnpm typecheck && pnpm lint && pnpm format && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm test",
270
- "verify:release": "pnpm typecheck && pnpm lint && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm test",
273
+ "verify": "pnpm typecheck && pnpm lint && pnpm format && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:control-sizing && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm test",
274
+ "verify:release": "pnpm typecheck && pnpm lint && pnpm build && pnpm preview:build && pnpm check:example-imports && pnpm check:core-isolation && pnpm check:prop-vocabulary && pnpm check:token-tiers && pnpm check:control-sizing && pnpm check:mcp-sync && pnpm check:mcp-orphans && pnpm test",
271
275
  "check:mcp-sync": "node scripts/check-mcp-sync.mjs",
272
276
  "check:mcp-orphans": "node scripts/check-mcp-orphans.mjs",
273
277
  "check:prop-vocabulary": "node scripts/check-prop-vocabulary.mjs",
274
278
  "check:token-tiers": "node scripts/check-token-tiers.mjs",
279
+ "check:control-sizing": "node scripts/check-control-sizing.mjs",
275
280
  "check:core-isolation": "node scripts/check-core-isolation.mjs",
276
281
  "release": "node scripts/release.mjs",
277
282
  "preview": "node preview/scripts/kill-port.mjs && vite --config preview/vite.config.ts --port 6008 --strictPort",
@@ -284,6 +289,7 @@
284
289
  "peerDependencies": {
285
290
  "@hookform/resolvers": "^5.2.0",
286
291
  "@tanstack/react-query": ">=5.0.0",
292
+ "@tanstack/react-table": ">=8.0.0",
287
293
  "react": ">=19.0.0",
288
294
  "react-dom": ">=19.0.0",
289
295
  "react-hook-form": "^7.76.0",
@@ -291,6 +297,11 @@
291
297
  "tailwindcss": ">=4.0.0",
292
298
  "zod": "^4.4.0"
293
299
  },
300
+ "peerDependenciesMeta": {
301
+ "@tanstack/react-table": {
302
+ "optional": true
303
+ }
304
+ },
294
305
  "dependencies": {
295
306
  "@date-fns/tz": "^1.5.0",
296
307
  "@fontsource/m-plus-2": "^5.2.9",
@@ -339,6 +350,7 @@
339
350
  "@hookform/resolvers": "^5.2.2",
340
351
  "@tailwindcss/vite": "^4.2.4",
341
352
  "@tanstack/react-query": "^5.100.9",
353
+ "@tanstack/react-table": "^8.21.3",
342
354
  "@testing-library/jest-dom": "^6.9.1",
343
355
  "@testing-library/react": "^16.3.2",
344
356
  "@testing-library/user-event": "^14.6.1",
@@ -1,255 +0,0 @@
1
- import { normalizeTreeOptions, formatPathLabels, getNodeByPath, filterTreeOptions, pathsEqual, pathKey } from './chunk-SMLKNECP.js';
2
- import { Command, CommandInput } from './chunk-HTEL5DQI.js';
3
- import { Checkbox } from './chunk-BE6GJGKJ.js';
4
- import { Button } from './chunk-M4PZNAMV.js';
5
- import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
6
- import { ScrollArea, ScrollBar } from './chunk-3KPEZ5CF.js';
7
- import { useTranslation } from './chunk-HTG5VHU7.js';
8
- import { cn } from './chunk-U7N2A7A3.js';
9
- import * as React from 'react';
10
- import { X, ChevronsUpDown, Check, ChevronRight } from 'lucide-react';
11
- import { jsxs, jsx } from 'react/jsx-runtime';
12
-
13
- function pathInValues(path, values) {
14
- return values.some((v) => pathsEqual(v, path));
15
- }
16
- function togglePath(values, path) {
17
- if (pathInValues(path, values)) return values.filter((v) => !pathsEqual(v, path));
18
- return [...values, path];
19
- }
20
- function Cascader({
21
- options: optionsProp,
22
- value,
23
- defaultValue,
24
- onValueChange,
25
- multiple,
26
- changeOnSelect,
27
- showSearch,
28
- placeholder,
29
- disabled,
30
- className,
31
- id,
32
- expandTrigger = "click",
33
- fieldNames,
34
- allowClear = true
35
- }) {
36
- const { t } = useTranslation();
37
- const options = React.useMemo(
38
- () => normalizeTreeOptions(optionsProp, fieldNames),
39
- [optionsProp, fieldNames]
40
- );
41
- const [open, setOpen] = React.useState(false);
42
- const [activePath, setActivePath] = React.useState([]);
43
- const [search, setSearch] = React.useState("");
44
- const isControlledSingle = !multiple && value !== void 0;
45
- const isControlledMulti = multiple && value !== void 0;
46
- const [internalSingle, setInternalSingle] = React.useState(
47
- multiple ? [] : defaultValue ?? []
48
- );
49
- const [internalMulti, setInternalMulti] = React.useState(
50
- defaultValue ?? []
51
- );
52
- const singleValue = isControlledSingle ? value : internalSingle;
53
- const multiValue = isControlledMulti ? value : internalMulti;
54
- const resolvedPlaceholder = placeholder ?? t("dataEntry.cascader.placeholder");
55
- const displayLabel = React.useMemo(() => {
56
- if (multiple) {
57
- if (!multiValue.length) return null;
58
- return multiValue.map((path) => formatPathLabels(getNodeByPath(options, path))).join(", ");
59
- }
60
- if (!singleValue.length) return null;
61
- return formatPathLabels(getNodeByPath(options, singleValue));
62
- }, [multiple, multiValue, singleValue, options]);
63
- const commitSingle = (path) => {
64
- if (!isControlledSingle) setInternalSingle(path);
65
- onValueChange?.(path, getNodeByPath(options, path));
66
- setOpen(false);
67
- setActivePath([]);
68
- setSearch("");
69
- };
70
- const commitMulti = (paths) => {
71
- if (!isControlledMulti) setInternalMulti(paths);
72
- onValueChange?.(
73
- paths,
74
- paths.map((p) => getNodeByPath(options, p))
75
- );
76
- };
77
- const columns = React.useMemo(() => {
78
- const cols = [options];
79
- for (const segment of activePath) {
80
- const col = cols.at(-1);
81
- const node = col?.find((n) => n.value === segment);
82
- if (node?.children?.length) cols.push(node.children);
83
- else break;
84
- }
85
- return cols;
86
- }, [options, activePath]);
87
- const handleSelectNode = (node, path) => {
88
- const hasChildren = (node.children?.length ?? 0) > 0 && node.isLeaf !== true;
89
- if (hasChildren && !changeOnSelect) {
90
- setActivePath(path);
91
- return;
92
- }
93
- if (multiple) {
94
- commitMulti(togglePath(multiValue, path));
95
- return;
96
- }
97
- commitSingle(path);
98
- };
99
- const isSearching = showSearch && search.trim().length > 0;
100
- const searchResults = React.useMemo(
101
- () => isSearching ? filterTreeOptions(options, search) : [],
102
- [options, search, isSearching]
103
- );
104
- const handleOpenChange = (next) => {
105
- setOpen(next);
106
- if (!next) {
107
- setSearch("");
108
- setActivePath([]);
109
- }
110
- };
111
- const clearValue = (e) => {
112
- e.stopPropagation();
113
- if (multiple) commitMulti([]);
114
- else commitSingle([]);
115
- };
116
- const renderCascadeColumns = () => /* @__PURE__ */ jsxs(ScrollArea, { className: "w-full", children: [
117
- /* @__PURE__ */ jsx("div", { className: "flex max-h-[min(280px,50vh)]", children: columns.map((col, colIndex) => /* @__PURE__ */ jsx(
118
- "ul",
119
- {
120
- role: "listbox",
121
- "aria-orientation": "vertical",
122
- "aria-multiselectable": multiple ? true : void 0,
123
- className: "min-w-[9rem] border-e last:border-e-0",
124
- onMouseLeave: expandTrigger === "hover" ? () => setActivePath(activePath.slice(0, colIndex)) : void 0,
125
- children: col.map((node) => {
126
- const path = [...activePath.slice(0, colIndex), node.value];
127
- const hasChildren = (node.children?.length ?? 0) > 0 && node.isLeaf !== true;
128
- const active = activePath[colIndex] === node.value;
129
- const selected = multiple ? pathInValues(path, multiValue) : pathsEqual(path, singleValue);
130
- return /* @__PURE__ */ jsx("li", { role: "none", children: /* @__PURE__ */ jsxs(
131
- "button",
132
- {
133
- type: "button",
134
- role: "option",
135
- "aria-selected": selected,
136
- "aria-haspopup": hasChildren ? "menu" : void 0,
137
- "aria-expanded": hasChildren ? active : void 0,
138
- disabled: node.disabled,
139
- className: cn(
140
- "flex w-full items-center gap-1 px-3 py-2 text-sm outline-none",
141
- "hover:bg-accent hover:text-accent-foreground",
142
- active && "bg-accent/70 font-medium",
143
- node.disabled && "pointer-events-none opacity-50"
144
- ),
145
- onMouseEnter: expandTrigger === "hover" && hasChildren ? () => setActivePath(path) : void 0,
146
- onClick: () => !node.disabled && handleSelectNode(node, path),
147
- children: [
148
- multiple && /* @__PURE__ */ jsx(
149
- Checkbox,
150
- {
151
- checked: selected,
152
- disabled: node.disabled,
153
- className: "me-1",
154
- "aria-hidden": true,
155
- tabIndex: -1
156
- }
157
- ),
158
- !multiple && selected && /* @__PURE__ */ jsx(Check, { className: "me-1 size-4 shrink-0", "aria-hidden": "true" }),
159
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-start", children: node.label }),
160
- hasChildren && /* @__PURE__ */ jsx(ChevronRight, { className: "size-4 shrink-0 opacity-50", "aria-hidden": "true" })
161
- ]
162
- }
163
- ) }, node.value);
164
- })
165
- },
166
- colIndex
167
- )) }),
168
- /* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" })
169
- ] });
170
- return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
171
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
172
- Button,
173
- {
174
- id,
175
- type: "button",
176
- variant: "outline",
177
- role: "combobox",
178
- "aria-expanded": open,
179
- disabled,
180
- className: cn(
181
- "w-full justify-between font-normal",
182
- !displayLabel && "text-muted-foreground",
183
- className
184
- ),
185
- children: [
186
- /* @__PURE__ */ jsx("span", { className: "truncate", children: displayLabel ?? resolvedPlaceholder }),
187
- /* @__PURE__ */ jsxs("span", { className: "ms-2 flex shrink-0 items-center gap-1", children: [
188
- allowClear && displayLabel && !disabled && /* @__PURE__ */ jsx(
189
- "button",
190
- {
191
- type: "button",
192
- "aria-label": t("dataEntry.cascader.clear"),
193
- className: "flex size-4 items-center justify-center rounded-sm opacity-50 hover:opacity-100 focus-visible:opacity-100",
194
- onClick: clearValue,
195
- children: /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" })
196
- }
197
- ),
198
- /* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 opacity-50", "aria-hidden": "true" })
199
- ] })
200
- ]
201
- }
202
- ) }),
203
- /* @__PURE__ */ jsxs(
204
- PopoverContent,
205
- {
206
- className: "w-auto min-w-[var(--radix-popover-trigger-width)] p-0",
207
- align: "start",
208
- children: [
209
- showSearch && /* @__PURE__ */ jsx("div", { className: "border-b p-2", children: /* @__PURE__ */ jsx(Command, { shouldFilter: false, children: /* @__PURE__ */ jsx(
210
- CommandInput,
211
- {
212
- placeholder: t("dataEntry.cascader.searchPlaceholder"),
213
- value: search,
214
- onValueChange: setSearch
215
- }
216
- ) }) }),
217
- isSearching ? /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[min(300px,50vh)]", children: /* @__PURE__ */ jsx("div", { className: "p-1", role: "listbox", "aria-multiselectable": multiple ? true : void 0, children: searchResults.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground py-6 text-center text-sm", children: t("dataEntry.cascader.empty") }) : searchResults.map(({ path, labels }) => {
218
- const label = labels.join(" / ");
219
- const selected = multiple ? pathInValues(path, multiValue) : pathsEqual(path, singleValue);
220
- return /* @__PURE__ */ jsxs(
221
- "button",
222
- {
223
- type: "button",
224
- role: "option",
225
- "aria-selected": selected,
226
- className: cn(
227
- "flex w-full items-center rounded-sm px-2 py-1.5 text-sm outline-none",
228
- "hover:bg-accent hover:text-accent-foreground",
229
- selected && "bg-accent/60"
230
- ),
231
- onClick: () => handleSelectNode({ value: path.at(-1)}, path),
232
- children: [
233
- multiple ? /* @__PURE__ */ jsx(Checkbox, { checked: selected, className: "me-2", "aria-hidden": true, tabIndex: -1 }) : /* @__PURE__ */ jsx(
234
- Check,
235
- {
236
- className: cn(
237
- "me-2 size-4 shrink-0",
238
- selected ? "opacity-100" : "opacity-0"
239
- ),
240
- "aria-hidden": "true"
241
- }
242
- ),
243
- /* @__PURE__ */ jsx("span", { className: "truncate text-start", children: label })
244
- ]
245
- },
246
- pathKey(path)
247
- );
248
- }) }) }) : renderCascadeColumns()
249
- ]
250
- }
251
- )
252
- ] });
253
- }
254
-
255
- export { Cascader };
File without changes