@cryptlex/web-components 6.7.9 → 6.7.10
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/components/alert.d.ts +2 -2
- package/dist/components/alert.js +2 -2
- package/dist/components/alert.js.map +1 -1
- package/dist/components/autocomplete.js +2 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.d.ts +1 -1
- package/dist/components/avatar.js +2 -2
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +2 -2
- package/dist/components/badge.js +2 -2
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumbs.d.ts +5 -5
- package/dist/components/breadcrumbs.js +2 -2
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +2 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.d.ts +7 -7
- package/dist/components/calendar.js +2 -2
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.d.ts +6 -6
- package/dist/components/card.js +2 -2
- package/dist/components/card.js.map +1 -1
- package/dist/components/charts.d.ts +8 -8
- package/dist/components/charts.js +2 -2
- package/dist/components/charts.js.map +1 -1
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +2 -2
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code-block.d.ts +1 -1
- package/dist/components/code-block.js +2 -2
- package/dist/components/code-block.js.map +1 -1
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/copy-button.js +2 -2
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/data-table-filter.d.ts +1 -1
- package/dist/components/data-table-filter.js +1 -2
- package/dist/components/data-table.d.ts +11 -86
- package/dist/components/data-table.js +1 -2
- package/dist/components/date-picker.d.ts +3 -3
- package/dist/components/date-picker.js +2 -2
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/datefield.d.ts +4 -4
- package/dist/components/datefield.js +2 -2
- package/dist/components/datefield.js.map +1 -1
- package/dist/components/dialog.d.ts +8 -8
- package/dist/components/dialog.js +2 -2
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/disclosure.d.ts +4 -4
- package/dist/components/disclosure.js +2 -2
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/divider.d.ts +2 -2
- package/dist/components/divider.js +2 -2
- package/dist/components/divider.js.map +1 -1
- package/dist/components/duration-field.d.ts +2 -2
- package/dist/components/duration-field.js +2 -2
- package/dist/components/duration-field.js.map +1 -1
- package/dist/components/file-trigger.d.ts +1 -1
- package/dist/components/file-trigger.js +2 -2
- package/dist/components/file-trigger.js.map +1 -1
- package/dist/components/form.d.ts +11 -11
- package/dist/components/form.js +2 -2
- package/dist/components/form.js.map +1 -1
- package/dist/components/icons.js +1 -2
- package/dist/components/id-search.d.ts +5 -5
- package/dist/components/id-search.js +2 -2
- package/dist/components/id-search.js.map +1 -1
- package/dist/components/kbd.d.ts +1 -1
- package/dist/components/kbd.js +2 -2
- package/dist/components/kbd.js.map +1 -1
- package/dist/components/list-box.d.ts +3 -3
- package/dist/components/list-box.js +2 -2
- package/dist/components/list-box.js.map +1 -1
- package/dist/components/loader.d.ts +1 -1
- package/dist/components/loader.js +2 -2
- package/dist/components/loader.js.map +1 -1
- package/dist/components/menu.d.ts +7 -7
- package/dist/components/menu.js +2 -2
- package/dist/components/menu.js.map +1 -1
- package/dist/components/multi-select.d.ts +2 -2
- package/dist/components/multi-select.js +2 -2
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/numberfield.d.ts +5 -5
- package/dist/components/numberfield.js +2 -2
- package/dist/components/numberfield.js.map +1 -1
- package/dist/components/object-table.d.ts +1 -1
- package/dist/components/object-table.js +2 -2
- package/dist/components/object-table.js.map +1 -1
- package/dist/components/offline-request-file-input.d.ts +2 -2
- package/dist/components/offline-request-file-input.js +2 -2
- package/dist/components/offline-request-file-input.js.map +1 -1
- package/dist/components/otpfield.d.ts +1 -1
- package/dist/components/otpfield.js +2 -2
- package/dist/components/otpfield.js.map +1 -1
- package/dist/components/popover.d.ts +2 -2
- package/dist/components/popover.js +2 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress-bar.d.ts +1 -1
- package/dist/components/progress-bar.js +2 -2
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/searchfield.d.ts +1 -1
- package/dist/components/searchfield.js +2 -2
- package/dist/components/searchfield.js.map +1 -1
- package/dist/components/select-options.js +2 -2
- package/dist/components/select-options.js.map +1 -1
- package/dist/components/select.d.ts +5 -5
- package/dist/components/select.js +2 -2
- package/dist/components/select.js.map +1 -1
- package/dist/components/sidebar.d.ts +20 -20
- package/dist/components/sidebar.js +2 -2
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.d.ts +1 -1
- package/dist/components/skeleton.js +2 -2
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/steps.d.ts +1 -1
- package/dist/components/steps.js +2 -2
- package/dist/components/steps.js.map +1 -1
- package/dist/components/table-of-contents.d.ts +1 -1
- package/dist/components/table-of-contents.js +2 -2
- package/dist/components/table-of-contents.js.map +1 -1
- package/dist/components/table.d.ts +8 -8
- package/dist/components/table.js +2 -2
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +4 -4
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag-group.d.ts +2 -2
- package/dist/components/tag-group.js +2 -2
- package/dist/components/tag-group.js.map +1 -1
- package/dist/components/textfield.d.ts +2 -2
- package/dist/components/textfield.js +2 -2
- package/dist/components/textfield.js.map +1 -1
- package/dist/components/timeline.d.ts +6 -6
- package/dist/components/timeline.js +2 -2
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/toast.d.ts +1 -1
- package/dist/components/toast.js +2 -2
- package/dist/components/toast.js.map +1 -1
- package/dist/components/tooltip.d.ts +2 -2
- package/dist/components/tooltip.js +2 -2
- package/dist/components/tooltip.js.map +1 -1
- package/dist/data-table-filter.js +2 -0
- package/dist/data-table-filter.js.map +1 -0
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -0
- package/dist/stories/atoms/color.stories.d.ts +11 -0
- package/dist/stories/atoms/icons.stories.d.ts +11 -0
- package/dist/stories/atoms/type.stories.d.ts +13 -0
- package/dist/stories/components/alert.stories.d.ts +11 -0
- package/dist/stories/components/avatar.stories.d.ts +6 -0
- package/dist/stories/components/badge.stories.d.ts +6 -0
- package/dist/stories/components/breadcrumbs.stories.d.ts +5 -0
- package/dist/stories/components/button.stories.d.ts +6 -0
- package/dist/stories/components/calendar.stories.d.ts +10 -0
- package/dist/stories/components/card.stories.d.ts +9 -0
- package/dist/stories/components/code-block.stories.d.ts +12 -0
- package/dist/stories/components/copy-button.stories.d.ts +6 -0
- package/dist/stories/components/date-range-picker.stories.d.ts +23 -0
- package/dist/stories/components/datepicker.stories.d.ts +23 -0
- package/dist/stories/components/dialog.stories.d.ts +5 -0
- package/dist/stories/components/divider.stories.d.ts +13 -0
- package/dist/stories/components/file-trigger.stories.d.ts +10 -0
- package/dist/stories/components/kbd.stories.d.ts +49 -0
- package/dist/stories/components/loader.stories.d.ts +12 -0
- package/dist/stories/components/offline-request-file-upload.stories.d.ts +10 -0
- package/dist/stories/components/progress-bar.stories.d.ts +15 -0
- package/dist/stories/components/sheet.stories.d.ts +15 -0
- package/dist/stories/components/skeleton.stories.d.ts +10 -0
- package/dist/stories/components/tabs.stories.d.ts +12 -0
- package/dist/stories/components/tag-group.stories.d.ts +8 -0
- package/dist/stories/components/timeline.stories.d.ts +6 -0
- package/dist/stories/components/timepicker.stories.d.ts +23 -0
- package/dist/stories/components/toast.stories.d.ts +12 -0
- package/dist/stories/components/tooltip.stories.d.ts +9 -0
- package/dist/stories/examples/autocomplete.stories.d.ts +11 -0
- package/dist/stories/examples/charts.stories.d.ts +11 -0
- package/dist/stories/examples/data-table.stories.d.ts +9 -0
- package/dist/stories/examples/key-value-card.stories.d.ts +42 -0
- package/dist/stories/examples/sidebar.stories.d.ts +32 -0
- package/dist/stories/examples/table-of-contents.stories.d.ts +6 -0
- package/dist/stories/inputs/form.stories.d.ts +6 -0
- package/dist/stories/inputs/id-search.stories.d.ts +8 -0
- package/dist/stories/inputs/otp-field.stories.d.ts +6 -0
- package/dist/stories/inputs/textfield.stories.d.ts +8 -0
- package/dist/stories/story-commons.d.ts +3 -0
- package/dist/stories/utilities/resource-formatter.stories.d.ts +7 -0
- package/dist/utilities/auth.js +2 -2
- package/dist/utilities/auth.js.map +1 -1
- package/dist/utilities/countries.d.ts +1 -1
- package/dist/utilities/countries.js +2 -2
- package/dist/utilities/countries.js.map +1 -1
- package/dist/utilities/ctx-client.d.ts +1 -1
- package/dist/utilities/ctx-client.js +2 -2
- package/dist/utilities/ctx-client.js.map +1 -1
- package/dist/utilities/date.js +2 -2
- package/dist/utilities/date.js.map +1 -1
- package/dist/utilities/duration.js +2 -2
- package/dist/utilities/duration.js.map +1 -1
- package/dist/utilities/empty-option.js +2 -2
- package/dist/utilities/empty-option.js.map +1 -1
- package/dist/utilities/errors.js +2 -2
- package/dist/utilities/errors.js.map +1 -1
- package/dist/utilities/form-context.js +2 -2
- package/dist/utilities/form-context.js.map +1 -1
- package/dist/utilities/form-hook.js +2 -2
- package/dist/utilities/form-hook.js.map +1 -1
- package/dist/utilities/form.js +2 -2
- package/dist/utilities/form.js.map +1 -1
- package/dist/utilities/highlight-code.js +2 -2
- package/dist/utilities/highlight-code.js.map +1 -1
- package/dist/utilities/normalize-arrays.js +2 -2
- package/dist/utilities/normalize-arrays.js.map +1 -1
- package/dist/utilities/numbers.js +2 -2
- package/dist/utilities/numbers.js.map +1 -1
- package/dist/utilities/resources.d.ts +1 -1
- package/dist/utilities/resources.js +2 -2
- package/dist/utilities/resources.js.map +1 -1
- package/dist/utilities/shiki.js +2 -2
- package/dist/utilities/shiki.js.map +1 -1
- package/dist/utilities/string.js +2 -2
- package/dist/utilities/string.js.map +1 -1
- package/dist/utilities/theme.js +2 -2
- package/dist/utilities/theme.js.map +1 -1
- package/dist/utilities/use-code-highlight.js +2 -2
- package/dist/utilities/use-code-highlight.js.map +1 -1
- package/dist/utilities/use-mobile.js +2 -2
- package/dist/utilities/use-mobile.js.map +1 -1
- package/dist/utilities/validators.js +2 -2
- package/dist/utilities/validators.js.map +1 -1
- package/package.json +40 -40
- package/dist/components/data-table-filter.js.map +0 -1
- package/dist/components/data-table.js.map +0 -1
- package/dist/components/icons.js.map +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ProgressBar } from '../../lib/components/progress-bar';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof ProgressBar;
|
|
6
|
+
args: {
|
|
7
|
+
label: string;
|
|
8
|
+
value: number;
|
|
9
|
+
minValue: number;
|
|
10
|
+
maxValue: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
export interface SheetProps {
|
|
3
|
+
side: 'left' | 'right' | 'top' | 'bottom';
|
|
4
|
+
}
|
|
5
|
+
declare function SheetDemo({ side }: SheetProps): import("react").JSX.Element;
|
|
6
|
+
declare const meta: {
|
|
7
|
+
title: string;
|
|
8
|
+
component: typeof SheetDemo;
|
|
9
|
+
args: {
|
|
10
|
+
side: "bottom";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare function SkeletonCard(): import("react").JSX.Element;
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof SkeletonCard;
|
|
6
|
+
args: {};
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof meta>;
|
|
10
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare function TabsDemo({ orientation }: {
|
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
}): import("react").JSX.Element;
|
|
5
|
+
declare const meta: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: typeof TabsDemo;
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const Default: Story;
|
|
12
|
+
export declare const Vertical: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { TagGroup } from '../../lib/components/tag-group';
|
|
3
|
+
declare const meta: Meta<typeof TagGroup>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Removable: Story;
|
|
8
|
+
export declare const Single: Story;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { TimeField } from '../../lib/components/datefield';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof TimeField;
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
export declare const Default: Story;
|
|
17
|
+
export declare const Required: Story;
|
|
18
|
+
export declare const MinMaxRange: Story;
|
|
19
|
+
export declare const TwentyFourHour: Story;
|
|
20
|
+
export declare const WithSeconds: Story;
|
|
21
|
+
export declare const Disabled: Story;
|
|
22
|
+
export declare const ReadOnly: Story;
|
|
23
|
+
export declare const QuarterHourIncrements: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ToastProps } from '../../lib/components/toast';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: import('react').FC<ToastProps>;
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<typeof meta>;
|
|
9
|
+
export declare const Success: Story;
|
|
10
|
+
export declare const Dismissible: Story;
|
|
11
|
+
export declare const Destructive: Story;
|
|
12
|
+
export declare const Action: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare function TooltipDemo(): import("react").JSX.Element;
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof TooltipDemo;
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<typeof meta>;
|
|
9
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare function AutocompleteExample(): import("react").JSX.Element;
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof AutocompleteExample;
|
|
6
|
+
};
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<typeof meta>;
|
|
9
|
+
export declare const Default: Story;
|
|
10
|
+
export declare const WithPreset: Story;
|
|
11
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: () => import("react").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const UserProfileDemo: () => import("react").JSX.Element;
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: () => import("react").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
args: {
|
|
9
|
+
label: string;
|
|
10
|
+
data: {
|
|
11
|
+
name: string;
|
|
12
|
+
email: string;
|
|
13
|
+
url: string;
|
|
14
|
+
age: number;
|
|
15
|
+
isActive: boolean;
|
|
16
|
+
roles: {
|
|
17
|
+
name: string;
|
|
18
|
+
}[];
|
|
19
|
+
company: {
|
|
20
|
+
name: string;
|
|
21
|
+
location: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
fields: ({
|
|
25
|
+
display: string;
|
|
26
|
+
accessor: string;
|
|
27
|
+
transform?: undefined;
|
|
28
|
+
type?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
display: string;
|
|
31
|
+
accessor: string;
|
|
32
|
+
transform: (value: string) => import("react").JSX.Element;
|
|
33
|
+
type?: undefined;
|
|
34
|
+
} | {
|
|
35
|
+
display: string;
|
|
36
|
+
accessor: string;
|
|
37
|
+
type: string;
|
|
38
|
+
transform?: undefined;
|
|
39
|
+
})[];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export default meta;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarOutlet, SidebarProvider, SidebarTrigger } from '../../lib/components/sidebar';
|
|
3
|
+
export declare function SidebarWrapper({ className, children, ...props }: React.ComponentProps<typeof SidebarOutlet>): import("react").JSX.Element;
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: typeof SidebarProvider;
|
|
7
|
+
subcomponents: {
|
|
8
|
+
Sidebar: typeof Sidebar;
|
|
9
|
+
SidebarContent: typeof SidebarContent;
|
|
10
|
+
SidebarFooter: typeof SidebarFooter;
|
|
11
|
+
SidebarGroup: typeof SidebarGroup;
|
|
12
|
+
SidebarGroupContent: typeof SidebarGroupContent;
|
|
13
|
+
SidebarGroupLabel: typeof SidebarGroupLabel;
|
|
14
|
+
SidebarMenu: typeof SidebarMenu;
|
|
15
|
+
SidebarMenuItem: typeof SidebarMenuItem;
|
|
16
|
+
SidebarMenuAction: typeof SidebarMenuAction;
|
|
17
|
+
SidebarMenuBadge: typeof SidebarMenuBadge;
|
|
18
|
+
SidebarMenuButton: typeof SidebarMenuButton;
|
|
19
|
+
SidebarMenuSub: typeof SidebarMenuSub;
|
|
20
|
+
SidebarMenuSubItem: typeof SidebarMenuSubItem;
|
|
21
|
+
SidebarMenuSubButton: typeof SidebarMenuSubButton;
|
|
22
|
+
SidebarOutlet: typeof SidebarOutlet;
|
|
23
|
+
SidebarTrigger: typeof SidebarTrigger;
|
|
24
|
+
};
|
|
25
|
+
parameters: {
|
|
26
|
+
layout: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
export declare const Dashboard: Story;
|
|
32
|
+
export declare const Content: Story;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { TableOfContents } from '../../lib/components/table-of-contents';
|
|
3
|
+
declare const meta: Meta<typeof TableOfContents>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof TableOfContents>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { SingleIdSearchInput } from '../../lib/components/id-search';
|
|
3
|
+
declare const meta: Meta<typeof SingleIdSearchInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Clearable: Story;
|
|
7
|
+
export declare const Unclearable: Story;
|
|
8
|
+
export declare const Multiple: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { TextField } from '../../lib/components/textfield';
|
|
3
|
+
declare const meta: Meta<typeof TextField>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const WithHintAndDescription: Story;
|
|
7
|
+
export declare const DisabledWithHint: Story;
|
|
8
|
+
export declare const WithErrorAndHint: Story;
|
package/dist/utilities/auth.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(){try{localStorage.removeItem(
|
|
2
|
-
//# sourceMappingURL=auth.js.map
|
|
1
|
+
function e(){try{localStorage.removeItem(`RT`),localStorage.removeItem(`AT`),window.location.replace(`/auth/login`)}catch(e){console.error(`Logout failed:`,e)}}export{e as logout};
|
|
2
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sources":["../../lib/utilities/auth.ts"],"sourcesContent":["const ACCESS_TOKEN = 'AT';\nconst REFRESH_TOKEN = 'RT';\nexport function logout() {\n try {\n localStorage.removeItem(REFRESH_TOKEN);\n localStorage.removeItem(ACCESS_TOKEN);\n window.location.replace('/auth/login');\n } catch (error) {\n console.error('Logout failed:', error);\n }\n}\n\nexport type JwtDecode = {\n aud: string;\n email: string;\n exp: number;\n iat: number;\n jti: string;\n region: string;\n role: string;\n role_type: string;\n scope: string[];\n sub: string;\n teat: number;\n tenantid: string;\n token_usage: string;\n sadmin?: string;\n};\n"],"
|
|
1
|
+
{"version":3,"file":"auth.js","names":[],"sources":["../../lib/utilities/auth.ts"],"sourcesContent":["const ACCESS_TOKEN = 'AT';\nconst REFRESH_TOKEN = 'RT';\nexport function logout() {\n try {\n localStorage.removeItem(REFRESH_TOKEN);\n localStorage.removeItem(ACCESS_TOKEN);\n window.location.replace('/auth/login');\n } catch (error) {\n console.error('Logout failed:', error);\n }\n}\n\nexport type JwtDecode = {\n aud: string;\n email: string;\n exp: number;\n iat: number;\n jti: string;\n region: string;\n role: string;\n role_type: string;\n scope: string[];\n sub: string;\n teat: number;\n tenantid: string;\n token_usage: string;\n sadmin?: string;\n};\n"],"mappings":"AAEA,SAAgB,GAAS,CACrB,GAAI,CACA,aAAa,WAAW,IAAa,EACrC,aAAa,WAAW,IAAY,EACpC,OAAO,SAAS,QAAQ,aAAa,CACzC,OAAS,EAAO,CACZ,QAAQ,MAAM,iBAAkB,CAAK,CACzC,CACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=countries.js.map
|
|
1
|
+
import{getCountryFlag as e,getCountryName as t}from"../components/select-options.js";import{Fragment as n,jsxs as r}from"react/jsx-runtime";function i({value:i}){return i?r(n,{children:[e(i),` `,t(i)]}):null}export{i as CountryName};
|
|
2
|
+
//# sourceMappingURL=countries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countries.js","sources":["../../lib/utilities/countries.tsx"],"sourcesContent":["import { getCountryFlag, getCountryName } from '../components/select-options';\n\nexport function CountryName({ value }: { value: string }) {\n if (!value) return null;\n return (\n <>\n {getCountryFlag(value)} {getCountryName(value)}\n </>\n );\n}\n"],"
|
|
1
|
+
{"version":3,"file":"countries.js","names":[],"sources":["../../lib/utilities/countries.tsx"],"sourcesContent":["import { getCountryFlag, getCountryName } from '../components/select-options';\n\nexport function CountryName({ value }: { value: string }) {\n if (!value) return null;\n return (\n <>\n {getCountryFlag(value)} {getCountryName(value)}\n </>\n );\n}\n"],"mappings":"4IAEA,SAAgB,EAAY,CAAE,SAA4B,CAEtD,OADK,EAED,EAAA,EAAA,CAAA,SAAA,CACK,EAAe,CAAK,EAAE,IAAE,EAAe,CAAK,CAC/C,CAAA,CAAA,EAJa,IAMvB"}
|
|
@@ -4,5 +4,5 @@ export type CtxClientType = ReturnType<typeof createClient<paths>>;
|
|
|
4
4
|
export declare function CtxClientProvider({ client, children }: {
|
|
5
5
|
client: CtxClientType;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
}): import("react
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
8
|
export declare function useCtxClient(): CtxClientType;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=ctx-client.js.map
|
|
1
|
+
import{createContext as e,use as t}from"react";import{jsx as n}from"react/jsx-runtime";var r=e(null);function i({client:e,children:t}){return n(r.Provider,{value:e,children:t})}function a(){let e=t(r);if(!e)throw Error(`useCtxClient must be used within a CtxClientProvider.`);return e}export{i as CtxClientProvider,a as useCtxClient};
|
|
2
|
+
//# sourceMappingURL=ctx-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctx-client.js","sources":["../../lib/utilities/ctx-client.tsx"],"sourcesContent":["import type { paths } from '@cryptlex/web-api-types/develop';\nimport createClient from 'openapi-fetch';\nimport { createContext, use } from 'react';\n\nexport type CtxClientType = ReturnType<typeof createClient<paths>>;\n\nconst CtxClientContext = createContext<CtxClientType | null>(null);\n\nexport function CtxClientProvider({ client, children }: { client: CtxClientType; children?: React.ReactNode }) {\n return <CtxClientContext.Provider value={client}>{children}</CtxClientContext.Provider>;\n}\n\nexport function useCtxClient(): CtxClientType {\n const client = use(CtxClientContext);\n if (!client) {\n throw new Error('useCtxClient must be used within a CtxClientProvider.');\n }\n return client;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"ctx-client.js","names":[],"sources":["../../lib/utilities/ctx-client.tsx"],"sourcesContent":["import type { paths } from '@cryptlex/web-api-types/develop';\nimport createClient from 'openapi-fetch';\nimport { createContext, use } from 'react';\n\nexport type CtxClientType = ReturnType<typeof createClient<paths>>;\n\nconst CtxClientContext = createContext<CtxClientType | null>(null);\n\nexport function CtxClientProvider({ client, children }: { client: CtxClientType; children?: React.ReactNode }) {\n return <CtxClientContext.Provider value={client}>{children}</CtxClientContext.Provider>;\n}\n\nexport function useCtxClient(): CtxClientType {\n const client = use(CtxClientContext);\n if (!client) {\n throw new Error('useCtxClient must be used within a CtxClientProvider.');\n }\n return client;\n}\n"],"mappings":"uFAMA,IAAM,EAAmB,EAAoC,IAAI,EAEjE,SAAgB,EAAkB,CAAE,SAAQ,YAAmE,CAC3G,OAAO,EAAC,EAAiB,SAAlB,CAA2B,MAAO,EAAS,UAAoC,CAAA,CAC1F,CAEA,SAAgB,GAA8B,CAC1C,IAAM,EAAS,EAAI,CAAgB,EACnC,GAAI,CAAC,EACD,MAAU,MAAM,uDAAuD,EAE3E,OAAO,CACX"}
|
package/dist/utilities/date.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(t
|
|
2
|
-
//# sourceMappingURL=date.js.map
|
|
1
|
+
function e(e,t={month:`short`,day:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}){if(!e)return null;let n=new Date(e);return Intl.DateTimeFormat(navigator.language,t).format(n)}export{e as formatDate};
|
|
2
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sources":["../../lib/utilities/date.ts"],"sourcesContent":["// TODO\n// export function secondsToDuration(seconds: number): string {\n// const duration = intervalToDuration({\n// start: 0,\n// end: seconds * 1000,\n// });\n\n// const parts = [\n// duration.years && `${duration.years}y`,\n// duration.months && `${duration.months}m`,\n// duration.days && `${duration.days}d`,\n// duration.hours && `${duration.hours}h`,\n// ];\n\n// // Filter out undefined values and join\n// return parts.filter(Boolean).join(' ').trim();\n// }\n\nexport function formatDate(\n date?: string | null,\n options: Intl.DateTimeFormatOptions = {\n month: 'short',\n day: '2-digit',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n }\n): string | null {\n if (!date) return null;\n const _date = new Date(date);\n return Intl.DateTimeFormat(navigator.language, options).format(_date);\n}\n\n// TODO\n// export function getValidityDisplay(validity: number | undefined) {\n// if (validity === 0 || !validity) {\n// return 'Lifetime';\n// } else {\n// return secondsToDuration(validity);\n// }\n// }\n"],"
|
|
1
|
+
{"version":3,"file":"date.js","names":[],"sources":["../../lib/utilities/date.ts"],"sourcesContent":["// TODO\n// export function secondsToDuration(seconds: number): string {\n// const duration = intervalToDuration({\n// start: 0,\n// end: seconds * 1000,\n// });\n\n// const parts = [\n// duration.years && `${duration.years}y`,\n// duration.months && `${duration.months}m`,\n// duration.days && `${duration.days}d`,\n// duration.hours && `${duration.hours}h`,\n// ];\n\n// // Filter out undefined values and join\n// return parts.filter(Boolean).join(' ').trim();\n// }\n\nexport function formatDate(\n date?: string | null,\n options: Intl.DateTimeFormatOptions = {\n month: 'short',\n day: '2-digit',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n }\n): string | null {\n if (!date) return null;\n const _date = new Date(date);\n return Intl.DateTimeFormat(navigator.language, options).format(_date);\n}\n\n// TODO\n// export function getValidityDisplay(validity: number | undefined) {\n// if (validity === 0 || !validity) {\n// return 'Lifetime';\n// } else {\n// return secondsToDuration(validity);\n// }\n// }\n"],"mappings":"AAkBA,SAAgB,EACZ,EACA,EAAsC,CAClC,MAAO,QACP,IAAK,UACL,KAAM,UACN,KAAM,UACN,OAAQ,UACR,OAAQ,SACZ,EACa,CACb,GAAI,CAAC,EAAM,OAAO,KAClB,IAAM,EAAQ,IAAI,KAAK,CAAI,EAC3B,OAAO,KAAK,eAAe,UAAU,SAAU,CAAO,CAAC,CAAC,OAAO,CAAK,CACxE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
//# sourceMappingURL=duration.js.map
|
|
1
|
+
var e;(function(e){let t=[{unit:`years`,symbol:`Y`},{unit:`months`,symbol:`M`},{unit:`weeks`,symbol:`W`},{unit:`days`,symbol:`D`},{unit:`hours`,symbol:`H`},{unit:`minutes`,symbol:`M`},{unit:`seconds`,symbol:`S`}],n=/^P(?:(?<years>-?\d+)Y)?(?:(?<months>-?\d+)M)?(?:(?<weeks>-?\d+)W)?(?:(?<days>-?\d+)D)?(?:T(?:(?<hours>-?\d+)H)?(?:(?<minutes>-?\d+)M)?(?:(?<seconds>-?\d+)S)?)?$/;function r(e){if(e!==``&&e!=null)return Number.parseInt(e,10)}function i(e){let i=n.exec(e);if(!i?.groups)throw Error(`Invalid duration`);let a=!0,o={};for(let{unit:e}of t)i.groups[e]&&(a=!1,o[e]=r(i.groups[e]));if(a)throw Error(`Invalid duration`);return o}e.parse=i;let a=(e,t)=>{if(e)return e.toString()+t};function o(e){return!e.years&&!e.months&&!e.weeks&&!e.days&&!e.hours&&!e.minutes&&!e.seconds?``:[`P`,a(e.years,`Y`),a(e.months,`M`),a(e.weeks,`W`),a(e.days,`D`),(e.hours||e.minutes||e.seconds)&&`T`,a(e.hours,`H`),a(e.minutes,`M`),a(e.seconds,`S`)].filter(Boolean).join(``)}e.serialize=o;function s(e){if(!e)return``;let{years:t,months:n,days:r,hours:a,minutes:o,seconds:s}=i(e),c=[];return t&&c.push(`${t} year${t>1?`s`:``}`),n&&c.push(`${n} month${n>1?`s`:``}`),r&&c.push(`${r} day${r>1?`s`:``}`),a&&c.push(`${a} hour${a>1?`s`:``}`),o&&c.push(`${o} minute${o>1?`s`:``}`),s&&c.push(`${s} second${s>1?`s`:``}`),c.join(` `).trim()}e.formatISODuration=s})(e||={});export{e as Duration};
|
|
2
|
+
//# sourceMappingURL=duration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duration.js","sources":["../../lib/utilities/duration.ts"],"sourcesContent":["// Source: https://github.com/MelleB/tinyduration\n// Copyright 2020 MelleB\n// Licensed under the MIT License\n\nexport type Duration = {\n years?: number;\n months?: number;\n weeks?: number;\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n};\n\nexport namespace Duration {\n const units: Array<{ unit: keyof Duration; symbol: string }> = [\n { unit: 'years', symbol: 'Y' },\n { unit: 'months', symbol: 'M' },\n { unit: 'weeks', symbol: 'W' },\n { unit: 'days', symbol: 'D' },\n { unit: 'hours', symbol: 'H' },\n { unit: 'minutes', symbol: 'M' },\n { unit: 'seconds', symbol: 'S' },\n ];\n\n // ISO 8601 duration regex pattern (integers only)\n // Format: P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S\n // Example: P1Y2M3DT4H5M6S = 1 year, 2 months, 3 days, 4 hours, 5 minutes, 6 seconds\n const durationRegex =\n /^P(?:(?<years>-?\\d+)Y)?(?:(?<months>-?\\d+)M)?(?:(?<weeks>-?\\d+)W)?(?:(?<days>-?\\d+)D)?(?:T(?:(?<hours>-?\\d+)H)?(?:(?<minutes>-?\\d+)M)?(?:(?<seconds>-?\\d+)S)?)?$/;\n\n /**\n * Parses a numeric string into an integer.\n *\n * @param s - The string to parse\n * @returns The parsed integer, or undefined if the string is empty/null/undefined\n */\n function parseNum(s: string): number | undefined {\n if (s === '' || s === undefined || s === null) {\n return undefined;\n }\n\n return Number.parseInt(s, 10);\n }\n\n export function parse(durationStr: string): Duration {\n const match = durationRegex.exec(durationStr);\n if (!match?.groups) {\n throw new Error('Invalid duration');\n }\n\n let empty = true;\n\n const values: Duration = {};\n for (const { unit } of units) {\n if (match.groups[unit]) {\n empty = false;\n values[unit] = parseNum(match.groups[unit]);\n }\n }\n if (empty) {\n throw new Error('Invalid duration');\n }\n\n const duration: Duration = values;\n\n return duration;\n }\n\n /**\n * Converts a number to a duration component string.\n *\n * @param number - The integer value\n * @param component - The unit symbol (Y, M, W, D, H, M, S)\n * @returns The formatted component string, or undefined if number is falsy\n */\n const formatComponent = (number: number | undefined, component: string): string | undefined => {\n if (!number) {\n return undefined;\n }\n\n return number.toString() + component;\n };\n\n export function serialize(duration: Duration): string {\n if (\n !duration.years &&\n !duration.months &&\n !duration.weeks &&\n !duration.days &&\n !duration.hours &&\n !duration.minutes &&\n !duration.seconds\n ) {\n return '';\n }\n\n return [\n 'P',\n formatComponent(duration.years, 'Y'),\n formatComponent(duration.months, 'M'),\n formatComponent(duration.weeks, 'W'),\n formatComponent(duration.days, 'D'),\n (duration.hours || duration.minutes || duration.seconds) && 'T',\n formatComponent(duration.hours, 'H'),\n formatComponent(duration.minutes, 'M'),\n formatComponent(duration.seconds, 'S'),\n ]\n .filter(Boolean)\n .join('');\n }\n\n /**\n * Formats an ISO 8601 duration string as a display label (e.g. for tables or UI).\n * Expects years, months, days, hours, minutes, seconds only (no weeks).\n */\n export function formatISODuration(isoDuration: string): string {\n if (!isoDuration) {\n return '';\n }\n const duration = parse(isoDuration);\n const { years, months, days, hours, minutes, seconds } = duration;\n\n const parts: string[] = [];\n if (years) parts.push(`${years} year${years > 1 ? 's' : ''}`);\n if (months) parts.push(`${months} month${months > 1 ? 's' : ''}`);\n if (days) parts.push(`${days} day${days > 1 ? 's' : ''}`);\n if (hours) parts.push(`${hours} hour${hours > 1 ? 's' : ''}`);\n if (minutes) parts.push(`${minutes} minute${minutes > 1 ? 's' : ''}`);\n if (seconds) parts.push(`${seconds} second${seconds > 1 ? 's' : ''}`);\n\n return parts.join(' ').trim();\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"duration.js","names":[],"sources":["../../lib/utilities/duration.ts"],"sourcesContent":["// Source: https://github.com/MelleB/tinyduration\n// Copyright 2020 MelleB\n// Licensed under the MIT License\n\nexport type Duration = {\n years?: number;\n months?: number;\n weeks?: number;\n days?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n};\n\nexport namespace Duration {\n const units: Array<{ unit: keyof Duration; symbol: string }> = [\n { unit: 'years', symbol: 'Y' },\n { unit: 'months', symbol: 'M' },\n { unit: 'weeks', symbol: 'W' },\n { unit: 'days', symbol: 'D' },\n { unit: 'hours', symbol: 'H' },\n { unit: 'minutes', symbol: 'M' },\n { unit: 'seconds', symbol: 'S' },\n ];\n\n // ISO 8601 duration regex pattern (integers only)\n // Format: P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S\n // Example: P1Y2M3DT4H5M6S = 1 year, 2 months, 3 days, 4 hours, 5 minutes, 6 seconds\n const durationRegex =\n /^P(?:(?<years>-?\\d+)Y)?(?:(?<months>-?\\d+)M)?(?:(?<weeks>-?\\d+)W)?(?:(?<days>-?\\d+)D)?(?:T(?:(?<hours>-?\\d+)H)?(?:(?<minutes>-?\\d+)M)?(?:(?<seconds>-?\\d+)S)?)?$/;\n\n /**\n * Parses a numeric string into an integer.\n *\n * @param s - The string to parse\n * @returns The parsed integer, or undefined if the string is empty/null/undefined\n */\n function parseNum(s: string): number | undefined {\n if (s === '' || s === undefined || s === null) {\n return undefined;\n }\n\n return Number.parseInt(s, 10);\n }\n\n export function parse(durationStr: string): Duration {\n const match = durationRegex.exec(durationStr);\n if (!match?.groups) {\n throw new Error('Invalid duration');\n }\n\n let empty = true;\n\n const values: Duration = {};\n for (const { unit } of units) {\n if (match.groups[unit]) {\n empty = false;\n values[unit] = parseNum(match.groups[unit]);\n }\n }\n if (empty) {\n throw new Error('Invalid duration');\n }\n\n const duration: Duration = values;\n\n return duration;\n }\n\n /**\n * Converts a number to a duration component string.\n *\n * @param number - The integer value\n * @param component - The unit symbol (Y, M, W, D, H, M, S)\n * @returns The formatted component string, or undefined if number is falsy\n */\n const formatComponent = (number: number | undefined, component: string): string | undefined => {\n if (!number) {\n return undefined;\n }\n\n return number.toString() + component;\n };\n\n export function serialize(duration: Duration): string {\n if (\n !duration.years &&\n !duration.months &&\n !duration.weeks &&\n !duration.days &&\n !duration.hours &&\n !duration.minutes &&\n !duration.seconds\n ) {\n return '';\n }\n\n return [\n 'P',\n formatComponent(duration.years, 'Y'),\n formatComponent(duration.months, 'M'),\n formatComponent(duration.weeks, 'W'),\n formatComponent(duration.days, 'D'),\n (duration.hours || duration.minutes || duration.seconds) && 'T',\n formatComponent(duration.hours, 'H'),\n formatComponent(duration.minutes, 'M'),\n formatComponent(duration.seconds, 'S'),\n ]\n .filter(Boolean)\n .join('');\n }\n\n /**\n * Formats an ISO 8601 duration string as a display label (e.g. for tables or UI).\n * Expects years, months, days, hours, minutes, seconds only (no weeks).\n */\n export function formatISODuration(isoDuration: string): string {\n if (!isoDuration) {\n return '';\n }\n const duration = parse(isoDuration);\n const { years, months, days, hours, minutes, seconds } = duration;\n\n const parts: string[] = [];\n if (years) parts.push(`${years} year${years > 1 ? 's' : ''}`);\n if (months) parts.push(`${months} month${months > 1 ? 's' : ''}`);\n if (days) parts.push(`${days} day${days > 1 ? 's' : ''}`);\n if (hours) parts.push(`${hours} hour${hours > 1 ? 's' : ''}`);\n if (minutes) parts.push(`${minutes} minute${minutes > 1 ? 's' : ''}`);\n if (seconds) parts.push(`${seconds} second${seconds > 1 ? 's' : ''}`);\n\n return parts.join(' ').trim();\n }\n}\n"],"mappings":"AAcO,IAAU,GAAV,SAAA,EAAA,CACH,IAAM,EAAyD,CAC3D,CAAE,KAAM,QAAS,OAAQ,GAAI,EAC7B,CAAE,KAAM,SAAU,OAAQ,GAAI,EAC9B,CAAE,KAAM,QAAS,OAAQ,GAAI,EAC7B,CAAE,KAAM,OAAQ,OAAQ,GAAI,EAC5B,CAAE,KAAM,QAAS,OAAQ,GAAI,EAC7B,CAAE,KAAM,UAAW,OAAQ,GAAI,EAC/B,CAAE,KAAM,UAAW,OAAQ,GAAI,CACnC,EAKM,EACF,mKAQJ,SAAS,EAAS,EAA+B,CACzC,OAAM,IAAM,GAAyB,KAIzC,OAAO,OAAO,SAAS,EAAG,EAAE,CAChC,CAEO,SAAS,EAAM,EAA+B,CACjD,IAAM,EAAQ,EAAc,KAAK,CAAW,EAC5C,GAAI,CAAC,GAAO,OACR,MAAU,MAAM,kBAAkB,EAGtC,IAAI,EAAQ,GAEN,EAAmB,CAAC,EAC1B,IAAK,GAAM,CAAE,UAAU,EACf,EAAM,OAAO,KACb,EAAQ,GACR,EAAO,GAAQ,EAAS,EAAM,OAAO,EAAK,GAGlD,GAAI,EACA,MAAU,MAAM,kBAAkB,EAKtC,OAAO,CACX,WASA,IAAM,GAAmB,EAA4B,IAA0C,CACtF,KAIL,OAAO,EAAO,SAAS,EAAI,CAC/B,EAEO,SAAS,EAAU,EAA4B,CAalD,MAXI,CAAC,EAAS,OACV,CAAC,EAAS,QACV,CAAC,EAAS,OACV,CAAC,EAAS,MACV,CAAC,EAAS,OACV,CAAC,EAAS,SACV,CAAC,EAAS,QAEH,GAGJ,CACH,IACA,EAAgB,EAAS,MAAO,GAAG,EACnC,EAAgB,EAAS,OAAQ,GAAG,EACpC,EAAgB,EAAS,MAAO,GAAG,EACnC,EAAgB,EAAS,KAAM,GAAG,GACjC,EAAS,OAAS,EAAS,SAAW,EAAS,UAAY,IAC5D,EAAgB,EAAS,MAAO,GAAG,EACnC,EAAgB,EAAS,QAAS,GAAG,EACrC,EAAgB,EAAS,QAAS,GAAG,CACzC,CAAC,CACI,OAAO,OAAO,CAAC,CACf,KAAK,EAAE,CAChB,eAMO,SAAS,EAAkB,EAA6B,CAC3D,GAAI,CAAC,EACD,MAAO,GAGX,GAAM,CAAE,QAAO,SAAQ,OAAM,QAAO,UAAS,WAD5B,EAAM,CACkC,EAEnD,EAAkB,CAAC,EAQzB,OAPI,GAAO,EAAM,KAAK,GAAG,EAAM,OAAO,EAAQ,EAAI,IAAM,IAAI,EACxD,GAAQ,EAAM,KAAK,GAAG,EAAO,QAAQ,EAAS,EAAI,IAAM,IAAI,EAC5D,GAAM,EAAM,KAAK,GAAG,EAAK,MAAM,EAAO,EAAI,IAAM,IAAI,EACpD,GAAO,EAAM,KAAK,GAAG,EAAM,OAAO,EAAQ,EAAI,IAAM,IAAI,EACxD,GAAS,EAAM,KAAK,GAAG,EAAQ,SAAS,EAAU,EAAI,IAAM,IAAI,EAChE,GAAS,EAAM,KAAK,GAAG,EAAQ,SAAS,EAAU,EAAI,IAAM,IAAI,EAE7D,EAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAChC,sBACH,EAAA,CAAA,AAAA,IAAA,CAAA,CAAD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
//# sourceMappingURL=empty-option.js.map
|
|
1
|
+
function e(e){switch(e){case`all`:return`All`;case`none`:return`None`;case`empty`:return`Empty`}}function t(e){return e==null||e===``||Array.isArray(e)&&e.length===0}export{e as getEmptyLabel,t as isEmptyValue};
|
|
2
|
+
//# sourceMappingURL=empty-option.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-option.js","sources":["../../lib/utilities/empty-option.ts"],"sourcesContent":["export type EmptyOption = 'none' | 'all' | 'empty';\n\nexport function getEmptyLabel(option: EmptyOption): string {\n switch (option) {\n case 'all':\n return 'All';\n case 'none':\n return 'None';\n case 'empty':\n return 'Empty';\n }\n}\n\nexport function isEmptyValue(value: unknown): boolean {\n return value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0);\n}\n"],"
|
|
1
|
+
{"version":3,"file":"empty-option.js","names":[],"sources":["../../lib/utilities/empty-option.ts"],"sourcesContent":["export type EmptyOption = 'none' | 'all' | 'empty';\n\nexport function getEmptyLabel(option: EmptyOption): string {\n switch (option) {\n case 'all':\n return 'All';\n case 'none':\n return 'None';\n case 'empty':\n return 'Empty';\n }\n}\n\nexport function isEmptyValue(value: unknown): boolean {\n return value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0);\n}\n"],"mappings":"AAEA,SAAgB,EAAc,EAA6B,CACvD,OAAQ,EAAR,CACI,IAAK,MACD,MAAO,MACX,IAAK,OACD,MAAO,OACX,IAAK,QACD,MAAO,OACf,CACJ,CAEA,SAAgB,EAAa,EAAyB,CAClD,OAAO,GAAU,MAA+B,IAAU,IAAO,MAAM,QAAQ,CAAK,GAAK,EAAM,SAAW,CAC9G"}
|
package/dist/utilities/errors.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=errors.js.map
|
|
1
|
+
var e=`This field is required`,t=`Please enter text`,n=`Please enter a valid number`,r=`Please select an option`,i=`Please enter a valid date`,a=`Please select at least one option`,o=`Please enter a later date`,s=`Please enter an earlier date`,c=`Please enter a valid email address`,l=`Please enter a valid URL`,u=`Please select a valid option`,d=`Please enter a valid format`,f=`Please enter a valid date/time`,p=`Please enter a valid IP address`,m=`Please enter valid encoded data`,h=`Please enter a valid token`,g=`Please enter a valid value`,_=`Please select a valid option`,v=`Invalid key provided`,y=`Invalid element provided`,b=`Invalid value`,x=e=>`'${e}' already exists. Enter a unique value.`,S=`Password must be at least 8 characters`,C=`Only letters, numbers, dashes, and underscores allowed`,w=e=>`The number must be at least ${e}.`,T=e=>`The number must be at most ${e}.`,E=e=>`The number must be at least ${e} days.`,D=e=>`The number must be at most ${e} days.`,O=`At least one value (years, months, days, hours, minutes, or seconds) must be non-zero`,k=e=>`Subscription interval cannot exceed ${e} years`,A=e=>`Expected ${e}`,j=e=>`Please enter at least ${e} character${e===1?``:`s`}`,M=e=>`Please enter no more than ${e} character${e===1?``:`s`}`,N=(e,t)=>`Please enter a value ${t?`at least`:`greater than`} ${e}`,P=(e,t)=>`Please enter a value ${t?`at most`:`less than`} ${e}`,F=e=>`Please select at least ${e} item${e===1?``:`s`}`,I=e=>`Please select no more than ${e} item${e===1?``:`s`}`,L=e=>`File must be at least ${e} bytes`,R=e=>`File must be no larger than ${e} bytes`,z=(e,t)=>`Minimum ${e} is ${t}`,B=(e,t)=>`Maximum ${e} is ${t}`,V=e=>`Please enter a multiple of ${e}`,H=e=>`Please select one of: ${e}`,U=(e,t)=>`Unexpected field${t>1?`s`:``}: ${e.join(`, `)}`;export{C as ER_ALPHANUMERIC_ONLY,x as ER_ALREADY_EXISTS,D as ER_DAYS_MAX,E as ER_DAYS_MIN,k as ER_DURATION_MAX,O as ER_DURATION_NONZERO,i as ER_ENTER_DATE,f as ER_ENTER_DATETIME,s as ER_ENTER_EARLIER_DATE,c as ER_ENTER_EMAIL,m as ER_ENTER_ENCODED,d as ER_ENTER_FORMAT,u as ER_ENTER_ID,p as ER_ENTER_IP,o as ER_ENTER_LATER_DATE,n as ER_ENTER_NUMBER,t as ER_ENTER_TEXT,h as ER_ENTER_TOKEN,l as ER_ENTER_URL,g as ER_ENTER_VALID,A as ER_EXPECTED,y as ER_INVALID_ELEMENT,v as ER_INVALID_KEY,b as ER_INVALID_VALUE,M as ER_MAX_CHARS,R as ER_MAX_FILE_SIZE,B as ER_MAX_GENERIC,I as ER_MAX_ITEMS,P as ER_MAX_VALUE,j as ER_MIN_CHARS,L as ER_MIN_FILE_SIZE,z as ER_MIN_GENERIC,F as ER_MIN_ITEMS,N as ER_MIN_VALUE,V as ER_MULTIPLE_OF,T as ER_NUMBER_MAX,w as ER_NUMBER_MIN,S as ER_PASSWORD_MIN,e as ER_REQUIRED,a as ER_SELECT_ONE,H as ER_SELECT_ONE_OF,r as ER_SELECT_OPTION,_ as ER_SELECT_VALID,U as ER_UNEXPECTED_FIELDS};
|
|
2
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sources":["../../lib/utilities/errors.ts"],"sourcesContent":["// Error message constants\nexport const ER_REQUIRED = 'This field is required';\nexport const ER_ENTER_TEXT = 'Please enter text';\nexport const ER_ENTER_NUMBER = 'Please enter a valid number';\nexport const ER_SELECT_OPTION = 'Please select an option';\nexport const ER_ENTER_DATE = 'Please enter a valid date';\nexport const ER_SELECT_ONE = 'Please select at least one option';\nexport const ER_ENTER_LATER_DATE = 'Please enter a later date';\nexport const ER_ENTER_EARLIER_DATE = 'Please enter an earlier date';\nexport const ER_ENTER_EMAIL = 'Please enter a valid email address';\nexport const ER_ENTER_URL = 'Please enter a valid URL';\nexport const ER_ENTER_ID = 'Please select a valid option';\nexport const ER_ENTER_FORMAT = 'Please enter a valid format';\nexport const ER_ENTER_DATETIME = 'Please enter a valid date/time';\nexport const ER_ENTER_IP = 'Please enter a valid IP address';\nexport const ER_ENTER_ENCODED = 'Please enter valid encoded data';\nexport const ER_ENTER_TOKEN = 'Please enter a valid token';\nexport const ER_ENTER_VALID = 'Please enter a valid value';\nexport const ER_SELECT_VALID = 'Please select a valid option';\nexport const ER_INVALID_KEY = 'Invalid key provided';\nexport const ER_INVALID_ELEMENT = 'Invalid element provided';\nexport const ER_INVALID_VALUE = 'Invalid value';\nexport const ER_ALREADY_EXISTS = (value: string) => `'${value}' already exists. Enter a unique value.`;\nexport const ER_PASSWORD_MIN = 'Password must be at least 8 characters';\nexport const ER_ALPHANUMERIC_ONLY = 'Only letters, numbers, dashes, and underscores allowed';\nexport const ER_NUMBER_MIN = (min: string) => `The number must be at least ${min}.`;\nexport const ER_NUMBER_MAX = (max: string) => `The number must be at most ${max}.`;\nexport const ER_DAYS_MIN = (min: string) => `The number must be at least ${min} days.`;\nexport const ER_DAYS_MAX = (max: string) => `The number must be at most ${max} days.`;\nexport const ER_DURATION_NONZERO =\n 'At least one value (years, months, days, hours, minutes, or seconds) must be non-zero';\nexport const ER_DURATION_MAX = (maxYears: number) => `Subscription interval cannot exceed ${maxYears} years`;\n\n// Dynamic error message functions\nexport const ER_EXPECTED = (type: string) => `Expected ${type}`;\nexport const ER_MIN_CHARS = (min: number | bigint) => `Please enter at least ${min} character${min === 1 ? '' : 's'}`;\nexport const ER_MAX_CHARS = (max: number | bigint) =>\n `Please enter no more than ${max} character${max === 1 ? '' : 's'}`;\nexport const ER_MIN_VALUE = (min: number | bigint, inclusive?: boolean) =>\n `Please enter a value ${inclusive ? 'at least' : 'greater than'} ${min}`;\nexport const ER_MAX_VALUE = (max: number | bigint, inclusive?: boolean) =>\n `Please enter a value ${inclusive ? 'at most' : 'less than'} ${max}`;\nexport const ER_MIN_ITEMS = (min: number | bigint) => `Please select at least ${min} item${min === 1 ? '' : 's'}`;\nexport const ER_MAX_ITEMS = (max: number | bigint) => `Please select no more than ${max} item${max === 1 ? '' : 's'}`;\nexport const ER_MIN_FILE_SIZE = (min: number | bigint) => `File must be at least ${min} bytes`;\nexport const ER_MAX_FILE_SIZE = (max: number | bigint) => `File must be no larger than ${max} bytes`;\nexport const ER_MIN_GENERIC = (origin: string, min: number | bigint) => `Minimum ${origin} is ${min}`;\nexport const ER_MAX_GENERIC = (origin: string, max: number | bigint) => `Maximum ${origin} is ${max}`;\nexport const ER_MULTIPLE_OF = (divisor: number) => `Please enter a multiple of ${divisor}`;\nexport const ER_SELECT_ONE_OF = (values: string) => `Please select one of: ${values}`;\nexport const ER_UNEXPECTED_FIELDS = (keys: string[], count: number) =>\n `Unexpected field${count > 1 ? 's' : ''}: ${keys.join(', ')}`;\n"],"
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../../lib/utilities/errors.ts"],"sourcesContent":["// Error message constants\nexport const ER_REQUIRED = 'This field is required';\nexport const ER_ENTER_TEXT = 'Please enter text';\nexport const ER_ENTER_NUMBER = 'Please enter a valid number';\nexport const ER_SELECT_OPTION = 'Please select an option';\nexport const ER_ENTER_DATE = 'Please enter a valid date';\nexport const ER_SELECT_ONE = 'Please select at least one option';\nexport const ER_ENTER_LATER_DATE = 'Please enter a later date';\nexport const ER_ENTER_EARLIER_DATE = 'Please enter an earlier date';\nexport const ER_ENTER_EMAIL = 'Please enter a valid email address';\nexport const ER_ENTER_URL = 'Please enter a valid URL';\nexport const ER_ENTER_ID = 'Please select a valid option';\nexport const ER_ENTER_FORMAT = 'Please enter a valid format';\nexport const ER_ENTER_DATETIME = 'Please enter a valid date/time';\nexport const ER_ENTER_IP = 'Please enter a valid IP address';\nexport const ER_ENTER_ENCODED = 'Please enter valid encoded data';\nexport const ER_ENTER_TOKEN = 'Please enter a valid token';\nexport const ER_ENTER_VALID = 'Please enter a valid value';\nexport const ER_SELECT_VALID = 'Please select a valid option';\nexport const ER_INVALID_KEY = 'Invalid key provided';\nexport const ER_INVALID_ELEMENT = 'Invalid element provided';\nexport const ER_INVALID_VALUE = 'Invalid value';\nexport const ER_ALREADY_EXISTS = (value: string) => `'${value}' already exists. Enter a unique value.`;\nexport const ER_PASSWORD_MIN = 'Password must be at least 8 characters';\nexport const ER_ALPHANUMERIC_ONLY = 'Only letters, numbers, dashes, and underscores allowed';\nexport const ER_NUMBER_MIN = (min: string) => `The number must be at least ${min}.`;\nexport const ER_NUMBER_MAX = (max: string) => `The number must be at most ${max}.`;\nexport const ER_DAYS_MIN = (min: string) => `The number must be at least ${min} days.`;\nexport const ER_DAYS_MAX = (max: string) => `The number must be at most ${max} days.`;\nexport const ER_DURATION_NONZERO =\n 'At least one value (years, months, days, hours, minutes, or seconds) must be non-zero';\nexport const ER_DURATION_MAX = (maxYears: number) => `Subscription interval cannot exceed ${maxYears} years`;\n\n// Dynamic error message functions\nexport const ER_EXPECTED = (type: string) => `Expected ${type}`;\nexport const ER_MIN_CHARS = (min: number | bigint) => `Please enter at least ${min} character${min === 1 ? '' : 's'}`;\nexport const ER_MAX_CHARS = (max: number | bigint) =>\n `Please enter no more than ${max} character${max === 1 ? '' : 's'}`;\nexport const ER_MIN_VALUE = (min: number | bigint, inclusive?: boolean) =>\n `Please enter a value ${inclusive ? 'at least' : 'greater than'} ${min}`;\nexport const ER_MAX_VALUE = (max: number | bigint, inclusive?: boolean) =>\n `Please enter a value ${inclusive ? 'at most' : 'less than'} ${max}`;\nexport const ER_MIN_ITEMS = (min: number | bigint) => `Please select at least ${min} item${min === 1 ? '' : 's'}`;\nexport const ER_MAX_ITEMS = (max: number | bigint) => `Please select no more than ${max} item${max === 1 ? '' : 's'}`;\nexport const ER_MIN_FILE_SIZE = (min: number | bigint) => `File must be at least ${min} bytes`;\nexport const ER_MAX_FILE_SIZE = (max: number | bigint) => `File must be no larger than ${max} bytes`;\nexport const ER_MIN_GENERIC = (origin: string, min: number | bigint) => `Minimum ${origin} is ${min}`;\nexport const ER_MAX_GENERIC = (origin: string, max: number | bigint) => `Maximum ${origin} is ${max}`;\nexport const ER_MULTIPLE_OF = (divisor: number) => `Please enter a multiple of ${divisor}`;\nexport const ER_SELECT_ONE_OF = (values: string) => `Please select one of: ${values}`;\nexport const ER_UNEXPECTED_FIELDS = (keys: string[], count: number) =>\n `Unexpected field${count > 1 ? 's' : ''}: ${keys.join(', ')}`;\n"],"mappings":"AACA,IAAa,EAAc,yBACd,EAAgB,oBAChB,EAAkB,8BAClB,EAAmB,0BACnB,EAAgB,4BAChB,EAAgB,oCAChB,EAAsB,4BACtB,EAAwB,+BACxB,EAAiB,qCACjB,EAAe,2BACf,EAAc,+BACd,EAAkB,8BAClB,EAAoB,iCACpB,EAAc,kCACd,EAAmB,kCACnB,EAAiB,6BACjB,EAAiB,6BACjB,EAAkB,+BAClB,EAAiB,uBACjB,EAAqB,2BACrB,EAAmB,gBACnB,EAAqB,GAAkB,IAAI,EAAM,yCACjD,EAAkB,yCAClB,EAAuB,yDACvB,EAAiB,GAAgB,+BAA+B,EAAI,GACpE,EAAiB,GAAgB,8BAA8B,EAAI,GACnE,EAAe,GAAgB,+BAA+B,EAAI,QAClE,EAAe,GAAgB,8BAA8B,EAAI,QACjE,EACT,wFACS,EAAmB,GAAqB,uCAAuC,EAAS,QAGxF,EAAe,GAAiB,YAAY,IAC5C,EAAgB,GAAyB,yBAAyB,EAAI,YAAY,IAAQ,EAAI,GAAK,MACnG,EAAgB,GACzB,6BAA6B,EAAI,YAAY,IAAQ,EAAI,GAAK,MACrD,GAAgB,EAAsB,IAC/C,wBAAwB,EAAY,WAAa,eAAe,GAAG,IAC1D,GAAgB,EAAsB,IAC/C,wBAAwB,EAAY,UAAY,YAAY,GAAG,IACtD,EAAgB,GAAyB,0BAA0B,EAAI,OAAO,IAAQ,EAAI,GAAK,MAC/F,EAAgB,GAAyB,8BAA8B,EAAI,OAAO,IAAQ,EAAI,GAAK,MACnG,EAAoB,GAAyB,yBAAyB,EAAI,QAC1E,EAAoB,GAAyB,+BAA+B,EAAI,QAChF,GAAkB,EAAgB,IAAyB,WAAW,EAAO,MAAM,IACnF,GAAkB,EAAgB,IAAyB,WAAW,EAAO,MAAM,IACnF,EAAkB,GAAoB,8BAA8B,IACpE,EAAoB,GAAmB,yBAAyB,IAChE,GAAwB,EAAgB,IACjD,mBAAmB,EAAQ,EAAI,IAAM,GAAG,IAAI,EAAK,KAAK,IAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createFormHookContexts as
|
|
2
|
-
//# sourceMappingURL=form-context.js.map
|
|
1
|
+
import{useEffect as e}from"react";import{createFormHookContexts as t,useStore as n}from"@tanstack/react-form";var{fieldContext:r,formContext:i,useFieldContext:a}=t();function o({disabled:t}){let r=a(),i=n(r.form.store,e=>e.isSubmitting);e(()=>{r.setMeta(e=>({...e,disabled:!!t}))},[t,r]);let o=r.options?.validators?.onBlur||r.options?.validators?.onChange||r.options?.validators?.onMount,s=!!o&&!(e=>{if(!e||typeof e!=`object`||typeof e.safeParse!=`function`)return!1;let t=e;return t.safeParse(void 0).success||t.safeParse(null).success})(o);return Object.assign(r,{isRequired:s,isSubmitting:i})}export{r as fieldContext,i as formContext,o as useFieldContext};
|
|
2
|
+
//# sourceMappingURL=form-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-context.js","sources":["../../lib/utilities/form-context.tsx"],"sourcesContent":["import { createFormHookContexts, useStore } from '@tanstack/react-form';\nimport { useEffect } from 'react';\n\ntype ZodLikeSchema = {\n safeParse: (input: unknown) => { success: boolean };\n};\n\n/**\n * Exports contexts and hooks used by all form-related field components.\n *\n * These contexts come from @tanstack/react-form's createFormHookContexts helper\n * and provide a lightweight, strongly-typed way for nested field components\n * (text inputs, selects, checkboxes, etc.) to access the current field\n * and form instances.\n *\n * Usage example:\n * ```ts\n * import { useFieldContext } from './form-context';\n * const field = useFieldContext<MyFieldType>();\n * ```\n */\nconst { fieldContext, formContext, useFieldContext: _useFieldContext } = createFormHookContexts();\n\nexport { fieldContext, formContext };\n/**\n * Custom hook to handle disabled state for form fields\n * @param {boolean} disabled - The disabled prop passed to the component\n * @returns The field context with disabled state properly managed\n */\nexport function useFieldContext<T>({ disabled }: { disabled?: boolean }) {\n const field = _useFieldContext<T>();\n\n // https://github.com/TanStack/form/issues/1705\n // https://tanstack.com/form/latest/docs/framework/react/guides/reactivity\n const isSubmitting = useStore(field.form.store, state => state.isSubmitting);\n\n useEffect(() => {\n field.setMeta(meta => ({\n ...meta,\n disabled: !!disabled,\n }));\n }, [disabled, field]);\n\n // Detect if field is required based on validators\n const validator =\n field.options?.validators?.onBlur || field.options?.validators?.onChange || field.options?.validators?.onMount;\n\n // Check if the validator allows missing values (undefined/null)\n const allowsMissingValue = (schema: unknown): boolean => {\n // Type guard: ensure it's a Zod-like schema with safeParse method\n if (!schema || typeof schema !== 'object' || typeof (schema as any).safeParse !== 'function') {\n return false;\n }\n\n const zodSchema = schema as ZodLikeSchema;\n\n // Check if undefined or null are valid inputs\n return zodSchema.safeParse(undefined).success || zodSchema.safeParse(null).success;\n };\n\n const isRequired = !!validator && !allowsMissingValue(validator);\n\n return Object.assign(field, { isRequired, isSubmitting });\n}\n"],"
|
|
1
|
+
{"version":3,"file":"form-context.js","names":[],"sources":["../../lib/utilities/form-context.tsx"],"sourcesContent":["import { createFormHookContexts, useStore } from '@tanstack/react-form';\nimport { useEffect } from 'react';\n\ntype ZodLikeSchema = {\n safeParse: (input: unknown) => { success: boolean };\n};\n\n/**\n * Exports contexts and hooks used by all form-related field components.\n *\n * These contexts come from @tanstack/react-form's createFormHookContexts helper\n * and provide a lightweight, strongly-typed way for nested field components\n * (text inputs, selects, checkboxes, etc.) to access the current field\n * and form instances.\n *\n * Usage example:\n * ```ts\n * import { useFieldContext } from './form-context';\n * const field = useFieldContext<MyFieldType>();\n * ```\n */\nconst { fieldContext, formContext, useFieldContext: _useFieldContext } = createFormHookContexts();\n\nexport { fieldContext, formContext };\n/**\n * Custom hook to handle disabled state for form fields\n * @param {boolean} disabled - The disabled prop passed to the component\n * @returns The field context with disabled state properly managed\n */\nexport function useFieldContext<T>({ disabled }: { disabled?: boolean }) {\n const field = _useFieldContext<T>();\n\n // https://github.com/TanStack/form/issues/1705\n // https://tanstack.com/form/latest/docs/framework/react/guides/reactivity\n const isSubmitting = useStore(field.form.store, state => state.isSubmitting);\n\n useEffect(() => {\n field.setMeta(meta => ({\n ...meta,\n disabled: !!disabled,\n }));\n }, [disabled, field]);\n\n // Detect if field is required based on validators\n const validator =\n field.options?.validators?.onBlur || field.options?.validators?.onChange || field.options?.validators?.onMount;\n\n // Check if the validator allows missing values (undefined/null)\n const allowsMissingValue = (schema: unknown): boolean => {\n // Type guard: ensure it's a Zod-like schema with safeParse method\n if (!schema || typeof schema !== 'object' || typeof (schema as any).safeParse !== 'function') {\n return false;\n }\n\n const zodSchema = schema as ZodLikeSchema;\n\n // Check if undefined or null are valid inputs\n return zodSchema.safeParse(undefined).success || zodSchema.safeParse(null).success;\n };\n\n const isRequired = !!validator && !allowsMissingValue(validator);\n\n return Object.assign(field, { isRequired, isSubmitting });\n}\n"],"mappings":"8GAqBA,GAAM,CAAE,eAAc,cAAa,gBAAiB,GAAqB,EAAuB,EAQhG,SAAgB,EAAmB,CAAE,YAAoC,CACrE,IAAM,EAAQ,EAAoB,EAI5B,EAAe,EAAS,EAAM,KAAK,MAAO,GAAS,EAAM,YAAY,EAE3E,MAAgB,CACZ,EAAM,QAAQ,IAAS,CACnB,GAAG,EACH,SAAU,CAAC,CAAC,CAChB,EAAE,CACN,EAAG,CAAC,EAAU,CAAK,CAAC,EAGpB,IAAM,EACF,EAAM,SAAS,YAAY,QAAU,EAAM,SAAS,YAAY,UAAY,EAAM,SAAS,YAAY,QAerG,EAAa,CAAC,CAAC,GAAa,EAZN,GAA6B,CAErD,GAAI,CAAC,GAAU,OAAO,GAAW,UAAY,OAAQ,EAAe,WAAc,WAC9E,MAAO,GAGX,IAAM,EAAY,EAGlB,OAAO,EAAU,UAAU,IAAA,EAAS,CAAC,CAAC,SAAW,EAAU,UAAU,IAAI,CAAC,CAAC,OAC/E,EAEmC,CAAmB,CAAS,EAE/D,OAAO,OAAO,OAAO,EAAO,CAAE,aAAY,cAAa,CAAC,CAC5D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=form-hook.js.map
|
|
1
|
+
import{fieldContext as e,formContext as t}from"./form-context.js";import{Button as n}from"../components/button.js";import{TfCheckbox as r}from"../components/checkbox.js";import{TfSingleSelect as i}from"../components/select.js";import{TfMultiSelect as a}from"../components/multi-select.js";import{TfNumberField as o}from"../components/numberfield.js";import{TfTextField as s}from"../components/textfield.js";import{TfDatePicker as c}from"../components/date-picker.js";import{createFormHook as l,formOptions as u,revalidateLogic as d}from"@tanstack/react-form";var{useAppForm:f,withForm:p,withFieldGroup:m}=l({fieldComponents:{TfTextField:s,TfNumberField:o,TfMultiSelect:a,TfSingleSelect:i,TfCheckbox:r,TfDatePicker:c},formComponents:{Button:n},fieldContext:e,formContext:t});export{u as formOptions,d as revalidateLogic,f as useAppForm,m as withFieldGroup,p as withForm};
|
|
2
|
+
//# sourceMappingURL=form-hook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-hook.js","sources":["../../lib/utilities/form-hook.tsx"],"sourcesContent":["import { createFormHook, formOptions, revalidateLogic } from '@tanstack/react-form';\nimport { Button } from '../components/button';\nimport { TfCheckbox } from '../components/checkbox';\nimport { TfMultiSelect } from '../components/multi-select';\nimport { TfNumberField } from '../components/numberfield';\nimport { TfSingleSelect } from '../components/select';\nimport { TfTextField } from '../components/textfield';\nimport { fieldContext, formContext } from '../utilities/form-context';\nimport { TfDatePicker } from '../components/date-picker';\n\n/** Don't put this in the same file as form-context.tsx, this causes circular dependencies. */\n/** TODO, lazy loading when fieldComponents are large */\n/**\n * Builder for form logic and user interfaces\n */\n/**\n * A small builder that wires the form library to the concrete UI components used across the app.\n * `createFormHook` returns a `useAppForm` hook which contains standard wiring and default components for\n * fields and form-level controls.\n *\n * It exports only the `useAppForm` hook. Consumers (forms in codebase) call `useAppForm` to access the form API and default components.\n */\nexport const { useAppForm, withForm, withFieldGroup } = createFormHook({\n fieldComponents: {\n TfTextField,\n TfNumberField,\n TfMultiSelect,\n TfSingleSelect,\n TfCheckbox,\n TfDatePicker,\n },\n formComponents: {\n Button,\n },\n fieldContext,\n formContext,\n});\n\nexport { formOptions, revalidateLogic };\n"],"
|
|
1
|
+
{"version":3,"file":"form-hook.js","names":[],"sources":["../../lib/utilities/form-hook.tsx"],"sourcesContent":["import { createFormHook, formOptions, revalidateLogic } from '@tanstack/react-form';\nimport { Button } from '../components/button';\nimport { TfCheckbox } from '../components/checkbox';\nimport { TfMultiSelect } from '../components/multi-select';\nimport { TfNumberField } from '../components/numberfield';\nimport { TfSingleSelect } from '../components/select';\nimport { TfTextField } from '../components/textfield';\nimport { fieldContext, formContext } from '../utilities/form-context';\nimport { TfDatePicker } from '../components/date-picker';\n\n/** Don't put this in the same file as form-context.tsx, this causes circular dependencies. */\n/** TODO, lazy loading when fieldComponents are large */\n/**\n * Builder for form logic and user interfaces\n */\n/**\n * A small builder that wires the form library to the concrete UI components used across the app.\n * `createFormHook` returns a `useAppForm` hook which contains standard wiring and default components for\n * fields and form-level controls.\n *\n * It exports only the `useAppForm` hook. Consumers (forms in codebase) call `useAppForm` to access the form API and default components.\n */\nexport const { useAppForm, withForm, withFieldGroup } = createFormHook({\n fieldComponents: {\n TfTextField,\n TfNumberField,\n TfMultiSelect,\n TfSingleSelect,\n TfCheckbox,\n TfDatePicker,\n },\n formComponents: {\n Button,\n },\n fieldContext,\n formContext,\n});\n\nexport { formOptions, revalidateLogic };\n"],"mappings":"+iBAsBA,GAAa,CAAE,aAAY,WAAU,kBAAmB,EAAe,CACnE,gBAAiB,CACb,cACA,gBACA,gBACA,iBACA,aACA,cACJ,EACA,eAAgB,CACZ,QACJ,EACA,eACA,aACJ,CAAC"}
|
package/dist/utilities/form.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
//# sourceMappingURL=form.js.map
|
|
1
|
+
function e(e){return async({formApi:n})=>{await e({values:t(n.state.values,n),formApi:n})}}function t(e,t){let n={};for(let r in e)t.getFieldMeta(r)?.disabled||(n[r]=e[r]);return n}function n(e){return e?.state.meta.errors.map(e=>e?.message).join(`,`)}export{n as getFieldErrorMessage,e as tfOnSubmit};
|
|
2
|
+
//# sourceMappingURL=form.js.map
|