@cryptlex/web-components 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/components/data-table/data-table-filter.d.ts +27 -0
  2. package/dist/components/data-table/data-table-filter.js +112 -0
  3. package/dist/components/data-table/data-table.d.ts +73 -0
  4. package/dist/components/data-table/data-table.js +265 -0
  5. package/dist/components/data-table/table-commons.d.ts +56 -0
  6. package/dist/components/data-table/table-commons.js +137 -0
  7. package/dist/components/inputs/checkbox.d.ts +8 -0
  8. package/dist/components/inputs/checkbox.js +25 -0
  9. package/dist/components/inputs/date-picker.d.ts +11 -0
  10. package/dist/components/inputs/date-picker.js +22 -0
  11. package/dist/components/inputs/datefield.d.ts +14 -0
  12. package/dist/components/inputs/datefield.js +25 -0
  13. package/dist/components/inputs/field.d.ts +21 -0
  14. package/dist/components/inputs/field.js +48 -0
  15. package/dist/components/inputs/id-search.d.ts +20 -0
  16. package/dist/components/inputs/id-search.js +40 -0
  17. package/dist/components/inputs/input-otp.d.ts +8 -0
  18. package/dist/components/inputs/input-otp.js +19 -0
  19. package/dist/components/inputs/multi-select.d.ts +17 -0
  20. package/dist/components/inputs/multi-select.js +18 -0
  21. package/dist/components/inputs/numberfield.d.ts +7 -0
  22. package/dist/components/inputs/numberfield.js +25 -0
  23. package/dist/components/inputs/searchfield.d.ts +5 -0
  24. package/dist/components/inputs/searchfield.js +24 -0
  25. package/dist/components/inputs/select-options.d.ts +8 -0
  26. package/dist/components/inputs/select-options.js +286 -0
  27. package/dist/components/inputs/select.d.ts +17 -0
  28. package/dist/components/inputs/select.js +34 -0
  29. package/dist/components/inputs/textfield.d.ts +7 -0
  30. package/dist/components/inputs/textfield.js +28 -0
  31. package/dist/components/key-value-card/key-value-card.d.ts +17 -0
  32. package/dist/components/key-value-card/key-value-card.js +40 -0
  33. package/dist/components/ui/alert.d.ts +8 -0
  34. package/dist/components/ui/alert.js +18 -0
  35. package/dist/components/ui/avatar.d.ts +8 -0
  36. package/dist/components/ui/avatar.js +5 -0
  37. package/dist/components/ui/badge.d.ts +2 -0
  38. package/dist/components/ui/badge.js +5 -0
  39. package/dist/components/ui/breadcrumbs.d.ts +10 -0
  40. package/dist/components/ui/breadcrumbs.js +28 -0
  41. package/dist/components/ui/button.d.ts +11 -0
  42. package/dist/components/ui/button.js +34 -0
  43. package/dist/components/ui/calendar.d.ts +17 -0
  44. package/dist/components/ui/calendar.js +63 -0
  45. package/dist/components/ui/card.d.ts +7 -0
  46. package/dist/components/ui/card.js +20 -0
  47. package/dist/components/ui/dialog.d.ts +19 -0
  48. package/dist/components/ui/dialog.js +42 -0
  49. package/dist/components/ui/disclosure.d.ts +19 -0
  50. package/dist/components/ui/disclosure.js +20 -0
  51. package/dist/components/ui/list-box.d.ts +5 -0
  52. package/dist/components/ui/list-box.js +24 -0
  53. package/dist/components/ui/loader.d.ts +5 -0
  54. package/dist/components/ui/loader.js +6 -0
  55. package/dist/components/ui/menu.d.ts +25 -0
  56. package/dist/components/ui/menu.js +38 -0
  57. package/dist/components/ui/popover.d.ts +4 -0
  58. package/dist/components/ui/popover.js +14 -0
  59. package/dist/components/ui/sidebar.d.ts +53 -0
  60. package/dist/components/ui/sidebar.js +177 -0
  61. package/dist/components/ui/skeleton.d.ts +1 -0
  62. package/dist/components/ui/skeleton.js +5 -0
  63. package/dist/components/ui/sonner.d.ts +4 -0
  64. package/dist/components/ui/sonner.js +14 -0
  65. package/dist/components/ui/table.d.ts +9 -0
  66. package/dist/components/ui/table.js +26 -0
  67. package/dist/components/ui/tabs.d.ts +5 -0
  68. package/dist/components/ui/tabs.js +25 -0
  69. package/dist/components/ui/timeline.d.ts +15 -0
  70. package/dist/components/ui/timeline.js +31 -0
  71. package/dist/components/ui/tooltip.d.ts +4 -0
  72. package/dist/components/ui/tooltip.js +12 -0
  73. package/dist/utils/form-context.d.ts +4 -0
  74. package/{lib/utils/form-context.tsx → dist/utils/form-context.js} +1 -3
  75. package/dist/utils/form-hook.d.ts +25 -0
  76. package/{lib/utils/form-hook.tsx → dist/utils/form-hook.js} +15 -18
  77. package/dist/utils/primitives.d.ts +30 -0
  78. package/{lib/utils/primitives.ts → dist/utils/primitives.js} +8 -37
  79. package/dist/utils/resource-names.d.ts +23 -0
  80. package/{lib/utils/resource-names.tsx → dist/utils/resource-names.js} +42 -75
  81. package/dist/utils/use-mobile.d.ts +1 -0
  82. package/dist/utils/use-mobile.js +15 -0
  83. package/package.json +10 -5
  84. package/lib/components/data-table/data-table-filter.tsx +0 -220
  85. package/lib/components/data-table/data-table.tsx +0 -593
  86. package/lib/components/data-table/table-commons.tsx +0 -233
  87. package/lib/components/inputs/checkbox.tsx +0 -72
  88. package/lib/components/inputs/date-picker.tsx +0 -130
  89. package/lib/components/inputs/datefield.tsx +0 -109
  90. package/lib/components/inputs/field.tsx +0 -106
  91. package/lib/components/inputs/id-search.tsx +0 -83
  92. package/lib/components/inputs/input-otp.tsx +0 -63
  93. package/lib/components/inputs/multi-select.tsx +0 -62
  94. package/lib/components/inputs/numberfield.tsx +0 -110
  95. package/lib/components/inputs/searchfield.tsx +0 -87
  96. package/lib/components/inputs/select-options.tsx +0 -303
  97. package/lib/components/inputs/select.tsx +0 -140
  98. package/lib/components/inputs/textfield.tsx +0 -96
  99. package/lib/components/key-value-card/key-value-card.tsx +0 -115
  100. package/lib/components/ui/alert.tsx +0 -32
  101. package/lib/components/ui/avatar.tsx +0 -22
  102. package/lib/components/ui/badge.tsx +0 -19
  103. package/lib/components/ui/breadcrumbs.tsx +0 -104
  104. package/lib/components/ui/button.tsx +0 -66
  105. package/lib/components/ui/calendar.tsx +0 -220
  106. package/lib/components/ui/card.tsx +0 -58
  107. package/lib/components/ui/dialog.tsx +0 -172
  108. package/lib/components/ui/disclosure.tsx +0 -113
  109. package/lib/components/ui/list-box.tsx +0 -86
  110. package/lib/components/ui/loader.tsx +0 -10
  111. package/lib/components/ui/menu.tsx +0 -168
  112. package/lib/components/ui/popover.tsx +0 -37
  113. package/lib/components/ui/sidebar.tsx +0 -552
  114. package/lib/components/ui/skeleton.tsx +0 -7
  115. package/lib/components/ui/sonner.tsx +0 -26
  116. package/lib/components/ui/table.tsx +0 -79
  117. package/lib/components/ui/tabs.tsx +0 -82
  118. package/lib/components/ui/timeline.tsx +0 -52
  119. package/lib/components/ui/tooltip.tsx +0 -30
  120. package/lib/tokens.scss +0 -89
  121. package/lib/utils/use-mobile.tsx +0 -21
@@ -0,0 +1,9 @@
1
+ import type * as React from "react";
2
+ export declare function Table({ className, ...props }: React.ComponentProps<"table">): import("react/jsx-runtime").JSX.Element;
3
+ export declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): import("react/jsx-runtime").JSX.Element;
4
+ export declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): import("react/jsx-runtime").JSX.Element;
5
+ export declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): import("react/jsx-runtime").JSX.Element;
6
+ export declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): import("react/jsx-runtime").JSX.Element;
7
+ export declare function TableHead({ className, ...props }: React.ComponentProps<"th">): import("react/jsx-runtime").JSX.Element;
8
+ export declare function TableCell({ className, ...props }: React.ComponentProps<"td">): import("react/jsx-runtime").JSX.Element;
9
+ export declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "lib/utils/primitives";
3
+ export function Table({ className, ...props }) {
4
+ return (_jsx("table", { className: cn("caption-bottom text-sm [&_tr:last-child]:border-0 my-0 whitespace-nowrap", className), ...props }));
5
+ }
6
+ export function TableHeader({ className, ...props }) {
7
+ return (_jsx("thead", { className: cn("[&_tr]:border-b border-b", className), ...props }));
8
+ }
9
+ export function TableBody({ className, ...props }) {
10
+ return _jsx("tbody", { className: cn(className), ...props });
11
+ }
12
+ export function TableFooter({ className, ...props }) {
13
+ return (_jsx("tfoot", { className: cn("border-t font-medium last:[&>tr]:border-b-0", className), ...props }));
14
+ }
15
+ export function TableRow({ className, ...props }) {
16
+ return _jsx("tr", { className: cn("border-b border-border", className), ...props });
17
+ }
18
+ export function TableHead({ className, ...props }) {
19
+ return (_jsx("th", { className: cn("text-left align-middle font-medium", className), ...props }));
20
+ }
21
+ export function TableCell({ className, ...props }) {
22
+ return (_jsx("td", { className: cn("[&_tr:last-child]:border-dotted", className), ...props }));
23
+ }
24
+ export function TableCaption({ className, ...props }) {
25
+ return (_jsx("caption", { className: cn("mt-icon text-sm text-muted-foreground", className), ...props }));
26
+ }
@@ -0,0 +1,5 @@
1
+ import { TabListProps as AriaTabListProps, TabPanelProps as AriaTabPanelProps, TabProps as AriaTabProps, TabsProps as AriaTabsProps } from "react-aria-components";
2
+ export declare function Tabs({ className, ...props }: AriaTabsProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function TabList<T extends object>({ className, ...props }: AriaTabListProps<T>): import("react/jsx-runtime").JSX.Element;
4
+ export declare function Tab({ className, ...props }: AriaTabProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function TabPanel({ className, ...props }: AriaTabPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Tab as AriaTab, TabList as AriaTabList, TabPanel as AriaTabPanel, Tabs as AriaTabs, composeRenderProps, } from "react-aria-components";
3
+ import { cn } from "lib/utils/primitives";
4
+ export function Tabs({ className, ...props }) {
5
+ return (_jsx(AriaTabs, { className: composeRenderProps(className, (className) => cn("group flex flex-col gap-2",
6
+ /* Orientation */
7
+ "data-[orientation=vertical]:flex-row", className)), ...props }));
8
+ }
9
+ export function TabList({ className, ...props }) {
10
+ return (_jsx(AriaTabList, { className: composeRenderProps(className, (className) => cn("inline-flex items-center border-b text-muted-foreground",
11
+ /* Orientation */
12
+ "data-[orientation=vertical]:h-auto data-[orientation=vertical]:flex-col", className)), ...props }));
13
+ }
14
+ export function Tab({ className, ...props }) {
15
+ return (_jsx(AriaTab, { className: composeRenderProps(className, (className) => cn("btn btn-ghost leading-none text-accent h-input truncate inline-flex items-center px-3 body font-medium transition-all",
16
+ /* Selected */
17
+ "data-[selected]:bg-primary/20 data-[selected]:text-primary",
18
+ /* Orientation */
19
+ "group-data-[orientation=vertical]:w-full", className)), ...props }));
20
+ }
21
+ export function TabPanel({ className, ...props }) {
22
+ return (_jsx(AriaTabPanel, { className: composeRenderProps(className, (className) => cn("ring-offset-background",
23
+ /* Focus Visible */
24
+ "focus-ring", className)), ...props }));
25
+ }
@@ -0,0 +1,15 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import type { LucideIcon } from "lucide-react";
3
+ export declare function Timeline({ className, ...props }: React.ComponentProps<'ol'>): import("react/jsx-runtime").JSX.Element;
4
+ export declare function TimelineItem({ className, ...props }: React.ComponentProps<'li'> & {}): import("react/jsx-runtime").JSX.Element;
5
+ export declare const timelineIconVariants: (props?: ({
6
+ variant?: "destructive" | "success" | "muted" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ export declare function TimelineIcon({ icon: Icon, className, variant, ...props }: Omit<React.ComponentProps<'div'>, 'children'> & VariantProps<typeof timelineIconVariants> & {
9
+ icon: LucideIcon;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ export declare function TimelineDate({ className, date, dateFormatter, ...props }: Omit<React.ComponentProps<'time'>, 'dateTime' | 'children'> & {
12
+ date: Date;
13
+ dateFormatter?: (d: Date) => string;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ export declare function TimelineContent({ className, ...props }: React.ComponentProps<'section'>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { cn } from "lib/utils/primitives";
4
+ export function Timeline({ className, ...props }) {
5
+ return _jsx("ol", { className: cn("grid grid-col-1 gap-icon", className), ...props });
6
+ }
7
+ export function TimelineItem({ className, ...props }) {
8
+ return (_jsx("li", { className: cn("grid grid-cols-[4rem_2rem_1fr] grid-rows-subgrid list-none gap-icon", className), ...props }));
9
+ }
10
+ export const timelineIconVariants = cva(`p-1 rounded-full`, {
11
+ variants: {
12
+ variant: {
13
+ destructive: "text-destructive-foreground bg-destructive",
14
+ success: "text-success-foreground bg-success",
15
+ muted: "text-muted-foreground bg-muted",
16
+ },
17
+ },
18
+ defaultVariants: {
19
+ variant: "muted",
20
+ },
21
+ });
22
+ export function TimelineIcon({ icon: Icon, className, variant, ...props }) {
23
+ return _jsxs("div", { ...props, className: "flex flex-col items-center gap-2", children: [_jsx("div", { className: cn(timelineIconVariants({ variant, className })), children: _jsx(Icon, { className: "size-icon " }) }), _jsx("div", { className: "h-full w-[1px]" })] });
24
+ }
25
+ export function TimelineDate({ className, date, dateFormatter, ...props }) {
26
+ const defaultDateDisplay = `${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getFullYear()}`;
27
+ return _jsx("time", { ...props, dateTime: date.toISOString(), className: cn("font-mono leading-none text-muted", className), children: dateFormatter ? dateFormatter(date) : defaultDateDisplay });
28
+ }
29
+ export function TimelineContent({ className, ...props }) {
30
+ return _jsx("section", { className: cn("", className), ...props });
31
+ }
@@ -0,0 +1,4 @@
1
+ import { TooltipTrigger as AriaTooltipTrigger, type TooltipProps as AriaTooltipProps } from "react-aria-components";
2
+ declare const TooltipTrigger: typeof AriaTooltipTrigger;
3
+ declare const Tooltip: ({ className, offset, ...props }: AriaTooltipProps) => import("react/jsx-runtime").JSX.Element;
4
+ export { Tooltip, TooltipTrigger };
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Tooltip as AriaTooltip, TooltipTrigger as AriaTooltipTrigger, composeRenderProps, } from "react-aria-components";
3
+ import { cn } from "lib/utils/primitives";
4
+ const TooltipTrigger = AriaTooltipTrigger;
5
+ const Tooltip = ({ className, offset = 4, ...props }) => (_jsx(AriaTooltip, { offset: offset, className: composeRenderProps(className, (className) => cn("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0",
6
+ /* Entering */
7
+ "data-[entering]:zoom-in-95",
8
+ /* Exiting */
9
+ "data-[exiting]:animate-out data-[exiting]:fade-out-0 data-[exiting]:zoom-out-95",
10
+ /* Placement */
11
+ "data-[placement=bottom]:slide-in-from-top-2 data-[placement=left]:slide-in-from-right-2 data-[placement=right]:slide-in-from-left-2 data-[placement=top]:slide-in-from-bottom-2", className)), ...props }));
12
+ export { Tooltip, TooltipTrigger };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * useFieldContext is used in custom components
3
+ */
4
+ export declare const fieldContext: import("react").Context<import("@tanstack/react-form").AnyFieldApi>, formContext: import("react").Context<import("@tanstack/react-form").AnyFormApi>, useFieldContext: <TData>() => import("@tanstack/react-form").FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
@@ -1,7 +1,5 @@
1
1
  import { createFormHookContexts } from "@tanstack/react-form";
2
-
3
2
  /**
4
3
  * useFieldContext is used in custom components
5
4
  */
6
- export const { fieldContext, formContext, useFieldContext } =
7
- createFormHookContexts();
5
+ export const { fieldContext, formContext, useFieldContext } = createFormHookContexts();
@@ -0,0 +1,25 @@
1
+ import { type FieldApi } from "@tanstack/react-form";
2
+ import { TfCheckbox } from "lib/components/inputs/checkbox";
3
+ import { TfMultiSelect } from "lib/components/inputs/multi-select";
4
+ import { TfNumberField } from "lib/components/inputs/numberfield";
5
+ import { TfSingleSelect } from "lib/components/inputs/select";
6
+ import { TfTextField } from "lib/components/inputs/textfield";
7
+ import { Button } from "lib/components/ui/button";
8
+ export declare function getFieldErrorMessage(field: FieldApi<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>): string;
9
+ /** Don't put this in the same file as form-context.tsx, this causes circular dependencies. */
10
+ /** TODO, lazy loading when fieldComponents are large */
11
+ /**
12
+ * Builder for form logic and user interfaces
13
+ */
14
+ export declare const useAppForm: <TFormData, TOnMount extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChange extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnChangeAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnBlur extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnBlurAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnSubmit extends import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined, TOnSubmitAsync extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TOnServer extends import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData> | undefined, TSubmitMeta>(props: import("@tanstack/react-form").FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnServer, TSubmitMeta>) => import("@tanstack/react-form").FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnServer, TSubmitMeta> & import("@tanstack/react-form").ReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnServer, TSubmitMeta> & NoInfer<{
15
+ readonly Button: typeof Button;
16
+ }> & {
17
+ AppField: import("@tanstack/react-form").FieldComponent<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnServer, TSubmitMeta, NoInfer<{
18
+ readonly TfTextField: typeof TfTextField;
19
+ readonly TfNumberField: typeof TfNumberField;
20
+ readonly TfMultiSelect: typeof TfMultiSelect;
21
+ readonly TfSingleSelect: typeof TfSingleSelect;
22
+ readonly TfCheckbox: typeof TfCheckbox;
23
+ }>>;
24
+ AppForm: import("react").ComponentType<import("react").PropsWithChildren>;
25
+ };
@@ -1,4 +1,4 @@
1
- import { createFormHook, type FieldApi } from "@tanstack/react-form";
1
+ import { createFormHook } from "@tanstack/react-form";
2
2
  import { TfCheckbox } from "lib/components/inputs/checkbox";
3
3
  import { TfMultiSelect } from "lib/components/inputs/multi-select";
4
4
  import { TfNumberField } from "lib/components/inputs/numberfield";
@@ -6,28 +6,25 @@ import { TfSingleSelect } from "lib/components/inputs/select";
6
6
  import { TfTextField } from "lib/components/inputs/textfield";
7
7
  import { Button } from "lib/components/ui/button";
8
8
  import { fieldContext, formContext } from "lib/utils/form-context";
9
-
10
- export function getFieldErrorMessage(field: FieldApi<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>): string {
11
- return field?.state.meta.errors.map((e) => e?.message).join(",")
9
+ export function getFieldErrorMessage(field) {
10
+ return field?.state.meta.errors.map((e) => e?.message).join(",");
12
11
  }
13
-
14
12
  /** Don't put this in the same file as form-context.tsx, this causes circular dependencies. */
15
-
16
13
  /** TODO, lazy loading when fieldComponents are large */
17
14
  /**
18
15
  * Builder for form logic and user interfaces
19
16
  */
20
17
  export const { useAppForm } = createFormHook({
21
- fieldComponents: {
22
- TfTextField,
23
- TfNumberField,
24
- TfMultiSelect,
25
- TfSingleSelect,
26
- TfCheckbox,
27
- },
28
- formComponents: {
29
- Button,
30
- },
31
- fieldContext,
32
- formContext,
18
+ fieldComponents: {
19
+ TfTextField,
20
+ TfNumberField,
21
+ TfMultiSelect,
22
+ TfSingleSelect,
23
+ TfCheckbox,
24
+ },
25
+ formComponents: {
26
+ Button,
27
+ },
28
+ fieldContext,
29
+ formContext,
33
30
  });
@@ -0,0 +1,30 @@
1
+ import { type ClassValue } from "clsx";
2
+ /** Classnames */
3
+ export declare function cn(...inputs: ClassValue[]): string;
4
+ /**
5
+ *
6
+ * @returns
7
+ */
8
+ export declare function getThemeHue(): string;
9
+ /**
10
+ * @param hue the hue value to set in the document style
11
+ */
12
+ export declare function setThemeHue(hue: number): void;
13
+ export declare function logout(): void;
14
+ export type JwtDecode = {
15
+ aud: string;
16
+ email: string;
17
+ exp: number;
18
+ iat: number;
19
+ jti: string;
20
+ region: string;
21
+ role: string;
22
+ role_type: string;
23
+ scope: string[];
24
+ sub: string;
25
+ teat: number;
26
+ tenantid: string;
27
+ token_usage: string;
28
+ sadmin?: string;
29
+ };
30
+ export type CtxPortals = "customer-portal" | "system-portal" | "reseller-portal" | "admin-portal";
@@ -1,16 +1,13 @@
1
- import { clsx, type ClassValue } from "clsx";
2
-
1
+ import { clsx } from "clsx";
3
2
  /** Classnames */
4
- export function cn(...inputs: ClassValue[]) {
3
+ export function cn(...inputs) {
5
4
  return clsx(inputs);
6
5
  }
7
-
8
6
  /**
9
7
  * This is the variable name representing the primary hue.
10
8
  * Referenced in tokens.scss -> token.css
11
9
  */
12
10
  const PRIMARY_HUE_PROPERTY = "--primary-hue";
13
-
14
11
  /**
15
12
  *
16
13
  * @returns
@@ -18,18 +15,14 @@ const PRIMARY_HUE_PROPERTY = "--primary-hue";
18
15
  export function getThemeHue() {
19
16
  return document.documentElement.style.getPropertyValue(PRIMARY_HUE_PROPERTY);
20
17
  }
21
-
22
18
  /**
23
19
  * @param hue the hue value to set in the document style
24
20
  */
25
- export function setThemeHue(hue: number) {
26
- document.documentElement.style.setProperty(
27
- PRIMARY_HUE_PROPERTY,
28
- // In this case, it must be a number.
29
- hue as unknown as string,
30
- );
21
+ export function setThemeHue(hue) {
22
+ document.documentElement.style.setProperty(PRIMARY_HUE_PROPERTY,
23
+ // In this case, it must be a number.
24
+ hue);
31
25
  }
32
-
33
26
  const ACCESS_TOKEN = "AT";
34
27
  const REFRESH_TOKEN = "RT";
35
28
  export function logout() {
@@ -38,31 +31,9 @@ export function logout() {
38
31
  localStorage.removeItem(REFRESH_TOKEN);
39
32
  localStorage.removeItem(ACCESS_TOKEN);
40
33
  window.location.replace("/auth/login");
41
- } catch (error) {
34
+ }
35
+ catch (error) {
42
36
  console.error("Logout failed:", error);
43
37
  }
44
38
  }
45
39
  }
46
-
47
- export type JwtDecode = {
48
- aud: string;
49
- email: string;
50
- exp: number;
51
- iat: number;
52
- jti: string;
53
- region: string;
54
- role: string;
55
- role_type: string;
56
- scope: string[];
57
- sub: string;
58
- teat: number;
59
- tenantid: string;
60
- token_usage: string;
61
- sadmin?: string;
62
- };
63
-
64
- export type CtxPortals =
65
- | "customer-portal"
66
- | "system-portal"
67
- | "reseller-portal"
68
- | "admin-portal";
@@ -0,0 +1,23 @@
1
+ import type { CtxPortals } from "lib/utils/primitives";
2
+ /**
3
+ *
4
+ * @param input camelCase
5
+ * @returns title case for the camelCase string
6
+ */
7
+ export declare function convertToTitleCase(input: string): string;
8
+ export declare function pluralizeTimes(resourceName: string, count: number): string;
9
+ /**
10
+ * Converts a string from 'camelCase' to 'Title Case'
11
+ * @param input String to convert to `Title Case`
12
+ */
13
+ export declare function convertCamelCaseToTitleCase(input: string): string;
14
+ /** Resource Name should ALWAYS be in singular form */
15
+ export declare const RESOURCE_NAMES: readonly ["access-token", "account", "activation", "activation-log", "admin-role", "audit-log", "automated-email", "automated-email-event-log", "card", "feature-flag", "invoice", "license", "license-template", "maintenance-policy", "organization", "plan", "product", "product-version", "profile", "release", "release-channel", "release-file", "release-platform", "report", "role", "role-claim", "saml-configuration", "segment", "sending-domain", "setting", "tag", "team-member", "trial", "trial-policy", "user", "user-group", "webhook", "webhook-event-log", "webhook-trigger", "reseller", "oidc-configuration", "organization-claim", "reseller-claim"];
16
+ export type ResourceName = (typeof RESOURCE_NAMES)[number];
17
+ export declare const RESOURCE_DEFINITIONS: Record<ResourceName, string>;
18
+ export declare function ProjectProvider({ projectName, children }: {
19
+ projectName: CtxPortals;
20
+ children: React.ReactNode;
21
+ }): import("react/jsx-runtime").JSX.Element;
22
+ export declare function useProjectName(): CtxPortals;
23
+ export declare function useResourceFormatter(): (resourceName: string) => string;
@@ -1,12 +1,11 @@
1
- import type { CtxPortals } from "lib/utils/primitives";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, use } from "react";
3
-
4
3
  /**
5
4
  *
6
5
  * @param input camelCase
7
6
  * @returns title case for the camelCase string
8
7
  */
9
- export function convertToTitleCase(input: string): string {
8
+ export function convertToTitleCase(input) {
10
9
  return input
11
10
  .replace(/([A-Z])/g, " $1") // Insert space before capital letters
12
11
  .trim() // Remove any leading/trailing spaces
@@ -14,41 +13,38 @@ export function convertToTitleCase(input: string): string {
14
13
  .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) // Capitalize each word
15
14
  .join(" "); // Join back into a single string
16
15
  }
17
-
18
- export function pluralizeTimes(resourceName: string, count: number) {
16
+ export function pluralizeTimes(resourceName, count) {
19
17
  if (count > 1) {
20
18
  if (/y$/.test(resourceName)) {
21
- if (resourceName === "Day") return "Days";
19
+ if (resourceName === "Day")
20
+ return "Days";
22
21
  return resourceName.replace(/y$/, "ies");
23
22
  }
24
23
  return resourceName.concat("s");
25
24
  }
26
25
  return resourceName;
27
26
  }
28
-
29
27
  /**
30
28
  * Converts a string from 'camelCase' to 'Title Case'
31
29
  * @param input String to convert to `Title Case`
32
30
  */
33
- export function convertCamelCaseToTitleCase(input: string) {
31
+ export function convertCamelCaseToTitleCase(input) {
34
32
  if (input) {
35
33
  const spacedString = input.replace(/([A-Z])/g, " $1");
36
34
  return spacedString
37
35
  .charAt(0)
38
36
  .toUpperCase()
39
37
  .concat(spacedString.slice(1))
40
- .replace(/\.[a-z]/, (substr: string) => {
41
- return substr.replace(".", " ").toUpperCase();
42
- });
38
+ .replace(/\.[a-z]/, (substr) => {
39
+ return substr.replace(".", " ").toUpperCase();
40
+ });
43
41
  }
44
42
  return input;
45
43
  }
46
-
47
44
  // Display names specific to customer and reseller portal
48
- const OTHER_PORTALS_DISPLAY_NAME: Record<string, string> = {
45
+ const OTHER_PORTALS_DISPLAY_NAME = {
49
46
  "product.displayName": "Product",
50
47
  };
51
-
52
48
  /** Resource Name should ALWAYS be in singular form */
53
49
  export const RESOURCE_NAMES = [
54
50
  "access-token",
@@ -94,72 +90,53 @@ export const RESOURCE_NAMES = [
94
90
  "oidc-configuration",
95
91
  "organization-claim",
96
92
  "reseller-claim",
97
- ] as const;
98
- export type ResourceName = (typeof RESOURCE_NAMES)[number];
99
- export const RESOURCE_DEFINITIONS: Record<ResourceName, string> = {
93
+ ];
94
+ export const RESOURCE_DEFINITIONS = {
100
95
  account: "Your organization account.",
101
96
  product: "Products are the software products you want to license",
102
- license:
103
- "Licenses represent a purchase of your software. These can be linked to customers, and the license key is required to use the product.",
97
+ license: "Licenses represent a purchase of your software. These can be linked to customers, and the license key is required to use the product.",
104
98
  "access-token": "Access Tokens are used to authenticate your API requests.",
105
- activation:
106
- "Activations, also known as devices/machines/seats are the devices consuming licenses.",
107
- "activation-log":
108
- "Activation Log is a log entry of activation/deactivation of a particular license.",
109
- trial:
110
- "Trial/Trial Activation is a device that has activated a trial of your product.",
99
+ activation: "Activations, also known as devices/machines/seats are the devices consuming licenses.",
100
+ "activation-log": "Activation Log is a log entry of activation/deactivation of a particular license.",
101
+ trial: "Trial/Trial Activation is a device that has activated a trial of your product.",
111
102
  "audit-log": "Audit logs contain all the changes made to your account.",
112
- "automated-email":
113
- "Automated Email allow you to send marketing emails based on events on the linked product.",
114
- "automated-email-event-log":
115
- "Automated email event log is the log of all the automated email events for your product.",
103
+ "automated-email": "Automated Email allow you to send marketing emails based on events on the linked product.",
104
+ "automated-email-event-log": "Automated email event log is the log of all the automated email events for your product.",
116
105
  card: "The payment card for your account.",
117
- "feature-flag":
118
- "Feature flags define features that make up tiers for your products.",
106
+ "feature-flag": "Feature flags define features that make up tiers for your products.",
119
107
  invoice: "",
120
- "license-template":
121
- "License templates are a blueprint for the licenses you create for your customers and prevent repetition when creating licenses.",
122
- "maintenance-policy":
123
- "Maintenance policies represent support contracts and can be linked to licenses.",
108
+ "license-template": "License templates are a blueprint for the licenses you create for your customers and prevent repetition when creating licenses.",
109
+ "maintenance-policy": "Maintenance policies represent support contracts and can be linked to licenses.",
124
110
  plan: "",
125
- "product-version":
126
- "Product Versions are sets of Feature Flags that define the tiers of your products.",
111
+ "product-version": "Product Versions are sets of Feature Flags that define the tiers of your products.",
127
112
  "release-channel": "Release channel is the release channel for your product.",
128
113
  "release-file": "Release files are files within your created releases.",
129
- "release-platform":
130
- 'Release Platforms differentiate the target platform for your release. Common platforms include "Windows", "macOS", and "Linux".',
131
- release:
132
- "Releases help you to manage different versions of your app, and secure distribute it to licensed users.",
114
+ "release-platform": 'Release Platforms differentiate the target platform for your release. Common platforms include "Windows", "macOS", and "Linux".',
115
+ release: "Releases help you to manage different versions of your app, and secure distribute it to licensed users.",
133
116
  report: "Analytics data for your account",
134
117
  "role-claim": "",
135
118
  role: "Roles define permissions for your team.",
136
119
  "saml-configuration": "",
137
120
  segment: "Sets of filters that can be saved to filter resources.",
138
- "trial-policy":
139
- "Trial policies are templates for creating trials for your products.",
140
- "webhook-event-log":
141
- "Webhook Event Logs are logs of events that have occured on webhooks.",
121
+ "trial-policy": "Trial policies are templates for creating trials for your products.",
122
+ "webhook-event-log": "Webhook Event Logs are logs of events that have occured on webhooks.",
142
123
  "webhook-trigger": "",
143
- webhook:
144
- "Webhooks are HTTP callbacks which are triggered by specific events.",
124
+ webhook: "Webhooks are HTTP callbacks which are triggered by specific events.",
145
125
  organization: "",
146
126
  profile: "",
147
127
  setting: "",
148
128
  tag: "Tags allow you to manage your licenses and customers on the dashboard.",
149
129
  "team-member": "Team members can access the account based on their roles.",
150
130
  user: "A user refers to your customer whom you want to license your product.",
151
- "sending-domain":
152
- "Allows Cryptlex to send emails on your behalf using your From Email address",
131
+ "sending-domain": "Allows Cryptlex to send emails on your behalf using your From Email address",
153
132
  "admin-role": "Roles that have type admin",
154
133
  "user-group": "Groups of users that you can assign licenses to.",
155
- reseller:
156
- "Resellers allow you to delegate user management to third parties or partners",
134
+ reseller: "Resellers allow you to delegate user management to third parties or partners",
157
135
  "oidc-configuration": "",
158
136
  "organization-claim": "",
159
137
  "reseller-claim": "",
160
138
  };
161
-
162
- const RESOURCE_DISPLAY_NAMES: Record<string, string> = {
139
+ const RESOURCE_DISPLAY_NAMES = {
163
140
  id: "ID",
164
141
  createdAt: "Creation Date",
165
142
  scopes: "Permissions",
@@ -211,35 +188,25 @@ const RESOURCE_DISPLAY_NAMES: Record<string, string> = {
211
188
  "reseller.name": "Reseller",
212
189
  sendingDomain: "Email Sending Domain",
213
190
  };
214
-
215
- function getResourceDisplayName(
216
- resourceName: string,
217
- portal: CtxPortals,
218
- ) {
191
+ function getResourceDisplayName(resourceName, portal) {
219
192
  if (portal !== "admin-portal" && resourceName in OTHER_PORTALS_DISPLAY_NAME) {
220
193
  return OTHER_PORTALS_DISPLAY_NAME[resourceName];
221
- } else if (resourceName in RESOURCE_DISPLAY_NAMES) {
194
+ }
195
+ else if (resourceName in RESOURCE_DISPLAY_NAMES) {
222
196
  return RESOURCE_DISPLAY_NAMES[resourceName];
223
- } else {
197
+ }
198
+ else {
224
199
  return convertCamelCaseToTitleCase(resourceName);
225
200
  }
226
201
  }
227
-
228
- const ProjectContext = createContext<CtxPortals>('admin-portal');
229
-
230
- export function ProjectProvider({ projectName, children }: { projectName: CtxPortals; children: React.ReactNode; }) {
231
- return (
232
- <ProjectContext.Provider value={projectName}>
233
- {children}
234
- </ProjectContext.Provider>
235
- );
202
+ const ProjectContext = createContext('admin-portal');
203
+ export function ProjectProvider({ projectName, children }) {
204
+ return (_jsx(ProjectContext.Provider, { value: projectName, children: children }));
236
205
  }
237
-
238
- export function useProjectName(): CtxPortals {
206
+ export function useProjectName() {
239
207
  return use(ProjectContext);
240
208
  }
241
-
242
- export function useResourceFormatter(): (resourceName: string) => string {
209
+ export function useResourceFormatter() {
243
210
  const portal = useProjectName();
244
- return (resourceName: string) => getResourceDisplayName(resourceName, portal);
245
- }
211
+ return (resourceName) => getResourceDisplayName(resourceName, portal);
212
+ }
@@ -0,0 +1 @@
1
+ export declare function useIsMobile(): boolean;
@@ -0,0 +1,15 @@
1
+ import { useEffect, useState } from "react";
2
+ const MOBILE_BREAKPOINT = 768;
3
+ export function useIsMobile() {
4
+ const [isMobile, setIsMobile] = useState(undefined);
5
+ useEffect(() => {
6
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
7
+ const onChange = () => {
8
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
9
+ };
10
+ mql.addEventListener("change", onChange);
11
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
12
+ return () => mql.removeEventListener("change", onChange);
13
+ }, []);
14
+ return !!isMobile;
15
+ }
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@cryptlex/web-components",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "React component library for Cryptlex web applications",
5
5
  "author": "Cryptlex",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "exports": {
9
9
  "./components/*": {
10
- "import": "./lib/components/*"
10
+ "import": "./dist/components/*"
11
11
  },
12
12
  "./utils/*": {
13
- "import": "./lib/utils/*"
13
+ "import": "./dist/utils/*"
14
14
  },
15
15
  "./index.css": "./lib/index.css",
16
16
  "./tokens.css": "./lib/tokens.css",
@@ -19,7 +19,12 @@
19
19
  "./utilities.css": "./lib/utilities.css"
20
20
  },
21
21
  "files": [
22
- "lib"
22
+ "dist",
23
+ "./lib/index.css",
24
+ "./lib/tokens.css",
25
+ "./lib/theme.css",
26
+ "./lib/base.css",
27
+ "./lib/utilities.css"
23
28
  ],
24
29
  "repository": {
25
30
  "type": "git",
@@ -80,7 +85,7 @@
80
85
  "zod": "3.25.20"
81
86
  },
82
87
  "scripts": {
83
- "build": "tsc",
88
+ "build": "tsc --project tsconfig.build.json",
84
89
  "lint": "eslint .",
85
90
  "storybook": "storybook dev -p 6006 --no-open",
86
91
  "build:storybook": "storybook build",