@boxcustodia/library 2.0.0-alpha.12 → 2.0.0-alpha.14

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 (174) hide show
  1. package/dist/index.cjs.js +1 -138
  2. package/dist/index.d.ts +1087 -720
  3. package/dist/index.es.js +7011 -56097
  4. package/dist/theme.css +1 -1
  5. package/package.json +34 -26
  6. package/src/__doc__/Examples.tsx +1 -1
  7. package/src/__doc__/Intro.mdx +3 -3
  8. package/src/__doc__/Tabs.mdx +112 -0
  9. package/src/__doc__/V2.mdx +1246 -0
  10. package/src/components/accordion/accordion.stories.tsx +143 -0
  11. package/src/components/accordion/accordion.tsx +135 -0
  12. package/src/components/accordion/index.ts +1 -0
  13. package/src/components/alert/alert.stories.tsx +24 -4
  14. package/src/components/alert/alert.tsx +17 -9
  15. package/src/components/alert-dialog/alert-dialog.stories.tsx +24 -0
  16. package/src/components/alert-dialog/alert-dialog.test.tsx +1 -1
  17. package/src/components/alert-dialog/alert-dialog.tsx +58 -10
  18. package/src/components/auto-complete/auto-complete.stories.tsx +616 -200
  19. package/src/components/auto-complete/auto-complete.tsx +420 -68
  20. package/src/components/auto-complete/index.ts +0 -1
  21. package/src/components/avatar/avatar.stories.tsx +162 -21
  22. package/src/components/avatar/avatar.tsx +79 -20
  23. package/src/components/button/button.stories.tsx +219 -294
  24. package/src/components/button/button.test.tsx +10 -17
  25. package/src/components/button/button.tsx +78 -19
  26. package/src/components/button/components/base-button.tsx +30 -53
  27. package/src/components/button/index.ts +0 -1
  28. package/src/components/calendar/calendar.stories.tsx +1 -1
  29. package/src/components/calendar/calendar.tsx +4 -4
  30. package/src/components/card/card.stories.tsx +141 -69
  31. package/src/components/card/card.tsx +155 -54
  32. package/src/components/center/center.stories.tsx +22 -39
  33. package/src/components/checkbox/checkbox.stories.tsx +25 -5
  34. package/src/components/checkbox/checkbox.tsx +76 -15
  35. package/src/components/checkbox-group/checkbox-group.stories.tsx +116 -28
  36. package/src/components/checkbox-group/checkbox-group.tsx +84 -3
  37. package/src/components/combobox/combobox.stories.tsx +33 -23
  38. package/src/components/combobox/combobox.tsx +99 -77
  39. package/src/components/date-picker/date-input.stories.tsx +14 -6
  40. package/src/components/date-picker/date-input.tsx +2 -2
  41. package/src/components/date-picker/date-picker.model.ts +13 -4
  42. package/src/components/date-picker/date-picker.stories.tsx +38 -12
  43. package/src/components/date-picker/date-picker.tsx +28 -14
  44. package/src/components/dialog/dialog.stories.tsx +18 -0
  45. package/src/components/dialog/dialog.test.tsx +1 -1
  46. package/src/components/dialog/dialog.tsx +51 -20
  47. package/src/components/divider/divider.stories.tsx +126 -51
  48. package/src/components/divider/divider.tsx +16 -16
  49. package/src/components/dropzone/dropzone.stories.tsx +71 -90
  50. package/src/components/dropzone/dropzone.tsx +383 -105
  51. package/src/components/dropzone/index.ts +0 -1
  52. package/src/components/empty/empty.stories.tsx +165 -0
  53. package/src/components/empty/empty.tsx +156 -0
  54. package/src/components/empty/index.ts +1 -0
  55. package/src/components/field/field.stories.tsx +227 -4
  56. package/src/components/field/field.tsx +77 -42
  57. package/src/components/form/form.stories.tsx +320 -197
  58. package/src/components/form/form.tsx +3 -23
  59. package/src/components/index.ts +2 -6
  60. package/src/components/input/input.stories.tsx +5 -5
  61. package/src/components/input/input.tsx +4 -4
  62. package/src/components/kbd/kbd.stories.tsx +1 -0
  63. package/src/components/label/label.stories.tsx +16 -0
  64. package/src/components/label/label.tsx +13 -2
  65. package/src/components/loader/loader.stories.tsx +7 -5
  66. package/src/components/loader/loader.tsx +8 -3
  67. package/src/components/menu/menu-primitives.tsx +207 -196
  68. package/src/components/menu/menu.stories.tsx +276 -146
  69. package/src/components/menu/menu.tsx +146 -54
  70. package/src/components/number-input/number-input.stories.tsx +27 -4
  71. package/src/components/number-input/number-input.test.tsx +2 -2
  72. package/src/components/number-input/number-input.tsx +31 -33
  73. package/src/components/otp/index.ts +1 -0
  74. package/src/components/otp/otp.stories.tsx +209 -0
  75. package/src/components/otp/otp.tsx +100 -0
  76. package/src/components/pagination/index.ts +1 -0
  77. package/src/components/pagination/pagination.model.ts +2 -0
  78. package/src/components/pagination/pagination.stories.tsx +154 -59
  79. package/src/components/pagination/pagination.test.tsx +122 -57
  80. package/src/components/pagination/pagination.tsx +575 -77
  81. package/src/components/password/password.stories.tsx +18 -3
  82. package/src/components/password/password.tsx +29 -9
  83. package/src/components/popover/popover.stories.tsx +26 -5
  84. package/src/components/popover/popover.tsx +15 -23
  85. package/src/components/progress/progress.stories.tsx +1 -0
  86. package/src/components/radio-group/index.ts +1 -0
  87. package/src/components/radio-group/radio-group.stories.tsx +251 -0
  88. package/src/components/radio-group/radio-group.tsx +212 -0
  89. package/src/components/scroll-area/scroll-area.stories.tsx +1 -0
  90. package/src/components/select/select.stories.tsx +118 -19
  91. package/src/components/select/select.tsx +67 -62
  92. package/src/components/skeleton/skeleton.stories.tsx +1 -0
  93. package/src/components/stack/stack.stories.tsx +179 -89
  94. package/src/components/stack/stack.tsx +2 -2
  95. package/src/components/stepper/index.ts +1 -1
  96. package/src/components/stepper/stepper.stories.tsx +767 -83
  97. package/src/components/stepper/stepper.test.tsx +18 -18
  98. package/src/components/stepper/stepper.tsx +554 -0
  99. package/src/components/switch/switch.stories.tsx +15 -1
  100. package/src/components/switch/switch.tsx +17 -4
  101. package/src/components/table/index.ts +0 -2
  102. package/src/components/table/table.stories.tsx +131 -18
  103. package/src/components/table/table.test.tsx +1 -1
  104. package/src/components/table/table.tsx +183 -77
  105. package/src/components/tabs/tabs.stories.tsx +373 -155
  106. package/src/components/tabs/tabs.test.tsx +12 -12
  107. package/src/components/tabs/tabs.tsx +72 -149
  108. package/src/components/tag/index.ts +0 -1
  109. package/src/components/tag/tag.stories.tsx +155 -120
  110. package/src/components/tag/tag.tsx +47 -95
  111. package/src/components/textarea/textarea.stories.tsx +8 -22
  112. package/src/components/textarea/textarea.tsx +17 -79
  113. package/src/components/timeline/timeline.stories.tsx +323 -42
  114. package/src/components/timeline/timeline.tsx +359 -132
  115. package/src/components/toast/toast.stories.tsx +1 -0
  116. package/src/components/tooltip/tooltip.tsx +11 -9
  117. package/src/components/tree/index.ts +0 -1
  118. package/src/components/tree/tree.stories.tsx +365 -408
  119. package/src/components/tree/tree.test.tsx +163 -0
  120. package/src/components/tree/tree.tsx +212 -36
  121. package/src/hooks/useAsync/__doc__/useAsync.stories.tsx +5 -5
  122. package/src/hooks/useClipboard/__doc__/useClipboard.stories.tsx +1 -3
  123. package/src/hooks/useDebounceCallback/__doc__/useDebouncedCallback.stories.tsx +6 -6
  124. package/src/hooks/useDocumentTitle/__doc__/useDocumentTitle.stories.tsx +1 -1
  125. package/src/hooks/useEventListener/__test__/useEventListener.test.tsx +1 -1
  126. package/src/hooks/useLocalStorage/__doc__/useLocalStorage.stories.tsx +1 -1
  127. package/src/hooks/usePagination/usePagination.tsx +36 -24
  128. package/src/styles/theme.css +1 -1
  129. package/src/utils/form.tsx +67 -37
  130. package/src/utils/index.ts +1 -1
  131. package/src/__doc__/Migration.mdx +0 -475
  132. package/src/components/auto-complete/auto-complete-primitives.tsx +0 -155
  133. package/src/components/background-image/background-image.stories.tsx +0 -21
  134. package/src/components/background-image/background-image.test.tsx +0 -29
  135. package/src/components/background-image/background-image.tsx +0 -23
  136. package/src/components/background-image/index.ts +0 -1
  137. package/src/components/button/button.variants.ts +0 -44
  138. package/src/components/button/components/loader-overlay.tsx +0 -21
  139. package/src/components/button/components/loading-icon.tsx +0 -47
  140. package/src/components/dropzone/upload-primitives.tsx +0 -310
  141. package/src/components/dropzone/use-dropzone.ts +0 -122
  142. package/src/components/empty-state/empty-state.stories.tsx +0 -56
  143. package/src/components/empty-state/empty-state.tsx +0 -39
  144. package/src/components/empty-state/index.ts +0 -1
  145. package/src/components/heading/heading.stories.tsx +0 -74
  146. package/src/components/heading/heading.tsx +0 -28
  147. package/src/components/heading/heading.variants.ts +0 -27
  148. package/src/components/heading/index.ts +0 -1
  149. package/src/components/kbd/kbd.variants.ts +0 -26
  150. package/src/components/menu/util/render-menu-item.tsx +0 -54
  151. package/src/components/multi-select/hooks/use-multi-select.ts +0 -66
  152. package/src/components/multi-select/index.ts +0 -1
  153. package/src/components/multi-select/multi-select.stories.tsx +0 -294
  154. package/src/components/multi-select/multi-select.tsx +0 -300
  155. package/src/components/multi-select/multi-select.variants.ts +0 -22
  156. package/src/components/pagination/components/pagination-option.tsx +0 -27
  157. package/src/components/show/index.ts +0 -1
  158. package/src/components/show/show.stories.tsx +0 -197
  159. package/src/components/show/show.test.tsx +0 -41
  160. package/src/components/show/show.tsx +0 -16
  161. package/src/components/stepper/Stepper.tsx +0 -190
  162. package/src/components/stepper/context/stepper-context.tsx +0 -11
  163. package/src/components/table/table-primitives.tsx +0 -122
  164. package/src/components/table/table.model.ts +0 -20
  165. package/src/components/table-pagination/index.ts +0 -2
  166. package/src/components/table-pagination/table-pagination.model.ts +0 -2
  167. package/src/components/table-pagination/table-pagination.stories.tsx +0 -23
  168. package/src/components/table-pagination/table-pagination.test.tsx +0 -32
  169. package/src/components/table-pagination/table-pagination.tsx +0 -108
  170. package/src/components/tabs/context/tabs-context.tsx +0 -14
  171. package/src/components/tag/tag.variants.ts +0 -31
  172. package/src/components/timeline/timeline-status.ts +0 -5
  173. package/src/components/tree/hooks/use-controllable-tree-state.ts +0 -80
  174. package/src/components/tree/tree-primitives.tsx +0 -126
@@ -1,7 +1,7 @@
1
+ export * from "./accordion";
1
2
  export * from "./alert-dialog";
2
3
  export * from "./auto-complete";
3
4
  export * from "./avatar";
4
- export * from "./background-image";
5
5
  export * from "./button";
6
6
  export * from "./calendar";
7
7
  export * from "./card";
@@ -13,16 +13,14 @@ export * from "./date-picker";
13
13
  export * from "./dialog";
14
14
  export * from "./divider";
15
15
  export * from "./dropzone";
16
- export * from "./empty-state";
16
+ export * from "./empty";
17
17
  export * from "./field";
18
18
  export * from "./form";
19
- export * from "./heading";
20
19
  export * from "./input";
21
20
  export * from "./kbd";
22
21
  export * from "./label";
23
22
  export * from "./loader";
24
23
  export * from "./menu";
25
- export * from "./multi-select";
26
24
  export * from "./number-input";
27
25
  export * from "./pagination";
28
26
  export * from "./password";
@@ -30,13 +28,11 @@ export * from "./popover";
30
28
  export * from "./progress";
31
29
  export * from "./scroll-area";
32
30
  export * from "./select";
33
- export * from "./show";
34
31
  export * from "./skeleton";
35
32
  export * from "./stack";
36
33
  export * from "./stepper";
37
34
  export * from "./switch";
38
35
  export * from "./table";
39
- export * from "./table-pagination";
40
36
  export * from "./tabs";
41
37
  export * from "./tag";
42
38
  export * from "./textarea";
@@ -15,7 +15,7 @@ const meta: Meta<typeof Input> = {
15
15
  placeholder: "Placeholder...",
16
16
  },
17
17
  argTypes: {
18
- onChange: { control: false },
18
+ onValueChange: { control: false },
19
19
  },
20
20
  };
21
21
 
@@ -58,8 +58,8 @@ export const FileType: Story = {
58
58
  };
59
59
 
60
60
  /**
61
- * `onChange` fires with `(value: string, event)` — the string value is the first argument,
62
- * so no `event.target.value` needed.
61
+ * `onValueChange` fires with `(value: string, event)` — the string value is the
62
+ * first argument, so no `event.target.value` needed.
63
63
  */
64
64
  export const Controlled: Story = {
65
65
  render: () => {
@@ -68,7 +68,7 @@ export const Controlled: Story = {
68
68
  <div className="flex flex-col gap-2">
69
69
  <Input
70
70
  value={value}
71
- onChange={setValue}
71
+ onValueChange={setValue}
72
72
  placeholder="Type something..."
73
73
  aria-label="Controlled input"
74
74
  />
@@ -98,7 +98,7 @@ export const Primitive: Story = {
98
98
  render: () => (
99
99
  <InputPrimitive
100
100
  className="w-full rounded-md border border-input px-3 py-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"
101
- placeholder="Raw Base UI Input"
101
+ placeholder="Raw Input"
102
102
  />
103
103
  ),
104
104
  };
@@ -8,14 +8,14 @@ export const inputBaseClasses =
8
8
  // ── Composite ─────────────────────────────────────────────────────────────────
9
9
 
10
10
  export type InputProps = Omit<BaseInput.Props, "size" | "onChange"> & {
11
- onChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;
11
+ onValueChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;
12
12
  nativeInput?: boolean;
13
13
  };
14
14
 
15
15
  export function Input({
16
16
  className,
17
17
  nativeInput = false,
18
- onChange,
18
+ onValueChange,
19
19
  ...props
20
20
  }: InputProps) {
21
21
  const classes = cn(
@@ -42,9 +42,9 @@ export function Input({
42
42
  className,
43
43
  );
44
44
 
45
- const handleChange = onChange
45
+ const handleChange = onValueChange
46
46
  ? (event: ChangeEvent<HTMLInputElement>) =>
47
- onChange(event.target.value, event)
47
+ onValueChange(event.target.value, event)
48
48
  : undefined;
49
49
 
50
50
  if (nativeInput) {
@@ -11,6 +11,7 @@ const meta: Meta<typeof Kbd> = {
11
11
  args: {
12
12
  children: "K",
13
13
  },
14
+ parameters: { layout: "centered" },
14
15
  };
15
16
 
16
17
  export default meta;
@@ -48,6 +48,22 @@ export const WithTooltip: Story = {
48
48
  },
49
49
  };
50
50
 
51
+ /**
52
+ * `className` estila el root `<label>`. `classNames` expone los slots
53
+ * `asterisk` (el `*` que aparece con `required`) y `tooltip` (el botón con
54
+ * el ícono de info que aparece con `tooltip`).
55
+ */
56
+ export const WithClassNames: Story = {
57
+ args: {
58
+ required: true,
59
+ tooltip: "Used for billing.",
60
+ classNames: {
61
+ asterisk: "text-primary font-bold",
62
+ tooltip: "text-primary hover:text-primary/80",
63
+ },
64
+ },
65
+ };
66
+
51
67
  /**
52
68
  * The `render` prop replaces the root element while preserving all
53
69
  * merged props and children. Useful for custom wrappers or non-label contexts.
@@ -9,6 +9,13 @@ import { Tooltip } from "../tooltip";
9
9
  interface LabelProps extends useRender.ComponentProps<"label"> {
10
10
  required?: boolean;
11
11
  tooltip?: ReactNode;
12
+ /** Styles applied to each internal slot. */
13
+ classNames?: {
14
+ /** Red asterisk rendered when `required` is true. */
15
+ asterisk?: string;
16
+ /** Info-icon button rendered when `tooltip` is set. */
17
+ tooltip?: string;
18
+ };
12
19
  }
13
20
 
14
21
  export function Label({
@@ -16,6 +23,7 @@ export function Label({
16
23
  render,
17
24
  required,
18
25
  tooltip,
26
+ classNames,
19
27
  children,
20
28
  ...props
21
29
  }: LabelProps): React.ReactElement {
@@ -24,7 +32,7 @@ export function Label({
24
32
  <>
25
33
  {children}
26
34
  {required && (
27
- <span aria-hidden className="text-error">
35
+ <span aria-hidden className={cn("text-error", classNames?.asterisk)}>
28
36
  *
29
37
  </span>
30
38
  )}
@@ -33,7 +41,10 @@ export function Label({
33
41
  <button
34
42
  type="button"
35
43
  aria-label="More information"
36
- className="inline-flex cursor-default items-center text-muted-foreground hover:text-foreground transition-all ml-1"
44
+ className={cn(
45
+ "inline-flex cursor-default items-center text-muted-foreground hover:text-foreground transition-all ml-1",
46
+ classNames?.tooltip,
47
+ )}
37
48
  >
38
49
  <Info className="size-3.5" />
39
50
  </button>
@@ -3,12 +3,14 @@ import { Loader, Stack } from "../../components";
3
3
 
4
4
  /**
5
5
  * Spinner that signals an in-progress operation. Accepts all native SVG props
6
- * via `LucideProps` — use `color`, `strokeWidth`, or `className` for one-off overrides.
7
- * `center` positions the loader fixed at the viewport center.
6
+ * via `LucideProps` — use `color`, `strokeWidth`, or `className` for one-off
7
+ * overrides on the icon. `center` positions the loader fixed at the viewport
8
+ * center. Style the wrapper with `classNames.container`.
8
9
  */
9
10
  const meta: Meta<typeof Loader> = {
10
11
  title: "Components/Loader",
11
12
  component: Loader,
13
+ parameters: { layout: "centered" },
12
14
  };
13
15
 
14
16
  export default meta;
@@ -30,7 +32,7 @@ export const Variants: Story = {
30
32
 
31
33
  export const Sizes: Story = {
32
34
  render: () => (
33
- <Stack>
35
+ <Stack align="end">
34
36
  <Loader size="xs" />
35
37
  <Loader size="sm" />
36
38
  <Loader size="default" />
@@ -41,8 +43,8 @@ export const Sizes: Story = {
41
43
  };
42
44
 
43
45
  /**
44
- * `center` uses `fixed inset-0` — it covers the full viewport.
45
- * Pair it with a backdrop when used inside a modal or overlay.
46
+ * `center` uses `fixed inset-0 grid place-items-center` — it covers the full
47
+ * viewport. Pair it with a backdrop when used inside a modal or overlay.
46
48
  */
47
49
  export const Centered: Story = { args: { center: true } };
48
50
 
@@ -31,13 +31,18 @@ type LoaderVariants = VariantProps<typeof loaderVariants>;
31
31
 
32
32
  type Props = LucideProps &
33
33
  LoaderVariants & {
34
+ /** Renders the loader fixed at the viewport center via `fixed inset-0`. */
34
35
  center?: boolean;
35
- containerClassName?: string;
36
+ /** Styles applied to each internal slot. */
37
+ classNames?: {
38
+ /** Wrapper around the spinner (used for `center` overlay). */
39
+ container?: string;
40
+ };
36
41
  };
37
42
 
38
43
  export const Loader = ({
39
44
  center,
40
- containerClassName,
45
+ classNames,
41
46
  variant,
42
47
  size,
43
48
  ...props
@@ -45,7 +50,7 @@ export const Loader = ({
45
50
  return (
46
51
  <div
47
52
  className={cn(
48
- containerClassName,
53
+ classNames?.container,
49
54
  center && "fixed inset-0 grid place-items-center",
50
55
  )}
51
56
  data-slot="loader"