@boxcustodia/library 2.0.0-alpha.13 → 2.0.0-alpha.15
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.
- package/dist/index.cjs.js +1 -138
- package/dist/index.d.ts +1083 -717
- package/dist/index.es.js +7059 -56179
- package/dist/theme.css +1 -1
- package/package.json +34 -26
- package/src/__doc__/Changelog.mdx +6 -6
- package/src/__doc__/Examples.tsx +1 -1
- package/src/__doc__/Intro.mdx +3 -3
- package/src/__doc__/Tabs.mdx +112 -0
- package/src/__doc__/V2.mdx +1245 -0
- package/src/components/accordion/accordion.stories.tsx +143 -0
- package/src/components/accordion/accordion.tsx +135 -0
- package/src/components/accordion/index.ts +1 -0
- package/src/components/alert/alert.stories.tsx +24 -4
- package/src/components/alert/alert.tsx +17 -9
- package/src/components/alert-dialog/alert-dialog.stories.tsx +24 -0
- package/src/components/alert-dialog/alert-dialog.test.tsx +1 -1
- package/src/components/alert-dialog/alert-dialog.tsx +58 -10
- package/src/components/auto-complete/auto-complete.stories.tsx +615 -200
- package/src/components/auto-complete/auto-complete.tsx +420 -68
- package/src/components/auto-complete/index.ts +0 -1
- package/src/components/avatar/avatar.stories.tsx +162 -21
- package/src/components/avatar/avatar.tsx +79 -20
- package/src/components/button/button.stories.tsx +236 -294
- package/src/components/button/button.test.tsx +10 -17
- package/src/components/button/button.tsx +53 -18
- package/src/components/button/components/base-button.tsx +25 -53
- package/src/components/button/index.ts +0 -1
- package/src/components/calendar/calendar.stories.tsx +1 -1
- package/src/components/calendar/calendar.tsx +4 -4
- package/src/components/card/card.stories.tsx +140 -69
- package/src/components/card/card.tsx +155 -54
- package/src/components/center/center.stories.tsx +22 -39
- package/src/components/checkbox/checkbox.stories.tsx +25 -5
- package/src/components/checkbox/checkbox.tsx +76 -15
- package/src/components/checkbox-group/checkbox-group.stories.tsx +116 -28
- package/src/components/checkbox-group/checkbox-group.tsx +84 -3
- package/src/components/combobox/combobox.stories.tsx +33 -23
- package/src/components/combobox/combobox.tsx +120 -104
- package/src/components/date-picker/date-input.stories.tsx +14 -6
- package/src/components/date-picker/date-input.tsx +3 -3
- package/src/components/date-picker/date-picker.model.ts +13 -4
- package/src/components/date-picker/date-picker.stories.tsx +38 -12
- package/src/components/date-picker/date-picker.tsx +29 -15
- package/src/components/dialog/dialog.stories.tsx +18 -0
- package/src/components/dialog/dialog.test.tsx +1 -1
- package/src/components/dialog/dialog.tsx +51 -20
- package/src/components/divider/divider.stories.tsx +6 -0
- package/src/components/dropzone/dropzone.stories.tsx +70 -90
- package/src/components/dropzone/dropzone.tsx +383 -105
- package/src/components/dropzone/index.ts +0 -1
- package/src/components/empty/empty.stories.tsx +164 -0
- package/src/components/empty/empty.tsx +156 -0
- package/src/components/empty/index.ts +1 -0
- package/src/components/field/field.stories.tsx +226 -3
- package/src/components/field/field.tsx +77 -42
- package/src/components/form/form.stories.tsx +320 -197
- package/src/components/form/form.tsx +3 -23
- package/src/components/index.ts +2 -6
- package/src/components/input/input.stories.tsx +5 -5
- package/src/components/input/input.tsx +5 -5
- package/src/components/kbd/kbd.stories.tsx +1 -0
- package/src/components/label/label.stories.tsx +16 -0
- package/src/components/label/label.tsx +13 -2
- package/src/components/loader/loader.stories.tsx +7 -5
- package/src/components/loader/loader.tsx +8 -3
- package/src/components/menu/menu-primitives.tsx +207 -196
- package/src/components/menu/menu.stories.tsx +275 -146
- package/src/components/menu/menu.tsx +146 -54
- package/src/components/number-input/number-input.stories.tsx +27 -4
- package/src/components/number-input/number-input.test.tsx +2 -2
- package/src/components/number-input/number-input.tsx +29 -33
- package/src/components/otp/index.ts +1 -0
- package/src/components/otp/otp.stories.tsx +209 -0
- package/src/components/otp/otp.tsx +100 -0
- package/src/components/pagination/index.ts +1 -0
- package/src/components/pagination/pagination.model.ts +2 -0
- package/src/components/pagination/pagination.stories.tsx +153 -59
- package/src/components/pagination/pagination.test.tsx +122 -57
- package/src/components/pagination/pagination.tsx +575 -77
- package/src/components/password/password.stories.tsx +18 -3
- package/src/components/password/password.tsx +26 -10
- package/src/components/popover/popover.stories.tsx +26 -5
- package/src/components/popover/popover.tsx +15 -23
- package/src/components/progress/progress.stories.tsx +1 -0
- package/src/components/radio-group/index.ts +1 -0
- package/src/components/radio-group/radio-group.stories.tsx +251 -0
- package/src/components/radio-group/radio-group.tsx +212 -0
- package/src/components/scroll-area/scroll-area.stories.tsx +1 -0
- package/src/components/select/select.stories.tsx +118 -19
- package/src/components/select/select.tsx +67 -62
- package/src/components/skeleton/skeleton.stories.tsx +1 -0
- package/src/components/stack/stack.stories.tsx +179 -89
- package/src/components/stack/stack.tsx +2 -2
- package/src/components/stepper/index.ts +1 -1
- package/src/components/stepper/stepper.stories.tsx +766 -83
- package/src/components/stepper/stepper.test.tsx +18 -18
- package/src/components/stepper/stepper.tsx +554 -0
- package/src/components/switch/switch.stories.tsx +15 -1
- package/src/components/switch/switch.tsx +17 -4
- package/src/components/table/index.ts +0 -2
- package/src/components/table/table.stories.tsx +131 -18
- package/src/components/table/table.test.tsx +1 -1
- package/src/components/table/table.tsx +183 -77
- package/src/components/tabs/tabs.stories.tsx +372 -155
- package/src/components/tabs/tabs.test.tsx +12 -12
- package/src/components/tabs/tabs.tsx +72 -149
- package/src/components/tag/index.ts +0 -1
- package/src/components/tag/tag.stories.tsx +147 -120
- package/src/components/tag/tag.tsx +47 -95
- package/src/components/textarea/textarea.stories.tsx +8 -22
- package/src/components/textarea/textarea.tsx +17 -79
- package/src/components/timeline/timeline.stories.tsx +322 -42
- package/src/components/timeline/timeline.tsx +359 -132
- package/src/components/toast/toast.stories.tsx +1 -0
- package/src/components/tooltip/tooltip.tsx +11 -9
- package/src/components/tree/index.ts +0 -1
- package/src/components/tree/tree.stories.tsx +364 -408
- package/src/components/tree/tree.test.tsx +163 -0
- package/src/components/tree/tree.tsx +212 -36
- package/src/hooks/useAsync/__doc__/useAsync.stories.tsx +5 -5
- package/src/hooks/useClipboard/__doc__/useClipboard.stories.tsx +1 -3
- package/src/hooks/useDebounceCallback/__doc__/useDebouncedCallback.stories.tsx +6 -6
- package/src/hooks/useDocumentTitle/__doc__/useDocumentTitle.stories.tsx +1 -1
- package/src/hooks/useEventListener/__test__/useEventListener.test.tsx +1 -1
- package/src/hooks/useLocalStorage/__doc__/useLocalStorage.stories.tsx +1 -1
- package/src/hooks/usePagination/usePagination.tsx +36 -24
- package/src/styles/theme.css +1 -1
- package/src/utils/form.tsx +69 -37
- package/src/utils/index.ts +1 -1
- package/src/__doc__/Migration.mdx +0 -451
- package/src/components/auto-complete/auto-complete-primitives.tsx +0 -155
- package/src/components/background-image/background-image.stories.tsx +0 -21
- package/src/components/background-image/background-image.test.tsx +0 -29
- package/src/components/background-image/background-image.tsx +0 -23
- package/src/components/background-image/index.ts +0 -1
- package/src/components/button/button.variants.ts +0 -44
- package/src/components/button/components/loader-overlay.tsx +0 -21
- package/src/components/button/components/loading-icon.tsx +0 -47
- package/src/components/dropzone/upload-primitives.tsx +0 -310
- package/src/components/dropzone/use-dropzone.ts +0 -122
- package/src/components/empty-state/empty-state.stories.tsx +0 -56
- package/src/components/empty-state/empty-state.tsx +0 -39
- package/src/components/empty-state/index.ts +0 -1
- package/src/components/heading/heading.stories.tsx +0 -74
- package/src/components/heading/heading.tsx +0 -28
- package/src/components/heading/heading.variants.ts +0 -27
- package/src/components/heading/index.ts +0 -1
- package/src/components/kbd/kbd.variants.ts +0 -26
- package/src/components/menu/util/render-menu-item.tsx +0 -54
- package/src/components/multi-select/hooks/use-multi-select.ts +0 -66
- package/src/components/multi-select/index.ts +0 -1
- package/src/components/multi-select/multi-select.stories.tsx +0 -294
- package/src/components/multi-select/multi-select.tsx +0 -300
- package/src/components/multi-select/multi-select.variants.ts +0 -22
- package/src/components/pagination/components/pagination-option.tsx +0 -27
- package/src/components/show/index.ts +0 -1
- package/src/components/show/show.stories.tsx +0 -197
- package/src/components/show/show.test.tsx +0 -41
- package/src/components/show/show.tsx +0 -16
- package/src/components/stepper/Stepper.tsx +0 -190
- package/src/components/stepper/context/stepper-context.tsx +0 -11
- package/src/components/table/table-primitives.tsx +0 -122
- package/src/components/table/table.model.ts +0 -20
- package/src/components/table-pagination/index.ts +0 -2
- package/src/components/table-pagination/table-pagination.model.ts +0 -2
- package/src/components/table-pagination/table-pagination.stories.tsx +0 -23
- package/src/components/table-pagination/table-pagination.test.tsx +0 -32
- package/src/components/table-pagination/table-pagination.tsx +0 -108
- package/src/components/tabs/context/tabs-context.tsx +0 -14
- package/src/components/tag/tag.variants.ts +0 -31
- package/src/components/timeline/timeline-status.ts +0 -5
- package/src/components/tree/hooks/use-controllable-tree-state.ts +0 -80
- package/src/components/tree/tree-primitives.tsx +0 -126
package/src/components/index.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
* `
|
|
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
|
-
|
|
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
|
|
101
|
+
placeholder="Raw Input"
|
|
102
102
|
/>
|
|
103
103
|
),
|
|
104
104
|
};
|
|
@@ -3,19 +3,19 @@ import { type ChangeEvent, type ComponentPropsWithoutRef } from "react";
|
|
|
3
3
|
import { cn } from "../../lib";
|
|
4
4
|
|
|
5
5
|
export const inputBaseClasses =
|
|
6
|
-
"h-
|
|
6
|
+
"h-8 w-full px-3 rounded-md border border-input bg-background text-sm outline-none transition-shadow placeholder:text-muted-foreground";
|
|
7
7
|
|
|
8
8
|
// ── Composite ─────────────────────────────────────────────────────────────────
|
|
9
9
|
|
|
10
10
|
export type InputProps = Omit<BaseInput.Props, "size" | "onChange"> & {
|
|
11
|
-
|
|
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
|
-
|
|
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 =
|
|
45
|
+
const handleChange = onValueChange
|
|
46
46
|
? (event: ChangeEvent<HTMLInputElement>) =>
|
|
47
|
-
|
|
47
|
+
onValueChange(event.target.value, event)
|
|
48
48
|
: undefined;
|
|
49
49
|
|
|
50
50
|
if (nativeInput) {
|
|
@@ -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=
|
|
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
|
|
7
|
-
* `center` positions the loader fixed at the viewport
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
53
|
+
classNames?.container,
|
|
49
54
|
center && "fixed inset-0 grid place-items-center",
|
|
50
55
|
)}
|
|
51
56
|
data-slot="loader"
|