@cryptlex/web-components 6.4.5 → 6.5.0-alpha01

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 (91) hide show
  1. package/dist/components/alert.js +1 -1
  2. package/dist/components/alert.js.map +1 -1
  3. package/dist/components/avatar.js +1 -1
  4. package/dist/components/avatar.js.map +1 -1
  5. package/dist/components/badge.js +1 -1
  6. package/dist/components/badge.js.map +1 -1
  7. package/dist/components/breadcrumbs.js +1 -1
  8. package/dist/components/breadcrumbs.js.map +1 -1
  9. package/dist/components/button.js +1 -1
  10. package/dist/components/button.js.map +1 -1
  11. package/dist/components/calendar.js +1 -1
  12. package/dist/components/calendar.js.map +1 -1
  13. package/dist/components/card.js +1 -1
  14. package/dist/components/card.js.map +1 -1
  15. package/dist/components/checkbox.d.ts +1 -1
  16. package/dist/components/checkbox.js +1 -1
  17. package/dist/components/checkbox.js.map +1 -1
  18. package/dist/components/data-table-commons.d.ts +16 -22
  19. package/dist/components/data-table-commons.js +1 -1
  20. package/dist/components/data-table-commons.js.map +1 -1
  21. package/dist/components/data-table-filter.d.ts +21 -4
  22. package/dist/components/data-table-filter.js +1 -1
  23. package/dist/components/data-table.d.ts +39 -28
  24. package/dist/components/data-table.js +1 -1
  25. package/dist/components/data-table.js.map +1 -1
  26. package/dist/components/date-picker.d.ts +1 -1
  27. package/dist/components/date-picker.js +1 -1
  28. package/dist/components/date-picker.js.map +1 -1
  29. package/dist/components/datefield.js +1 -1
  30. package/dist/components/datefield.js.map +1 -1
  31. package/dist/components/dialog.js +1 -1
  32. package/dist/components/dialog.js.map +1 -1
  33. package/dist/components/disclosure.d.ts +1 -1
  34. package/dist/components/disclosure.js +1 -1
  35. package/dist/components/disclosure.js.map +1 -1
  36. package/dist/components/field.js +1 -1
  37. package/dist/components/field.js.map +1 -1
  38. package/dist/components/id-search.js +1 -1
  39. package/dist/components/id-search.js.map +1 -1
  40. package/dist/components/input-otp.js +1 -1
  41. package/dist/components/input-otp.js.map +1 -1
  42. package/dist/components/key-value-card.js +1 -1
  43. package/dist/components/key-value-card.js.map +1 -1
  44. package/dist/components/list-box.js +1 -1
  45. package/dist/components/list-box.js.map +1 -1
  46. package/dist/components/loader.js +1 -1
  47. package/dist/components/loader.js.map +1 -1
  48. package/dist/components/menu.js +1 -1
  49. package/dist/components/menu.js.map +1 -1
  50. package/dist/components/multi-select.d.ts +3 -3
  51. package/dist/components/multi-select.js +1 -1
  52. package/dist/components/multi-select.js.map +1 -1
  53. package/dist/components/numberfield.js +1 -1
  54. package/dist/components/numberfield.js.map +1 -1
  55. package/dist/components/popover.js +1 -1
  56. package/dist/components/popover.js.map +1 -1
  57. package/dist/components/searchfield.js +1 -1
  58. package/dist/components/searchfield.js.map +1 -1
  59. package/dist/components/select.d.ts +2 -2
  60. package/dist/components/select.js +1 -1
  61. package/dist/components/select.js.map +1 -1
  62. package/dist/components/sidebar.d.ts +2 -2
  63. package/dist/components/sidebar.js +1 -1
  64. package/dist/components/sidebar.js.map +1 -1
  65. package/dist/components/skeleton.js +1 -1
  66. package/dist/components/skeleton.js.map +1 -1
  67. package/dist/components/table-of-contents.d.ts +2 -2
  68. package/dist/components/table-of-contents.js +1 -1
  69. package/dist/components/table-of-contents.js.map +1 -1
  70. package/dist/components/table.js +1 -1
  71. package/dist/components/table.js.map +1 -1
  72. package/dist/components/tabs.js +1 -1
  73. package/dist/components/tabs.js.map +1 -1
  74. package/dist/components/textfield.js +1 -1
  75. package/dist/components/textfield.js.map +1 -1
  76. package/dist/components/timeline.js +1 -1
  77. package/dist/components/timeline.js.map +1 -1
  78. package/dist/components/tooltip.js +1 -1
  79. package/dist/components/tooltip.js.map +1 -1
  80. package/dist/utils/form-hook.d.ts +6 -6
  81. package/dist/utils/form-hook.js +1 -1
  82. package/dist/utils/form-hook.js.map +1 -1
  83. package/dist/utils/form-utils.js +1 -1
  84. package/dist/utils/form-utils.js.map +1 -1
  85. package/dist/utils/primitives.d.ts +1 -8
  86. package/dist/utils/primitives.js +1 -1
  87. package/dist/utils/primitives.js.map +1 -1
  88. package/dist/utils/resource-names.d.ts +1 -1
  89. package/dist/utils/resource-names.js +1 -1
  90. package/dist/utils/resource-names.js.map +1 -1
  91. package/package.json +2 -1
@@ -1,2 +1,2 @@
1
- import{jsxs as d,jsx as t}from"react/jsx-runtime";import{cva as i}from"class-variance-authority";import{classNames as c}from"../utils/primitives.js";import"clsx";const u=i("transition-colors border border-dotted p-2 text-foreground body inline-flex items-start gap-2",{variants:{variant:{destructive:"bg-destructive-foreground/20 text-destructive border-destructive",success:"bg-success-foreground/20 text-success border-success",muted:"bg-muted-foreground/20 text-muted border-muted"}},defaultVariants:{variant:"muted"}});function b({children:r,className:s,variant:o,icon:e,...a}){return d("div",{role:"alert",className:c(u({variant:o}),s),...a,children:[e&&t(e,{className:"size-icon mt-1"}),t("span",{className:"w-full",children:r})]})}export{b as Alert,u as alertVariants};
1
+ import{jsxs as i,jsx as t}from"react/jsx-runtime";import{cva as d}from"class-variance-authority";import{classNames as c}from"../utils/primitives.js";import"clsx";import"lodash-es";const u=d("transition-colors border border-dotted p-2 text-foreground body inline-flex items-start gap-2",{variants:{variant:{destructive:"bg-destructive-foreground/20 text-destructive border-destructive",success:"bg-success-foreground/20 text-success border-success",muted:"bg-muted-foreground/20 text-muted border-muted"}},defaultVariants:{variant:"muted"}});function p({children:r,className:s,variant:o,icon:e,...a}){return i("div",{role:"alert",className:c(u({variant:o}),s),...a,children:[e&&t(e,{className:"size-icon mt-1"}),t("span",{className:"w-full",children:r})]})}export{p as Alert,u as alertVariants};
2
2
  //# sourceMappingURL=alert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","sources":["../../lib/components/alert.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { classNames } from 'lib/utils/primitives';\nimport { type LucideIcon } from 'lucide-react';\n\nexport const alertVariants = cva(\n `transition-colors border border-dotted p-2 text-foreground body inline-flex items-start gap-2`,\n {\n variants: {\n variant: {\n destructive: 'bg-destructive-foreground/20 text-destructive border-destructive',\n success: 'bg-success-foreground/20 text-success border-success',\n muted: 'bg-muted-foreground/20 text-muted border-muted',\n },\n },\n defaultVariants: {\n variant: 'muted',\n },\n }\n);\n\nexport function Alert({\n children,\n className,\n variant,\n icon: Icon,\n ...props\n}: React.ComponentProps<'div'> &\n VariantProps<typeof alertVariants> & {\n icon?: LucideIcon;\n }) {\n return (\n <div role=\"alert\" className={classNames(alertVariants({ variant }), className)} {...props}>\n {Icon && <Icon className=\"size-icon mt-1\" />}\n <span className=\"w-full\">{children}</span>\n </div>\n );\n}\n"],"names":["alertVariants","cva","Alert","children","className","variant","Icon","props","jsxs","classNames","jsx"],"mappings":"kKAIO,MAAMA,EAAgBC,EACzB,gGACA,CACI,SAAU,CACN,QAAS,CACL,YAAa,mEACb,QAAS,uDACT,MAAO,gDAAA,CACX,EAEJ,gBAAiB,CACb,QAAS,OAAA,CACb,CAER,EAEO,SAASC,EAAM,CAClB,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,KAAMC,EACN,GAAGC,CACP,EAGO,CACH,OACIC,EAAC,MAAA,CAAI,KAAK,QAAQ,UAAWC,EAAWT,EAAc,CAAE,QAAAK,CAAA,CAAS,EAAGD,CAAS,EAAI,GAAGG,EAC/E,SAAA,CAAAD,GAAQI,EAACJ,EAAA,CAAK,UAAU,gBAAA,CAAiB,EAC1CI,EAAC,OAAA,CAAK,UAAU,SAAU,SAAAP,CAAA,CAAS,CAAA,EACvC,CAER"}
1
+ {"version":3,"file":"alert.js","sources":["../../lib/components/alert.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { type LucideIcon } from 'lucide-react';\nimport { classNames } from '../utils/primitives';\n\nexport const alertVariants = cva(\n `transition-colors border border-dotted p-2 text-foreground body inline-flex items-start gap-2`,\n {\n variants: {\n variant: {\n destructive: 'bg-destructive-foreground/20 text-destructive border-destructive',\n success: 'bg-success-foreground/20 text-success border-success',\n muted: 'bg-muted-foreground/20 text-muted border-muted',\n },\n },\n defaultVariants: {\n variant: 'muted',\n },\n }\n);\n\nexport function Alert({\n children,\n className,\n variant,\n icon: Icon,\n ...props\n}: React.ComponentProps<'div'> &\n VariantProps<typeof alertVariants> & {\n icon?: LucideIcon;\n }) {\n return (\n <div role=\"alert\" className={classNames(alertVariants({ variant }), className)} {...props}>\n {Icon && <Icon className=\"size-icon mt-1\" />}\n <span className=\"w-full\">{children}</span>\n </div>\n );\n}\n"],"names":["alertVariants","cva","Alert","children","className","variant","Icon","props","jsxs","classNames","jsx"],"mappings":"oLAIO,MAAMA,EAAgBC,EACzB,gGACA,CACI,SAAU,CACN,QAAS,CACL,YAAa,mEACb,QAAS,uDACT,MAAO,gDAAA,CACX,EAEJ,gBAAiB,CACb,QAAS,OAAA,CACb,CAER,EAEO,SAASC,EAAM,CAClB,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,KAAMC,EACN,GAAGC,CACP,EAGO,CACH,OACIC,EAAC,MAAA,CAAI,KAAK,QAAQ,UAAWC,EAAWT,EAAc,CAAE,QAAAK,CAAA,CAAS,EAAGD,CAAS,EAAI,GAAGG,EAC/E,SAAA,CAAAD,GAAQI,EAACJ,EAAA,CAAK,UAAU,gBAAA,CAAiB,EAC1CI,EAAC,OAAA,CAAK,UAAU,SAAU,SAAAP,CAAA,CAAS,CAAA,EACvC,CAER"}
@@ -1,2 +1,2 @@
1
- import{jsx as t}from"react/jsx-runtime";import{classNames as r}from"../utils/primitives.js";import"clsx";function l({className:e,initials:n,...o}){return t("div",{className:r("relative body-sm font-mono font-bold flex items-center leading-none justify-center bg-accent text-accent-foreground select-none size-input shrink-0 overflow-hidden rounded-full",e),...o,children:n})}export{l as Avatar};
1
+ import{jsx as t}from"react/jsx-runtime";import{classNames as r}from"../utils/primitives.js";import"clsx";import"lodash-es";function m({className:e,initials:n,...o}){return t("div",{className:r("relative body-sm font-mono font-bold flex items-center leading-none justify-center bg-accent text-accent-foreground select-none size-input shrink-0 overflow-hidden rounded-full",e),...o,children:n})}export{m as Avatar};
2
2
  //# sourceMappingURL=avatar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.js","sources":["../../lib/components/avatar.tsx"],"sourcesContent":["import { classNames } from 'lib/utils/primitives';\n\ninterface InitialString {\n initials: string[2];\n}\nexport interface AvatarProps extends Omit<React.ComponentProps<'div'>, 'children'>, InitialString { }\nexport function Avatar({ className, initials, ...props }: AvatarProps) {\n return (\n <div\n className={classNames(\n 'relative body-sm font-mono font-bold flex items-center leading-none justify-center bg-accent text-accent-foreground select-none size-input shrink-0 overflow-hidden rounded-full',\n className\n )}\n {...props}\n >\n {initials}\n </div>\n );\n}\n"],"names":["Avatar","className","initials","props","jsx","classNames"],"mappings":"yGAMO,SAASA,EAAO,CAAE,UAAAC,EAAW,SAAAC,EAAU,GAAGC,GAAsB,CACnE,OACIC,EAAC,MAAA,CACG,UAAWC,EACP,mLACAJ,CAAA,EAEH,GAAGE,EAEH,SAAAD,CAAA,CAAA,CAGb"}
1
+ {"version":3,"file":"avatar.js","sources":["../../lib/components/avatar.tsx"],"sourcesContent":["import { classNames } from '../utils/primitives';\n\ninterface InitialString {\n initials: string[2];\n}\nexport interface AvatarProps extends Omit<React.ComponentProps<'div'>, 'children'>, InitialString {}\nexport function Avatar({ className, initials, ...props }: AvatarProps) {\n return (\n <div\n className={classNames(\n 'relative body-sm font-mono font-bold flex items-center leading-none justify-center bg-accent text-accent-foreground select-none size-input shrink-0 overflow-hidden rounded-full',\n className\n )}\n {...props}\n >\n {initials}\n </div>\n );\n}\n"],"names":["Avatar","className","initials","props","jsx","classNames"],"mappings":"2HAMO,SAASA,EAAO,CAAE,UAAAC,EAAW,SAAAC,EAAU,GAAGC,GAAsB,CACnE,OACIC,EAAC,MAAA,CACG,UAAWC,EACP,mLACAJ,CAAA,EAEH,GAAGE,EAEH,SAAAD,CAAA,CAAA,CAGb"}
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import{classNames as i}from"../utils/primitives.js";import"clsx";function m({className:n,children:o,...r}){return e("span",{className:i("text-muted leading-none body-sm px-1 inline-flex items-center justify-center select-none bg-popover border h-input focus:outline-hidden focus:ring-1 focus:ring-ring",n),...r,children:e("span",{children:o})})}export{m as Badge};
1
+ import{jsx as e}from"react/jsx-runtime";import{classNames as i}from"../utils/primitives.js";import"clsx";import"lodash-es";function c({className:n,children:o,...r}){return e("span",{className:i("text-muted leading-none body-sm px-1 inline-flex items-center justify-center select-none bg-popover border h-input focus:outline-hidden focus:ring-1 focus:ring-ring",n),...r,children:e("span",{children:o})})}export{c as Badge};
2
2
  //# sourceMappingURL=badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"badge.js","sources":["../../lib/components/badge.tsx"],"sourcesContent":["import { classNames } from 'lib/utils/primitives';\n\nexport function Badge({ className, children, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n className={classNames(\n 'text-muted leading-none body-sm px-1 inline-flex items-center justify-center select-none bg-popover border h-input focus:outline-hidden focus:ring-1 focus:ring-ring',\n className\n )}\n {...props}\n >\n {/* Contents */}\n <span>{children}</span>\n </span>\n );\n}\n"],"names":["Badge","className","children","props","jsx","classNames"],"mappings":"yGAEO,SAASA,EAAM,CAAE,UAAAC,EAAW,SAAAC,EAAU,GAAGC,GAAuC,CACnF,OACIC,EAAC,OAAA,CACG,UAAWC,EACP,uKACAJ,CAAA,EAEH,GAAGE,EAGJ,SAAAC,EAAC,QAAM,SAAAF,CAAA,CAAS,CAAA,CAAA,CAG5B"}
1
+ {"version":3,"file":"badge.js","sources":["../../lib/components/badge.tsx"],"sourcesContent":["import { classNames } from '../utils/primitives';\n\nexport function Badge({ className, children, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n className={classNames(\n 'text-muted leading-none body-sm px-1 inline-flex items-center justify-center select-none bg-popover border h-input focus:outline-hidden focus:ring-1 focus:ring-ring',\n className\n )}\n {...props}\n >\n {/* Contents */}\n <span>{children}</span>\n </span>\n );\n}\n"],"names":["Badge","className","children","props","jsx","classNames"],"mappings":"2HAEO,SAASA,EAAM,CAAE,UAAAC,EAAW,SAAAC,EAAU,GAAGC,GAAuC,CACnF,OACIC,EAAC,OAAA,CACG,UAAWC,EACP,uKACAJ,CAAA,EAEH,GAAGE,EAGJ,SAAAC,EAAC,QAAM,SAAAF,CAAA,CAAS,CAAA,CAAA,CAG5B"}
@@ -1,2 +1,2 @@
1
- import{jsx as a,jsxs as i}from"react/jsx-runtime";import{Breadcrumbs as c,Breadcrumb as m,Link as s,composeRenderProps as o}from"react-aria-components";import{classNames as t}from"../utils/primitives.js";import{ChevronRight as d,DotSquare as u}from"lucide-react";import"clsx";function x({className:e,...r}){return a(c,{className:t("flex flex-wrap items-center gap-1.5 break-words body-sm text-muted-foreground sm:gap-2.5",e),...r})}function B({className:e,...r}){return a(m,{className:t("inline-flex items-center gap-1.5 sm:gap-2.5",e),...r})}function N({className:e,...r}){return a(s,{className:o(e,n=>t("transition-colors","data-[hovered]:text-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","data-[current]:pointer-events-auto data-[current]:opacity-100",n)),...r})}function h({children:e,className:r,...n}){return a("span",{role:"presentation","aria-hidden":"true",className:t("[&>svg]:size-3.5",r),...n,children:e||a(d,{})})}function v({className:e,...r}){return i("span",{role:"presentation","aria-hidden":"true",className:t("flex size-9 items-center justify-center",e),...r,children:[a(u,{className:"size-4"}),a("span",{className:"sr-only",children:"More"})]})}function y({className:e,...r}){return a(s,{className:o(e,n=>t("font-normal text-foreground",n)),...r})}export{v as BreadcrumbEllipsis,B as BreadcrumbItem,N as BreadcrumbLink,y as BreadcrumbPage,h as BreadcrumbSeparator,x as Breadcrumbs};
1
+ import{jsx as a,jsxs as i}from"react/jsx-runtime";import{Breadcrumbs as c,Breadcrumb as m,Link as s,composeRenderProps as o}from"react-aria-components";import{ChevronRight as d,DotSquare as u}from"lucide-react";import{classNames as t}from"../utils/primitives.js";import"clsx";import"lodash-es";function B({className:e,...r}){return a(c,{className:t("flex flex-wrap items-center gap-1.5 break-words body-sm text-muted-foreground sm:gap-2.5",e),...r})}function N({className:e,...r}){return a(m,{className:t("inline-flex items-center gap-1.5 sm:gap-2.5",e),...r})}function h({className:e,...r}){return a(s,{className:o(e,n=>t("transition-colors","data-[hovered]:text-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","data-[current]:pointer-events-auto data-[current]:opacity-100",n)),...r})}function v({children:e,className:r,...n}){return a("span",{role:"presentation","aria-hidden":"true",className:t("[&>svg]:size-icon",r),...n,children:e||a(d,{})})}function y({className:e,...r}){return i("span",{role:"presentation","aria-hidden":"true",className:t("flex size-input items-center justify-center",e),...r,children:[a(u,{className:"size-icon"}),a("span",{className:"sr-only",children:"More"})]})}function j({className:e,...r}){return a(s,{className:o(e,n=>t("font-normal text-foreground",n)),...r})}export{y as BreadcrumbEllipsis,N as BreadcrumbItem,h as BreadcrumbLink,j as BreadcrumbPage,v as BreadcrumbSeparator,B as Breadcrumbs};
2
2
  //# sourceMappingURL=breadcrumbs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumbs.js","sources":["../../lib/components/breadcrumbs.tsx"],"sourcesContent":["import {\n Breadcrumb as AriaBreadcrumb,\n BreadcrumbProps as AriaBreadcrumbProps,\n Breadcrumbs as AriaBreadcrumbs,\n BreadcrumbsProps as AriaBreadcrumbsProps,\n Link as AriaLink,\n LinkProps as AriaLinkProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nimport { classNames } from 'lib/utils/primitives';\nimport { ChevronRight, DotSquare } from 'lucide-react';\n\nexport function Breadcrumbs<T extends object>({ className, ...props }: AriaBreadcrumbsProps<T>) {\n return (\n <AriaBreadcrumbs\n className={classNames(\n 'flex flex-wrap items-center gap-1.5 break-words body-sm text-muted-foreground sm:gap-2.5',\n className\n )}\n {...props}\n />\n );\n}\n\nexport function BreadcrumbItem({ className, ...props }: AriaBreadcrumbProps) {\n return (\n <AriaBreadcrumb className={classNames('inline-flex items-center gap-1.5 sm:gap-2.5', className)} {...props} />\n );\n}\n\nexport function BreadcrumbLink({ className, ...props }: AriaLinkProps) {\n return (\n <AriaLink\n className={composeRenderProps(className, className =>\n classNames(\n 'transition-colors',\n /* Hover */\n 'data-[hovered]:text-foreground',\n /* Disabled */\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n /* Current */\n 'data-[current]:pointer-events-auto data-[current]:opacity-100',\n className\n )\n )}\n {...props}\n />\n );\n}\n\nexport function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span role=\"presentation\" aria-hidden=\"true\" className={classNames('[&>svg]:size-3.5', className)} {...props}>\n {children || <ChevronRight />}\n </span>\n );\n}\n\nexport function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n role=\"presentation\"\n aria-hidden=\"true\"\n className={classNames('flex size-9 items-center justify-center', className)}\n {...props}\n >\n <DotSquare className=\"size-4\" />\n <span className=\"sr-only\">More</span>\n </span>\n );\n}\n\ninterface BreadcrumbPageProps extends Omit<AriaLinkProps, 'href'> { }\n\nexport function BreadcrumbPage({ className, ...props }: BreadcrumbPageProps) {\n return (\n <AriaLink\n className={composeRenderProps(className, className => classNames('font-normal text-foreground', className))}\n {...props}\n />\n );\n}\n"],"names":["Breadcrumbs","className","props","jsx","AriaBreadcrumbs","classNames","BreadcrumbItem","AriaBreadcrumb","BreadcrumbLink","AriaLink","composeRenderProps","BreadcrumbSeparator","children","ChevronRight","BreadcrumbEllipsis","jsxs","DotSquare","BreadcrumbPage"],"mappings":"oRAaO,SAASA,EAA8B,CAAE,UAAAC,EAAW,GAAGC,GAAkC,CAC5F,OACIC,EAACC,EAAA,CACG,UAAWC,EACP,2FACAJ,CAAA,EAEH,GAAGC,CAAA,CAAA,CAGhB,CAEO,SAASI,EAAe,CAAE,UAAAL,EAAW,GAAGC,GAA8B,CACzE,OACIC,EAACI,GAAe,UAAWF,EAAW,8CAA+CJ,CAAS,EAAI,GAAGC,EAAO,CAEpH,CAEO,SAASM,EAAe,CAAE,UAAAP,EAAW,GAAGC,GAAwB,CACnE,OACIC,EAACM,EAAA,CACG,UAAWC,EAAmBT,EAAWA,GACrCI,EACI,oBAEA,iCAEA,iEAEA,gEACAJ,CAAA,CACJ,EAEH,GAAGC,CAAA,CAAA,CAGhB,CAEO,SAASS,EAAoB,CAAE,SAAAC,EAAU,UAAAX,EAAW,GAAGC,GAAuC,CACjG,SACK,OAAA,CAAK,KAAK,eAAe,cAAY,OAAO,UAAWG,EAAW,mBAAoBJ,CAAS,EAAI,GAAGC,EAClG,SAAAU,GAAYT,EAACU,IAAa,EAC/B,CAER,CAEO,SAASC,EAAmB,CAAE,UAAAb,EAAW,GAAGC,GAAuC,CACtF,OACIa,EAAC,OAAA,CACG,KAAK,eACL,cAAY,OACZ,UAAWV,EAAW,0CAA2CJ,CAAS,EACzE,GAAGC,EAEJ,SAAA,CAAAC,EAACa,EAAA,CAAU,UAAU,QAAA,CAAS,EAC9Bb,EAAC,OAAA,CAAK,UAAU,UAAU,SAAA,MAAA,CAAI,CAAA,CAAA,CAAA,CAG1C,CAIO,SAASc,EAAe,CAAE,UAAAhB,EAAW,GAAGC,GAA8B,CACzE,OACIC,EAACM,EAAA,CACG,UAAWC,EAAmBT,EAAWA,GAAaI,EAAW,8BAA+BJ,CAAS,CAAC,EACzG,GAAGC,CAAA,CAAA,CAGhB"}
1
+ {"version":3,"file":"breadcrumbs.js","sources":["../../lib/components/breadcrumbs.tsx"],"sourcesContent":["import {\n Breadcrumb as AriaBreadcrumb,\n BreadcrumbProps as AriaBreadcrumbProps,\n Breadcrumbs as AriaBreadcrumbs,\n BreadcrumbsProps as AriaBreadcrumbsProps,\n Link as AriaLink,\n LinkProps as AriaLinkProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nimport { ChevronRight, DotSquare } from 'lucide-react';\nimport { classNames } from '../utils/primitives';\n\nexport function Breadcrumbs<T extends object>({ className, ...props }: AriaBreadcrumbsProps<T>) {\n return (\n <AriaBreadcrumbs\n className={classNames(\n 'flex flex-wrap items-center gap-1.5 break-words body-sm text-muted-foreground sm:gap-2.5',\n className\n )}\n {...props}\n />\n );\n}\n\nexport function BreadcrumbItem({ className, ...props }: AriaBreadcrumbProps) {\n return (\n <AriaBreadcrumb className={classNames('inline-flex items-center gap-1.5 sm:gap-2.5', className)} {...props} />\n );\n}\n\nexport function BreadcrumbLink({ className, ...props }: AriaLinkProps) {\n return (\n <AriaLink\n className={composeRenderProps(className, className =>\n classNames(\n 'transition-colors',\n /* Hover */\n 'data-[hovered]:text-foreground',\n /* Disabled */\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n /* Current */\n 'data-[current]:pointer-events-auto data-[current]:opacity-100',\n className\n )\n )}\n {...props}\n />\n );\n}\n\nexport function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span role=\"presentation\" aria-hidden=\"true\" className={classNames('[&>svg]:size-icon', className)} {...props}>\n {children || <ChevronRight />}\n </span>\n );\n}\n\nexport function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n role=\"presentation\"\n aria-hidden=\"true\"\n className={classNames('flex size-input items-center justify-center', className)}\n {...props}\n >\n <DotSquare className=\"size-icon\" />\n <span className=\"sr-only\">More</span>\n </span>\n );\n}\n\ninterface BreadcrumbPageProps extends Omit<AriaLinkProps, 'href'> {}\n\nexport function BreadcrumbPage({ className, ...props }: BreadcrumbPageProps) {\n return (\n <AriaLink\n className={composeRenderProps(className, className => classNames('font-normal text-foreground', className))}\n {...props}\n />\n );\n}\n"],"names":["Breadcrumbs","className","props","jsx","AriaBreadcrumbs","classNames","BreadcrumbItem","AriaBreadcrumb","BreadcrumbLink","AriaLink","composeRenderProps","BreadcrumbSeparator","children","ChevronRight","BreadcrumbEllipsis","jsxs","DotSquare","BreadcrumbPage"],"mappings":"sSAaO,SAASA,EAA8B,CAAE,UAAAC,EAAW,GAAGC,GAAkC,CAC5F,OACIC,EAACC,EAAA,CACG,UAAWC,EACP,2FACAJ,CAAA,EAEH,GAAGC,CAAA,CAAA,CAGhB,CAEO,SAASI,EAAe,CAAE,UAAAL,EAAW,GAAGC,GAA8B,CACzE,OACIC,EAACI,GAAe,UAAWF,EAAW,8CAA+CJ,CAAS,EAAI,GAAGC,EAAO,CAEpH,CAEO,SAASM,EAAe,CAAE,UAAAP,EAAW,GAAGC,GAAwB,CACnE,OACIC,EAACM,EAAA,CACG,UAAWC,EAAmBT,EAAWA,GACrCI,EACI,oBAEA,iCAEA,iEAEA,gEACAJ,CAAA,CACJ,EAEH,GAAGC,CAAA,CAAA,CAGhB,CAEO,SAASS,EAAoB,CAAE,SAAAC,EAAU,UAAAX,EAAW,GAAGC,GAAuC,CACjG,SACK,OAAA,CAAK,KAAK,eAAe,cAAY,OAAO,UAAWG,EAAW,oBAAqBJ,CAAS,EAAI,GAAGC,EACnG,SAAAU,GAAYT,EAACU,IAAa,EAC/B,CAER,CAEO,SAASC,EAAmB,CAAE,UAAAb,EAAW,GAAGC,GAAuC,CACtF,OACIa,EAAC,OAAA,CACG,KAAK,eACL,cAAY,OACZ,UAAWV,EAAW,8CAA+CJ,CAAS,EAC7E,GAAGC,EAEJ,SAAA,CAAAC,EAACa,EAAA,CAAU,UAAU,WAAA,CAAY,EACjCb,EAAC,OAAA,CAAK,UAAU,UAAU,SAAA,MAAA,CAAI,CAAA,CAAA,CAAA,CAG1C,CAIO,SAASc,EAAe,CAAE,UAAAhB,EAAW,GAAGC,GAA8B,CACzE,OACIC,EAACM,EAAA,CACG,UAAWC,EAAmBT,EAAWA,GAAaI,EAAW,8BAA+BJ,CAAS,CAAC,EACzG,GAAGC,CAAA,CAAA,CAGhB"}
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as r,jsxs as c,Fragment as o}from"react/jsx-runtime";import{cva as p}from"class-variance-authority";import{classNames as l}from"../utils/primitives.js";import{Button as d,composeRenderProps as a}from"react-aria-components";import{Loader as f}from"./loader.js";import"clsx";import"lucide-react";const v=p("btn",{variants:{variant:{primary:"btn-primary",secondary:"btn-secondary",destructive:"btn-destructive",neutral:"btn-neutral",ghost:"btn-ghost",link:"text-primary underline-offset-4 hover:underline"},size:{default:"input-dim",icon:"size-input",none:""}},defaultVariants:{variant:"neutral",size:"default"}});function j({className:e,variant:i,size:s,children:m,isPending:n,active:b,...u}){return r(d,{...u,className:a(e,t=>l(v({variant:i,size:s,className:t}),e)),children:a(m,t=>c(o,{children:[n&&r(f,{}),!n&&r(o,{children:t})]}))})}export{j as Button,v as buttonVariants};
1
+ "use client";import{jsx as r,jsxs as c,Fragment as o}from"react/jsx-runtime";import{cva as p}from"class-variance-authority";import{Button as l,composeRenderProps as i}from"react-aria-components";import{classNames as d}from"../utils/primitives.js";import{Loader as f}from"./loader.js";import"clsx";import"lodash-es";import"lucide-react";const v=p("btn",{variants:{variant:{primary:"btn-primary",secondary:"btn-secondary",destructive:"btn-destructive",neutral:"btn-neutral",ghost:"btn-ghost",link:"text-primary underline-offset-4 hover:underline"},size:{default:"input-dim",icon:"size-input",none:""}},defaultVariants:{variant:"neutral",size:"default"}});function V({className:e,variant:a,size:s,children:m,isPending:n,active:b,...u}){return r(l,{...u,className:i(e,t=>d(v({variant:a,size:s,className:t}),e)),children:i(m,t=>c(o,{children:[n&&r(f,{}),!n&&r(o,{children:t})]}))})}export{V as Button,v as buttonVariants};
2
2
  //# sourceMappingURL=button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sources":["../../lib/components/button.tsx"],"sourcesContent":["'use client';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { classNames } from 'lib/utils/primitives';\nimport { Button as AriaButton, composeRenderProps, type ButtonProps as AriaButtonProps } from 'react-aria-components';\nimport { Loader } from './loader';\n\nexport const buttonVariants = cva('btn', {\n variants: {\n variant: {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n destructive: 'btn-destructive',\n neutral: 'btn-neutral',\n ghost: 'btn-ghost',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n default: 'input-dim',\n icon: 'size-input',\n none: '',\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'default',\n },\n});\n\nexport type ButtonProps = AriaButtonProps &\n VariantProps<typeof buttonVariants> & {\n ref?: React.Ref<HTMLButtonElement>;\n active?: boolean;\n };\n\nexport function Button({\n className: additionalClasses,\n variant,\n size,\n children,\n isPending,\n active,\n ...props\n}: ButtonProps) {\n return (\n <AriaButton\n {...props}\n className={composeRenderProps(additionalClasses, className =>\n classNames(\n buttonVariants({\n variant,\n size,\n className,\n }),\n additionalClasses\n )\n )}\n >\n {composeRenderProps(children, children => (\n <>\n {isPending && <Loader />}\n {!isPending && (\n <>\n {children}\n {/* TODO active indication */}\n </>\n )}\n </>\n ))}\n </AriaButton>\n );\n}\n"],"names":["buttonVariants","cva","Button","additionalClasses","variant","size","children","isPending","active","props","jsx","AriaButton","composeRenderProps","className","classNames","jsxs","Fragment","Loader"],"mappings":"8TAMO,MAAMA,EAAiBC,EAAI,MAAO,CACrC,SAAU,CACN,QAAS,CACL,QAAS,cACT,UAAW,gBACX,YAAa,kBACb,QAAS,cACT,MAAO,YACP,KAAM,iDAAA,EAEV,KAAM,CACF,QAAS,YACT,KAAM,aACN,KAAM,EAAA,CACV,EAEJ,gBAAiB,CACb,QAAS,UACT,KAAM,SAAA,CAEd,CAAC,EAQM,SAASC,EAAO,CACnB,UAAWC,EACX,QAAAC,EACA,KAAAC,EACA,SAAAC,EACA,UAAAC,EACA,OAAAC,EACA,GAAGC,CACP,EAAgB,CACZ,OACIC,EAACC,EAAA,CACI,GAAGF,EACJ,UAAWG,EAAmBT,EAAmBU,GAC7CC,EACId,EAAe,CACX,QAAAI,EACA,KAAAC,EACA,UAAAQ,CAAA,CACH,EACDV,CAAA,CACJ,EAGH,SAAAS,EAAmBN,EAAUA,GAC1BS,EAAAC,EAAA,CACK,SAAA,CAAAT,KAAcU,EAAA,EAAO,EACrB,CAACV,GACEG,EAAAM,EAAA,CACK,SAAAV,CAAAA,CAEL,CAAA,EAER,CACH,CAAA,CAAA,CAGb"}
1
+ {"version":3,"file":"button.js","sources":["../../lib/components/button.tsx"],"sourcesContent":["'use client';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Button as AriaButton, composeRenderProps, type ButtonProps as AriaButtonProps } from 'react-aria-components';\nimport { classNames } from '../utils/primitives';\nimport { Loader } from './loader';\n\nexport const buttonVariants = cva('btn', {\n variants: {\n variant: {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n destructive: 'btn-destructive',\n neutral: 'btn-neutral',\n ghost: 'btn-ghost',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n default: 'input-dim',\n icon: 'size-input',\n none: '',\n },\n },\n defaultVariants: {\n variant: 'neutral',\n size: 'default',\n },\n});\n\nexport type ButtonProps = AriaButtonProps &\n VariantProps<typeof buttonVariants> & {\n ref?: React.Ref<HTMLButtonElement>;\n active?: boolean;\n };\n\nexport function Button({\n className: additionalClasses,\n variant,\n size,\n children,\n isPending,\n active,\n ...props\n}: ButtonProps) {\n return (\n <AriaButton\n {...props}\n className={composeRenderProps(additionalClasses, className =>\n classNames(\n buttonVariants({\n variant,\n size,\n className,\n }),\n additionalClasses\n )\n )}\n >\n {composeRenderProps(children, children => (\n <>\n {isPending && <Loader />}\n {!isPending && <>{children}</>}\n </>\n ))}\n </AriaButton>\n );\n}\n"],"names":["buttonVariants","cva","Button","additionalClasses","variant","size","children","isPending","active","props","jsx","AriaButton","composeRenderProps","className","classNames","jsxs","Fragment","Loader"],"mappings":"gVAMO,MAAMA,EAAiBC,EAAI,MAAO,CACrC,SAAU,CACN,QAAS,CACL,QAAS,cACT,UAAW,gBACX,YAAa,kBACb,QAAS,cACT,MAAO,YACP,KAAM,iDAAA,EAEV,KAAM,CACF,QAAS,YACT,KAAM,aACN,KAAM,EAAA,CACV,EAEJ,gBAAiB,CACb,QAAS,UACT,KAAM,SAAA,CAEd,CAAC,EAQM,SAASC,EAAO,CACnB,UAAWC,EACX,QAAAC,EACA,KAAAC,EACA,SAAAC,EACA,UAAAC,EACA,OAAAC,EACA,GAAGC,CACP,EAAgB,CACZ,OACIC,EAACC,EAAA,CACI,GAAGF,EACJ,UAAWG,EAAmBT,EAAmBU,GAC7CC,EACId,EAAe,CACX,QAAAI,EACA,KAAAC,EACA,UAAAQ,CAAA,CACH,EACDV,CAAA,CACJ,EAGH,SAAAS,EAAmBN,EAAUA,GAC1BS,EAAAC,EAAA,CACK,SAAA,CAAAT,KAAcU,EAAA,EAAO,EACrB,CAACV,GAAaG,EAAAM,EAAA,CAAG,SAAAV,CAAAA,CAAS,CAAA,EAC/B,CACH,CAAA,CAAA,CAGb"}
@@ -1,2 +1,2 @@
1
- import{jsxs as o,jsx as e}from"react/jsx-runtime";import{today as y,getLocalTimeZone as b}from"@internationalized/date";import{CalendarGridHeader as v,useLocale as N,Heading as S,CalendarGrid as G,CalendarHeaderCell as H,CalendarGridBody as R,RangeCalendarStateContext as $,CalendarCell as w,composeRenderProps as l,Calendar as z,RangeCalendar as B}from"react-aria-components";import{Button as c,buttonVariants as j}from"./button.js";import{FieldError as m}from"./field.js";import{classNames as n}from"../utils/primitives.js";import{ChevronRight as s,ChevronLeft as u}from"lucide-react";import{use as E}from"react";import"class-variance-authority";import"./loader.js";import"clsx";function f(a){let{direction:t}=N();return o("header",{className:"flex w-full items-center gap-1 px-1 pb-4",...a,children:[e(c,{slot:"previous",size:"none",className:n("size-7 bg-transparent p-0 opacity-50","data-[hovered]:opacity-100"),children:t==="rtl"?e(s,{"aria-hidden":!0}):e(u,{"aria-hidden":!0})}),e(S,{className:"grow text-center body font-medium"}),e(c,{slot:"next",className:n("size-7 bg-transparent p-0 opacity-50","data-[hovered]:opacity-100"),children:t==="rtl"?e(u,{"aria-hidden":!0}):e(s,{"aria-hidden":!0})})]})}function g({className:a,...t}){return e(G,{className:n(" border-separate border-spacing-x-0 border-spacing-y-1 ",a),...t})}const C=v;function h({className:a,...t}){return e(H,{className:n("w-9 body-sm font-normal text-muted-foreground",a),...t})}function p({className:a,...t}){return e(R,{className:n("[&>tr>td]:p-0",a),...t})}function x({className:a,...t}){const i=!!E($);return e(w,{className:l(a,(d,r)=>n(j({variant:"ghost",size:"none"}),"relative flex size-9 items-center justify-center p-0 body-sm font-normal",r.isDisabled&&"text-muted-foreground opacity-50",r.isSelected&&"bg-primary text-primary-foreground data-[focused]:bg-primary data-[focused]:text-primary-foreground",r.isHovered&&r.isSelected&&(r.isSelectionStart||r.isSelectionEnd||!i)&&"data-[hovered]:bg-primary data-[hovered]:text-primary-foreground",r.isSelected&&i&&!r.isSelectionStart&&!r.isSelectionEnd&&"rounded-none bg-accent text-accent-foreground",r.isOutsideMonth&&"text-muted-foreground opacity-50 data-[selected]:bg-accent/50 data-[selected]:text-muted-foreground data-[selected]:opacity-30",r.date.compare(y(b()))===0&&!r.isSelected&&"bg-accent text-accent-foreground",r.isUnavailable&&"cursor-default text-destructive ",r.isInvalid&&"bg-destructive text-destructive-foreground data-[focused]:bg-destructive data-[hovered]:bg-destructive data-[focused]:text-destructive-foreground data-[hovered]:text-destructive-foreground",d)),...t})}function A({errorMessage:a,className:t,...i}){return o(z,{className:l(t,d=>n("w-fit",d)),...i,children:[e(f,{}),o(g,{children:[e(C,{children:d=>e(h,{children:d})}),e(p,{children:d=>e(x,{date:d})})]}),a&&e(m,{children:a})]})}function J({errorMessage:a,className:t,...i}){return o(B,{className:l(t,d=>n("w-fit",d)),...i,children:[e(f,{}),o(g,{children:[e(C,{children:d=>e(h,{children:d})}),e(p,{children:d=>e(x,{date:d})})]}),a&&e(m,{slot:"errorMessage",children:a})]})}export{A as Calendar,x as CalendarCell,g as CalendarGrid,p as CalendarGridBody,C as CalendarGridHeader,h as CalendarHeaderCell,f as CalendarHeading,J as RangeCalendar};
1
+ import{jsxs as o,jsx as e}from"react/jsx-runtime";import{today as y,getLocalTimeZone as b}from"@internationalized/date";import{CalendarGridHeader as v,useLocale as N,Heading as S,CalendarGrid as G,CalendarHeaderCell as H,CalendarGridBody as R,RangeCalendarStateContext as $,CalendarCell as w,composeRenderProps as l,Calendar as z,RangeCalendar as B}from"react-aria-components";import{ChevronRight as c,ChevronLeft as s}from"lucide-react";import{use as j}from"react";import{Button as u,buttonVariants as E}from"./button.js";import{FieldError as m}from"./field.js";import{classNames as n}from"../utils/primitives.js";import"class-variance-authority";import"./loader.js";import"clsx";import"lodash-es";function f(a){let{direction:t}=N();return o("header",{className:"flex w-full items-center gap-1 px-1 pb-icon",...a,children:[e(u,{slot:"previous",size:"none",className:n("size-7 bg-transparent p-0 opacity-50","data-[hovered]:opacity-100"),children:t==="rtl"?e(c,{"aria-hidden":!0}):e(s,{"aria-hidden":!0})}),e(S,{className:"grow text-center body font-medium"}),e(u,{slot:"next",className:n("size-7 bg-transparent p-0 opacity-50","data-[hovered]:opacity-100"),children:t==="rtl"?e(s,{"aria-hidden":!0}):e(c,{"aria-hidden":!0})})]})}function g({className:a,...t}){return e(G,{className:n(" border-separate border-spacing-x-0 border-spacing-y-1 ",a),...t})}const C=v;function h({className:a,...t}){return e(H,{className:n("w-9 body-sm font-normal text-muted-foreground",a),...t})}function p({className:a,...t}){return e(R,{className:n("[&>tr>td]:p-0",a),...t})}function x({className:a,...t}){const i=!!j($);return e(w,{className:l(a,(d,r)=>n(E({variant:"ghost",size:"none"}),"relative flex size-9 items-center justify-center p-0 body-sm font-normal",r.isDisabled&&"text-muted-foreground opacity-50",r.isSelected&&"bg-primary text-primary-foreground data-[focused]:bg-primary data-[focused]:text-primary-foreground",r.isHovered&&r.isSelected&&(r.isSelectionStart||r.isSelectionEnd||!i)&&"data-[hovered]:bg-primary data-[hovered]:text-primary-foreground",r.isSelected&&i&&!r.isSelectionStart&&!r.isSelectionEnd&&"rounded-none bg-accent text-accent-foreground",r.isOutsideMonth&&"text-muted-foreground opacity-50 data-[selected]:bg-accent/50 data-[selected]:text-muted-foreground data-[selected]:opacity-30",r.date.compare(y(b()))===0&&!r.isSelected&&"bg-accent text-accent-foreground",r.isUnavailable&&"cursor-default text-destructive ",r.isInvalid&&"bg-destructive text-destructive-foreground data-[focused]:bg-destructive data-[hovered]:bg-destructive data-[focused]:text-destructive-foreground data-[hovered]:text-destructive-foreground",d)),...t})}function J({errorMessage:a,className:t,...i}){return o(z,{className:l(t,d=>n("w-fit",d)),...i,children:[e(f,{}),o(g,{children:[e(C,{children:d=>e(h,{children:d})}),e(p,{children:d=>e(x,{date:d})})]}),a&&e(m,{children:a})]})}function K({errorMessage:a,className:t,...i}){return o(B,{className:l(t,d=>n("w-fit",d)),...i,children:[e(f,{}),o(g,{children:[e(C,{children:d=>e(h,{children:d})}),e(p,{children:d=>e(x,{date:d})})]}),a&&e(m,{slot:"errorMessage",children:a})]})}export{J as Calendar,x as CalendarCell,g as CalendarGrid,p as CalendarGridBody,C as CalendarGridHeader,h as CalendarHeaderCell,f as CalendarHeading,K as RangeCalendar};
2
2
  //# sourceMappingURL=calendar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","sources":["../../lib/components/calendar.tsx"],"sourcesContent":["import { getLocalTimeZone, today } from '@internationalized/date';\nimport {\n Calendar as AriaCalendar,\n CalendarCell as AriaCalendarCell,\n CalendarCellProps as AriaCalendarCellProps,\n CalendarGrid as AriaCalendarGrid,\n CalendarGridBody as AriaCalendarGridBody,\n CalendarGridBodyProps as AriaCalendarGridBodyProps,\n CalendarGridHeader as AriaCalendarGridHeader,\n CalendarGridProps as AriaCalendarGridProps,\n CalendarHeaderCell as AriaCalendarHeaderCell,\n CalendarHeaderCellProps as AriaCalendarHeaderCellProps,\n CalendarProps as AriaCalendarProps,\n DateValue as AriaDateValue,\n Heading as AriaHeading,\n RangeCalendar as AriaRangeCalendar,\n RangeCalendarProps as AriaRangeCalendarProps,\n RangeCalendarStateContext as AriaRangeCalendarStateContext,\n composeRenderProps,\n useLocale\n} from 'react-aria-components';\n\nimport { Button, buttonVariants } from 'lib/components/button';\nimport { FieldError } from 'lib/components/field';\nimport { classNames } from 'lib/utils/primitives';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { use } from 'react';\n\nexport function CalendarHeading(props: React.HTMLAttributes<HTMLElement>) {\n let { direction } = useLocale();\n\n return (\n <header className=\"flex w-full items-center gap-1 px-1 pb-4\" {...props}>\n <Button\n slot=\"previous\"\n size=\"none\"\n className={classNames(\n 'size-7 bg-transparent p-0 opacity-50',\n /* Hover */\n 'data-[hovered]:opacity-100'\n )}\n >\n {direction === 'rtl' ? <ChevronRight aria-hidden /> : <ChevronLeft aria-hidden />}\n </Button>\n <AriaHeading className=\"grow text-center body font-medium\" />\n <Button\n slot=\"next\"\n className={classNames(\n 'size-7 bg-transparent p-0 opacity-50',\n /* Hover */\n 'data-[hovered]:opacity-100'\n )}\n >\n {direction === 'rtl' ? <ChevronLeft aria-hidden /> : <ChevronRight aria-hidden />}\n </Button>\n </header>\n );\n}\n\nexport function CalendarGrid({ className, ...props }: AriaCalendarGridProps) {\n return (\n <AriaCalendarGrid\n className={classNames(' border-separate border-spacing-x-0 border-spacing-y-1 ', className)}\n {...props}\n />\n );\n}\n\nexport const CalendarGridHeader = AriaCalendarGridHeader;\n\nexport function CalendarHeaderCell({ className, ...props }: AriaCalendarHeaderCellProps) {\n return (\n <AriaCalendarHeaderCell\n className={classNames('w-9 body-sm font-normal text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport function CalendarGridBody({ className, ...props }: AriaCalendarGridBodyProps) {\n return <AriaCalendarGridBody className={classNames('[&>tr>td]:p-0', className)} {...props} />;\n}\n\nexport function CalendarCell({ className, ...props }: AriaCalendarCellProps) {\n const isRange = Boolean(use(AriaRangeCalendarStateContext));\n return (\n <AriaCalendarCell\n className={composeRenderProps(className, (className, renderProps) =>\n classNames(\n buttonVariants({ variant: 'ghost', size: 'none' }),\n 'relative flex size-9 items-center justify-center p-0 body-sm font-normal',\n /* Disabled */\n renderProps.isDisabled && 'text-muted-foreground opacity-50',\n /* Selected */\n renderProps.isSelected &&\n 'bg-primary text-primary-foreground data-[focused]:bg-primary data-[focused]:text-primary-foreground',\n /* Hover */\n renderProps.isHovered &&\n renderProps.isSelected &&\n (renderProps.isSelectionStart || renderProps.isSelectionEnd || !isRange) &&\n 'data-[hovered]:bg-primary data-[hovered]:text-primary-foreground',\n /* Selection Start/End */\n renderProps.isSelected &&\n isRange &&\n !renderProps.isSelectionStart &&\n !renderProps.isSelectionEnd &&\n 'rounded-none bg-accent text-accent-foreground',\n /* Outside Month */\n renderProps.isOutsideMonth &&\n 'text-muted-foreground opacity-50 data-[selected]:bg-accent/50 data-[selected]:text-muted-foreground data-[selected]:opacity-30',\n /* Current Date */\n renderProps.date.compare(today(getLocalTimeZone())) === 0 &&\n !renderProps.isSelected &&\n 'bg-accent text-accent-foreground',\n /* Unavailable Date */\n renderProps.isUnavailable && 'cursor-default text-destructive ',\n renderProps.isInvalid &&\n 'bg-destructive text-destructive-foreground data-[focused]:bg-destructive data-[hovered]:bg-destructive data-[focused]:text-destructive-foreground data-[hovered]:text-destructive-foreground',\n className\n )\n )}\n {...props}\n />\n );\n}\n\ninterface CalendarProps<T extends AriaDateValue> extends AriaCalendarProps<T> {\n errorMessage?: string;\n}\n\nexport function Calendar<T extends AriaDateValue>({ errorMessage, className, ...props }: CalendarProps<T>) {\n return (\n <AriaCalendar className={composeRenderProps(className, className => classNames('w-fit', className))} {...props}>\n <CalendarHeading />\n <CalendarGrid>\n <CalendarGridHeader>{day => <CalendarHeaderCell>{day}</CalendarHeaderCell>}</CalendarGridHeader>\n <CalendarGridBody>{date => <CalendarCell date={date} />}</CalendarGridBody>\n </CalendarGrid>\n {errorMessage && (<FieldError>{errorMessage}</FieldError>)}\n </AriaCalendar>\n );\n}\n\ninterface RangeCalendarProps<T extends AriaDateValue> extends AriaRangeCalendarProps<T> {\n errorMessage?: string;\n}\n\nexport function RangeCalendar<T extends AriaDateValue>({ errorMessage, className, ...props }: RangeCalendarProps<T>) {\n return (\n <AriaRangeCalendar\n className={composeRenderProps(className, className => classNames('w-fit', className))}\n {...props}\n >\n <CalendarHeading />\n <CalendarGrid>\n <CalendarGridHeader>{day => <CalendarHeaderCell>{day}</CalendarHeaderCell>}</CalendarGridHeader>\n <CalendarGridBody>{date => <CalendarCell date={date} />}</CalendarGridBody>\n </CalendarGrid>\n {errorMessage && (<FieldError slot=\"errorMessage\">{errorMessage}</FieldError>)}\n </AriaRangeCalendar>\n );\n}\n"],"names":["CalendarHeading","props","direction","useLocale","jsxs","jsx","Button","classNames","ChevronRight","ChevronLeft","AriaHeading","CalendarGrid","className","AriaCalendarGrid","CalendarGridHeader","AriaCalendarGridHeader","CalendarHeaderCell","AriaCalendarHeaderCell","CalendarGridBody","AriaCalendarGridBody","CalendarCell","isRange","use","AriaRangeCalendarStateContext","AriaCalendarCell","composeRenderProps","renderProps","buttonVariants","today","getLocalTimeZone","Calendar","errorMessage","AriaCalendar","day","date","FieldError","RangeCalendar","AriaRangeCalendar"],"mappings":"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"}
1
+ {"version":3,"file":"calendar.js","sources":["../../lib/components/calendar.tsx"],"sourcesContent":["import { getLocalTimeZone, today } from '@internationalized/date';\nimport {\n Calendar as AriaCalendar,\n CalendarCell as AriaCalendarCell,\n CalendarCellProps as AriaCalendarCellProps,\n CalendarGrid as AriaCalendarGrid,\n CalendarGridBody as AriaCalendarGridBody,\n CalendarGridBodyProps as AriaCalendarGridBodyProps,\n CalendarGridHeader as AriaCalendarGridHeader,\n CalendarGridProps as AriaCalendarGridProps,\n CalendarHeaderCell as AriaCalendarHeaderCell,\n CalendarHeaderCellProps as AriaCalendarHeaderCellProps,\n CalendarProps as AriaCalendarProps,\n DateValue as AriaDateValue,\n Heading as AriaHeading,\n RangeCalendar as AriaRangeCalendar,\n RangeCalendarProps as AriaRangeCalendarProps,\n RangeCalendarStateContext as AriaRangeCalendarStateContext,\n composeRenderProps,\n useLocale,\n} from 'react-aria-components';\n\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { use } from 'react';\nimport { Button, buttonVariants } from '../components/button';\nimport { FieldError } from '../components/field';\nimport { classNames } from '../utils/primitives';\n\nexport function CalendarHeading(props: React.HTMLAttributes<HTMLElement>) {\n let { direction } = useLocale();\n\n return (\n <header className=\"flex w-full items-center gap-1 px-1 pb-icon\" {...props}>\n <Button\n slot=\"previous\"\n size=\"none\"\n className={classNames(\n 'size-7 bg-transparent p-0 opacity-50',\n /* Hover */\n 'data-[hovered]:opacity-100'\n )}\n >\n {direction === 'rtl' ? <ChevronRight aria-hidden /> : <ChevronLeft aria-hidden />}\n </Button>\n <AriaHeading className=\"grow text-center body font-medium\" />\n <Button\n slot=\"next\"\n className={classNames(\n 'size-7 bg-transparent p-0 opacity-50',\n /* Hover */\n 'data-[hovered]:opacity-100'\n )}\n >\n {direction === 'rtl' ? <ChevronLeft aria-hidden /> : <ChevronRight aria-hidden />}\n </Button>\n </header>\n );\n}\n\nexport function CalendarGrid({ className, ...props }: AriaCalendarGridProps) {\n return (\n <AriaCalendarGrid\n className={classNames(' border-separate border-spacing-x-0 border-spacing-y-1 ', className)}\n {...props}\n />\n );\n}\n\nexport const CalendarGridHeader = AriaCalendarGridHeader;\n\nexport function CalendarHeaderCell({ className, ...props }: AriaCalendarHeaderCellProps) {\n return (\n <AriaCalendarHeaderCell\n className={classNames('w-9 body-sm font-normal text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport function CalendarGridBody({ className, ...props }: AriaCalendarGridBodyProps) {\n return <AriaCalendarGridBody className={classNames('[&>tr>td]:p-0', className)} {...props} />;\n}\n\nexport function CalendarCell({ className, ...props }: AriaCalendarCellProps) {\n const isRange = Boolean(use(AriaRangeCalendarStateContext));\n return (\n <AriaCalendarCell\n className={composeRenderProps(className, (className, renderProps) =>\n classNames(\n buttonVariants({ variant: 'ghost', size: 'none' }),\n 'relative flex size-9 items-center justify-center p-0 body-sm font-normal',\n /* Disabled */\n renderProps.isDisabled && 'text-muted-foreground opacity-50',\n /* Selected */\n renderProps.isSelected &&\n 'bg-primary text-primary-foreground data-[focused]:bg-primary data-[focused]:text-primary-foreground',\n /* Hover */\n renderProps.isHovered &&\n renderProps.isSelected &&\n (renderProps.isSelectionStart || renderProps.isSelectionEnd || !isRange) &&\n 'data-[hovered]:bg-primary data-[hovered]:text-primary-foreground',\n /* Selection Start/End */\n renderProps.isSelected &&\n isRange &&\n !renderProps.isSelectionStart &&\n !renderProps.isSelectionEnd &&\n 'rounded-none bg-accent text-accent-foreground',\n /* Outside Month */\n renderProps.isOutsideMonth &&\n 'text-muted-foreground opacity-50 data-[selected]:bg-accent/50 data-[selected]:text-muted-foreground data-[selected]:opacity-30',\n /* Current Date */\n renderProps.date.compare(today(getLocalTimeZone())) === 0 &&\n !renderProps.isSelected &&\n 'bg-accent text-accent-foreground',\n /* Unavailable Date */\n renderProps.isUnavailable && 'cursor-default text-destructive ',\n renderProps.isInvalid &&\n 'bg-destructive text-destructive-foreground data-[focused]:bg-destructive data-[hovered]:bg-destructive data-[focused]:text-destructive-foreground data-[hovered]:text-destructive-foreground',\n className\n )\n )}\n {...props}\n />\n );\n}\n\ninterface CalendarProps<T extends AriaDateValue> extends AriaCalendarProps<T> {\n errorMessage?: string;\n}\n\nexport function Calendar<T extends AriaDateValue>({ errorMessage, className, ...props }: CalendarProps<T>) {\n return (\n <AriaCalendar className={composeRenderProps(className, className => classNames('w-fit', className))} {...props}>\n <CalendarHeading />\n <CalendarGrid>\n <CalendarGridHeader>{day => <CalendarHeaderCell>{day}</CalendarHeaderCell>}</CalendarGridHeader>\n <CalendarGridBody>{date => <CalendarCell date={date} />}</CalendarGridBody>\n </CalendarGrid>\n {errorMessage && <FieldError>{errorMessage}</FieldError>}\n </AriaCalendar>\n );\n}\n\ninterface RangeCalendarProps<T extends AriaDateValue> extends AriaRangeCalendarProps<T> {\n errorMessage?: string;\n}\n\nexport function RangeCalendar<T extends AriaDateValue>({ errorMessage, className, ...props }: RangeCalendarProps<T>) {\n return (\n <AriaRangeCalendar\n className={composeRenderProps(className, className => classNames('w-fit', className))}\n {...props}\n >\n <CalendarHeading />\n <CalendarGrid>\n <CalendarGridHeader>{day => <CalendarHeaderCell>{day}</CalendarHeaderCell>}</CalendarGridHeader>\n <CalendarGridBody>{date => <CalendarCell date={date} />}</CalendarGridBody>\n </CalendarGrid>\n {errorMessage && <FieldError slot=\"errorMessage\">{errorMessage}</FieldError>}\n </AriaRangeCalendar>\n );\n}\n"],"names":["CalendarHeading","props","direction","useLocale","jsxs","jsx","Button","classNames","ChevronRight","ChevronLeft","AriaHeading","CalendarGrid","className","AriaCalendarGrid","CalendarGridHeader","AriaCalendarGridHeader","CalendarHeaderCell","AriaCalendarHeaderCell","CalendarGridBody","AriaCalendarGridBody","CalendarCell","isRange","use","AriaRangeCalendarStateContext","AriaCalendarCell","composeRenderProps","renderProps","buttonVariants","today","getLocalTimeZone","Calendar","errorMessage","AriaCalendar","day","date","FieldError","RangeCalendar","AriaRangeCalendar"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{jsx as n}from"react/jsx-runtime";import{classNames as o}from"../utils/primitives.js";import"clsx";function d({className:r,...e}){return n("div",{className:o("flex flex-col p-icon border border-border bg-card text-card-foreground",r),...e})}function c({className:r,...e}){return n("div",{className:o("flex flex-col gap-y-1 pb-icon shrink-0",r),...e})}function s({className:r,...e}){return n("h3",{className:o("heading-3 leading-none",r),...e})}function l({className:r,...e}){return n("p",{className:o("body-sm text-muted",r),...e})}function f({className:r,...e}){return n("div",{className:o("grow body",r),...e})}function u({className:r,...e}){return n("div",{className:o("flex items-center w-full pt-icon gap-2 justify-end",r),...e})}export{d as Card,f as CardContent,l as CardDescription,u as CardFooter,c as CardHeader,s as CardTitle};
1
+ import{jsx as n}from"react/jsx-runtime";import{classNames as o}from"../utils/primitives.js";import"clsx";import"lodash-es";function c({className:r,...e}){return n("div",{className:o("flex flex-col p-icon border border-border bg-card text-card-foreground",r),...e})}function s({className:r,...e}){return n("div",{className:o("flex flex-col gap-y-1 pb-icon shrink-0",r),...e})}function l({className:r,...e}){return n("h3",{className:o("heading-3 leading-none",r),...e})}function f({className:r,...e}){return n("p",{className:o("body-sm text-muted",r),...e})}function m({className:r,...e}){return n("div",{className:o("grow body",r),...e})}function u({className:r,...e}){return n("div",{className:o("flex items-center w-full pt-icon gap-2 justify-end",r),...e})}export{c as Card,m as CardContent,f as CardDescription,u as CardFooter,s as CardHeader,l as CardTitle};
2
2
  //# sourceMappingURL=card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"card.js","sources":["../../lib/components/card.tsx"],"sourcesContent":["import { classNames } from 'lib/utils/primitives';\nimport type * as React from 'react';\n\nexport function Card({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n className={classNames('flex flex-col p-icon border border-border bg-card text-card-foreground', className)}\n {...props}\n />\n );\n}\n\nexport function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames('flex flex-col gap-y-1 pb-icon shrink-0', className)} {...props} />;\n}\n\nexport function CardTitle({ className, ...props }: React.ComponentProps<'h3'>) {\n return <h3 className={classNames('heading-3 leading-none', className)} {...props} />;\n}\n\nexport function CardDescription({ className, ...props }: React.ComponentProps<'p'>) {\n return <p className={classNames('body-sm text-muted', className)} {...props} />;\n}\n\nexport function CardContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames('grow body', className)} {...props} />;\n}\n\nexport function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames('flex items-center w-full pt-icon gap-2 justify-end', className)} {...props} />;\n}\n"],"names":["Card","className","props","jsx","classNames","CardHeader","CardTitle","CardDescription","CardContent","CardFooter"],"mappings":"yGAGO,SAASA,EAAK,CAAE,UAAAC,EAAW,GAAGC,GAAsC,CACvE,OACIC,EAAC,MAAA,CACG,UAAWC,EAAW,yEAA0EH,CAAS,EACxG,GAAGC,CAAA,CAAA,CAGhB,CAEO,SAASG,EAAW,CAAE,UAAAJ,EAAW,GAAGC,GAAsC,CAC7E,OAAOC,EAAC,OAAI,UAAWC,EAAW,yCAA0CH,CAAS,EAAI,GAAGC,EAAO,CACvG,CAEO,SAASI,EAAU,CAAE,UAAAL,EAAW,GAAGC,GAAqC,CAC3E,OAAOC,EAAC,MAAG,UAAWC,EAAW,yBAA0BH,CAAS,EAAI,GAAGC,EAAO,CACtF,CAEO,SAASK,EAAgB,CAAE,UAAAN,EAAW,GAAGC,GAAoC,CAChF,OAAOC,EAAC,KAAE,UAAWC,EAAW,qBAAsBH,CAAS,EAAI,GAAGC,EAAO,CACjF,CAEO,SAASM,EAAY,CAAE,UAAAP,EAAW,GAAGC,GAAsC,CAC9E,OAAOC,EAAC,OAAI,UAAWC,EAAW,YAAaH,CAAS,EAAI,GAAGC,EAAO,CAC1E,CAEO,SAASO,EAAW,CAAE,UAAAR,EAAW,GAAGC,GAAsC,CAC7E,OAAOC,EAAC,OAAI,UAAWC,EAAW,qDAAsDH,CAAS,EAAI,GAAGC,EAAO,CACnH"}
1
+ {"version":3,"file":"card.js","sources":["../../lib/components/card.tsx"],"sourcesContent":["import type * as React from 'react';\nimport { classNames } from '../utils/primitives';\n\nexport function Card({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n className={classNames('flex flex-col p-icon border border-border bg-card text-card-foreground', className)}\n {...props}\n />\n );\n}\n\nexport function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames('flex flex-col gap-y-1 pb-icon shrink-0', className)} {...props} />;\n}\n\nexport function CardTitle({ className, ...props }: React.ComponentProps<'h3'>) {\n return <h3 className={classNames('heading-3 leading-none', className)} {...props} />;\n}\n\nexport function CardDescription({ className, ...props }: React.ComponentProps<'p'>) {\n return <p className={classNames('body-sm text-muted', className)} {...props} />;\n}\n\nexport function CardContent({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames('grow body', className)} {...props} />;\n}\n\nexport function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return <div className={classNames('flex items-center w-full pt-icon gap-2 justify-end', className)} {...props} />;\n}\n"],"names":["Card","className","props","jsx","classNames","CardHeader","CardTitle","CardDescription","CardContent","CardFooter"],"mappings":"2HAGO,SAASA,EAAK,CAAE,UAAAC,EAAW,GAAGC,GAAsC,CACvE,OACIC,EAAC,MAAA,CACG,UAAWC,EAAW,yEAA0EH,CAAS,EACxG,GAAGC,CAAA,CAAA,CAGhB,CAEO,SAASG,EAAW,CAAE,UAAAJ,EAAW,GAAGC,GAAsC,CAC7E,OAAOC,EAAC,OAAI,UAAWC,EAAW,yCAA0CH,CAAS,EAAI,GAAGC,EAAO,CACvG,CAEO,SAASI,EAAU,CAAE,UAAAL,EAAW,GAAGC,GAAqC,CAC3E,OAAOC,EAAC,MAAG,UAAWC,EAAW,yBAA0BH,CAAS,EAAI,GAAGC,EAAO,CACtF,CAEO,SAASK,EAAgB,CAAE,UAAAN,EAAW,GAAGC,GAAoC,CAChF,OAAOC,EAAC,KAAE,UAAWC,EAAW,qBAAsBH,CAAS,EAAI,GAAGC,EAAO,CACjF,CAEO,SAASM,EAAY,CAAE,UAAAP,EAAW,GAAGC,GAAsC,CAC9E,OAAOC,EAAC,OAAI,UAAWC,EAAW,YAAaH,CAAS,EAAI,GAAGC,EAAO,CAC1E,CAEO,SAASO,EAAW,CAAE,UAAAR,EAAW,GAAGC,GAAsC,CAC7E,OAAOC,EAAC,OAAI,UAAWC,EAAW,qDAAsDH,CAAS,EAAI,GAAGC,EAAO,CACnH"}
@@ -1,5 +1,5 @@
1
1
  import { CheckboxProps as AriaCheckboxProps } from 'react-aria-components';
2
- import { FormFieldProps } from 'lib/components/field';
2
+ import { FormFieldProps } from '../components/field';
3
3
  export declare const CheckboxGroup: (props: import('react-aria-components').CheckboxGroupProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
4
4
  type CheckboxProps = AriaCheckboxProps & FormFieldProps;
5
5
  export declare function Checkbox({ className, label, description, errorMessage, ...props }: Omit<CheckboxProps, 'children'>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- import{jsx as e,Fragment as a}from"react/jsx-runtime";import{Checkbox as u,composeRenderProps as c,CheckboxGroup as m}from"react-aria-components";import{FormField as b,labelVariants as p}from"./field.js";import{useTfFieldContext as h}from"../utils/form-utils.js";import{classNames as d}from"../utils/primitives.js";import{Minus as x,Check as g}from"lucide-react";import"class-variance-authority";import"../utils/form-context.js";import"@tanstack/react-form";import"react";import"clsx";const B=m;function f({className:r,label:o,description:s,errorMessage:n,...l}){return e("div",{className:"group form-field",children:e(b,{label:o,description:s,errorMessage:n,children:e(u,{className:c(r,t=>d("group/checkbox cursor-pointer focus-ring flex items-center gap-x-2","disabled-muted",p,t)),...l,children:c(e(a,{}),(t,i)=>e(a,{children:e("div",{className:d("flex size-input shrink-0 items-center bg-popover justify-center border border-input text-current ring-offset-background","group-data-[indeterminate]/checkbox:bg-primary group-data-[selected]/checkbox:bg-primary group-data-[indeterminate]/checkbox:text-primary-foreground group-data-[selected]/checkbox:text-primary-foreground","group-data-[disabled]/checkbox:cursor-not-allowed group-data-[disabled]/checkbox:opacity-50","group-data-[invalid]/checkbox:border-destructive group-data-[invalid]/checkbox:group-data-[selected]/checkbox:bg-destructive group-data-[invalid]/checkbox:group-data-[selected]/checkbox:text-destructive-foreground","focus:outline-none focus-visible:outline-none"),children:i.isIndeterminate?e(x,{className:"size-icon"}):i.isSelected?e(g,{className:"size-icon"}):null})}))})})})}function T({...r}){const o=h({disabled:r.isDisabled});return e(f,{isSelected:o.state.value,isDisabled:o.form.state.isSubmitting||r.isDisabled,onChange:()=>o.handleChange(!o.state.value),onBlur:o.handleBlur,...r})}export{f as Checkbox,B as CheckboxGroup,T as TfCheckbox};
1
+ import{jsx as e,Fragment as a}from"react/jsx-runtime";import{Checkbox as u,composeRenderProps as c,CheckboxGroup as m}from"react-aria-components";import{Minus as b,Check as p}from"lucide-react";import{FormField as h,labelVariants as x}from"./field.js";import{useTfFieldContext as g}from"../utils/form-utils.js";import{classNames as d}from"../utils/primitives.js";import"class-variance-authority";import"react";import"../utils/form-context.js";import"@tanstack/react-form";import"clsx";import"lodash-es";const T=m;function f({className:r,label:o,description:s,errorMessage:n,...l}){return e("div",{className:"group form-field",children:e(h,{label:o,description:s,errorMessage:n,children:e(u,{className:c(r,t=>d("group/checkbox cursor-pointer focus-ring flex items-center gap-x-2","disabled-muted",x,t)),...l,children:c(e(a,{}),(t,i)=>e(a,{children:e("div",{className:d("flex size-input shrink-0 items-center bg-popover justify-center border border-input text-current ring-offset-background","group-data-[indeterminate]/checkbox:bg-primary group-data-[selected]/checkbox:bg-primary group-data-[indeterminate]/checkbox:text-primary-foreground group-data-[selected]/checkbox:text-primary-foreground","group-data-[disabled]/checkbox:cursor-not-allowed group-data-[disabled]/checkbox:opacity-50","group-data-[invalid]/checkbox:border-destructive group-data-[invalid]/checkbox:group-data-[selected]/checkbox:bg-destructive group-data-[invalid]/checkbox:group-data-[selected]/checkbox:text-destructive-foreground","focus:outline-none focus-visible:outline-none"),children:i.isIndeterminate?e(b,{className:"size-icon"}):i.isSelected?e(p,{className:"size-icon"}):null})}))})})})}function $({...r}){const o=g({disabled:r.isDisabled});return e(f,{isSelected:o.state.value,isDisabled:o.form.state.isSubmitting||r.isDisabled,onChange:()=>o.handleChange(!o.state.value),onBlur:o.handleBlur,...r})}export{f as Checkbox,T as CheckboxGroup,$ as TfCheckbox};
2
2
  //# sourceMappingURL=checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sources":["../../lib/components/checkbox.tsx"],"sourcesContent":["import {\n Checkbox as AriaCheckbox,\n CheckboxGroup as AriaCheckboxGroup,\n composeRenderProps,\n type CheckboxProps as AriaCheckboxProps,\n} from 'react-aria-components';\n\nimport { FormField, labelVariants, type FormFieldProps } from 'lib/components/field';\nimport { useTfFieldContext } from 'lib/utils/form-utils';\nimport { classNames } from 'lib/utils/primitives';\nimport { Check, Minus } from 'lucide-react';\n\nexport const CheckboxGroup = AriaCheckboxGroup;\ntype CheckboxProps = AriaCheckboxProps & FormFieldProps;\nexport function Checkbox({ className, label, description, errorMessage, ...props }: Omit<CheckboxProps, 'children'>) {\n return (\n <div className=\"group form-field\">\n <FormField label={label} description={description} errorMessage={errorMessage}>\n <AriaCheckbox\n className={composeRenderProps(className, className =>\n classNames(\n 'group/checkbox cursor-pointer focus-ring flex items-center gap-x-2',\n /* Disabled */\n 'disabled-muted',\n labelVariants,\n className\n )\n )}\n {...props}\n >\n {composeRenderProps(<></>, (_, renderProps) => (\n <>\n <div\n className={classNames(\n 'flex size-input shrink-0 items-center bg-popover justify-center border border-input text-current ring-offset-background',\n /* Selected */\n 'group-data-[indeterminate]/checkbox:bg-primary group-data-[selected]/checkbox:bg-primary group-data-[indeterminate]/checkbox:text-primary-foreground group-data-[selected]/checkbox:text-primary-foreground',\n /* Disabled */\n 'group-data-[disabled]/checkbox:cursor-not-allowed group-data-[disabled]/checkbox:opacity-50',\n /* Invalid */\n 'group-data-[invalid]/checkbox:border-destructive group-data-[invalid]/checkbox:group-data-[selected]/checkbox:bg-destructive group-data-[invalid]/checkbox:group-data-[selected]/checkbox:text-destructive-foreground',\n /* Resets */\n 'focus:outline-none focus-visible:outline-none'\n )}\n >\n {renderProps.isIndeterminate ? (\n <Minus className=\"size-icon\" />\n ) : renderProps.isSelected ? (\n <Check className=\"size-icon\" />\n ) : null}\n </div>\n </>\n ))}\n </AriaCheckbox>\n </FormField>\n </div>\n );\n}\n\nexport type TfCheckboxProps = Omit<React.ComponentProps<typeof Checkbox>, 'onChange' | 'onBlur' | 'isChecked'>;\nexport function TfCheckbox({ ...props }: TfCheckboxProps) {\n const field = useTfFieldContext<boolean>({ disabled: props.isDisabled });\n return (\n <Checkbox\n isSelected={field.state.value}\n isDisabled={field.form.state.isSubmitting || props.isDisabled}\n onChange={() => field.handleChange(!field.state.value)}\n onBlur={field.handleBlur}\n {...props}\n />\n );\n}\n"],"names":["CheckboxGroup","AriaCheckboxGroup","Checkbox","className","label","description","errorMessage","props","jsx","FormField","AriaCheckbox","composeRenderProps","classNames","labelVariants","Fragment","_","renderProps","Minus","Check","TfCheckbox","field","useTfFieldContext"],"mappings":"qeAYO,MAAMA,EAAgBC,EAEtB,SAASC,EAAS,CAAE,UAAAC,EAAW,MAAAC,EAAO,YAAAC,EAAa,aAAAC,EAAc,GAAGC,GAA0C,CACjH,OACIC,EAAC,OAAI,UAAU,mBACX,WAACC,EAAA,CAAU,MAAAL,EAAc,YAAAC,EAA0B,aAAAC,EAC/C,SAAAE,EAACE,EAAA,CACG,UAAWC,EAAmBR,EAAWA,GACrCS,EACI,qEAEA,iBACAC,EACAV,CAAA,CACJ,EAEH,GAAGI,EAEH,WAAmBC,EAAAM,EAAA,CAAA,CAAE,EAAK,CAACC,EAAGC,IAC3BR,EAAAM,EAAA,CACI,SAAAN,EAAC,MAAA,CACG,UAAWI,EACP,0HAEA,+MAEA,8FAEA,wNAEA,+CAAA,EAGH,SAAAI,EAAY,gBACTR,EAACS,EAAA,CAAM,UAAU,WAAA,CAAY,EAC7BD,EAAY,WACZR,EAACU,EAAA,CAAM,UAAU,YAAY,EAC7B,IAAA,CAAA,EAEZ,CACH,CAAA,CAAA,EAET,CAAA,CACJ,CAER,CAGO,SAASC,EAAW,CAAE,GAAGZ,GAA0B,CACtD,MAAMa,EAAQC,EAA2B,CAAE,SAAUd,EAAM,WAAY,EACvE,OACIC,EAACN,EAAA,CACG,WAAYkB,EAAM,MAAM,MACxB,WAAYA,EAAM,KAAK,MAAM,cAAgBb,EAAM,WACnD,SAAU,IAAMa,EAAM,aAAa,CAACA,EAAM,MAAM,KAAK,EACrD,OAAQA,EAAM,WACb,GAAGb,CAAA,CAAA,CAGhB"}
1
+ {"version":3,"file":"checkbox.js","sources":["../../lib/components/checkbox.tsx"],"sourcesContent":["import {\n Checkbox as AriaCheckbox,\n CheckboxGroup as AriaCheckboxGroup,\n composeRenderProps,\n type CheckboxProps as AriaCheckboxProps,\n} from 'react-aria-components';\n\nimport { Check, Minus } from 'lucide-react';\nimport { FormField, labelVariants, type FormFieldProps } from '../components/field';\nimport { useTfFieldContext } from '../utils/form-utils';\nimport { classNames } from '../utils/primitives';\n\nexport const CheckboxGroup = AriaCheckboxGroup;\ntype CheckboxProps = AriaCheckboxProps & FormFieldProps;\nexport function Checkbox({ className, label, description, errorMessage, ...props }: Omit<CheckboxProps, 'children'>) {\n return (\n <div className=\"group form-field\">\n <FormField label={label} description={description} errorMessage={errorMessage}>\n <AriaCheckbox\n className={composeRenderProps(className, className =>\n classNames(\n 'group/checkbox cursor-pointer focus-ring flex items-center gap-x-2',\n /* Disabled */\n 'disabled-muted',\n labelVariants,\n className\n )\n )}\n {...props}\n >\n {composeRenderProps(<></>, (_, renderProps) => (\n <>\n <div\n className={classNames(\n 'flex size-input shrink-0 items-center bg-popover justify-center border border-input text-current ring-offset-background',\n /* Selected */\n 'group-data-[indeterminate]/checkbox:bg-primary group-data-[selected]/checkbox:bg-primary group-data-[indeterminate]/checkbox:text-primary-foreground group-data-[selected]/checkbox:text-primary-foreground',\n /* Disabled */\n 'group-data-[disabled]/checkbox:cursor-not-allowed group-data-[disabled]/checkbox:opacity-50',\n /* Invalid */\n 'group-data-[invalid]/checkbox:border-destructive group-data-[invalid]/checkbox:group-data-[selected]/checkbox:bg-destructive group-data-[invalid]/checkbox:group-data-[selected]/checkbox:text-destructive-foreground',\n /* Resets */\n 'focus:outline-none focus-visible:outline-none'\n )}\n >\n {renderProps.isIndeterminate ? (\n <Minus className=\"size-icon\" />\n ) : renderProps.isSelected ? (\n <Check className=\"size-icon\" />\n ) : null}\n </div>\n </>\n ))}\n </AriaCheckbox>\n </FormField>\n </div>\n );\n}\n\nexport type TfCheckboxProps = Omit<React.ComponentProps<typeof Checkbox>, 'onChange' | 'onBlur' | 'isChecked'>;\nexport function TfCheckbox({ ...props }: TfCheckboxProps) {\n const field = useTfFieldContext<boolean>({ disabled: props.isDisabled });\n return (\n <Checkbox\n isSelected={field.state.value}\n isDisabled={field.form.state.isSubmitting || props.isDisabled}\n onChange={() => field.handleChange(!field.state.value)}\n onBlur={field.handleBlur}\n {...props}\n />\n );\n}\n"],"names":["CheckboxGroup","AriaCheckboxGroup","Checkbox","className","label","description","errorMessage","props","jsx","FormField","AriaCheckbox","composeRenderProps","classNames","labelVariants","Fragment","_","renderProps","Minus","Check","TfCheckbox","field","useTfFieldContext"],"mappings":"ufAYO,MAAMA,EAAgBC,EAEtB,SAASC,EAAS,CAAE,UAAAC,EAAW,MAAAC,EAAO,YAAAC,EAAa,aAAAC,EAAc,GAAGC,GAA0C,CACjH,OACIC,EAAC,OAAI,UAAU,mBACX,WAACC,EAAA,CAAU,MAAAL,EAAc,YAAAC,EAA0B,aAAAC,EAC/C,SAAAE,EAACE,EAAA,CACG,UAAWC,EAAmBR,EAAWA,GACrCS,EACI,qEAEA,iBACAC,EACAV,CAAA,CACJ,EAEH,GAAGI,EAEH,WAAmBC,EAAAM,EAAA,CAAA,CAAE,EAAK,CAACC,EAAGC,IAC3BR,EAAAM,EAAA,CACI,SAAAN,EAAC,MAAA,CACG,UAAWI,EACP,0HAEA,+MAEA,8FAEA,wNAEA,+CAAA,EAGH,SAAAI,EAAY,gBACTR,EAACS,EAAA,CAAM,UAAU,WAAA,CAAY,EAC7BD,EAAY,WACZR,EAACU,EAAA,CAAM,UAAU,YAAY,EAC7B,IAAA,CAAA,EAEZ,CACH,CAAA,CAAA,EAET,CAAA,CACJ,CAER,CAGO,SAASC,EAAW,CAAE,GAAGZ,GAA0B,CACtD,MAAMa,EAAQC,EAA2B,CAAE,SAAUd,EAAM,WAAY,EACvE,OACIC,EAACN,EAAA,CACG,WAAYkB,EAAM,MAAM,MACxB,WAAYA,EAAM,KAAK,MAAM,cAAgBb,EAAM,WACnD,SAAU,IAAMa,EAAM,aAAa,CAACA,EAAM,MAAM,KAAK,EACrD,OAAQA,EAAM,WACb,GAAGb,CAAA,CAAA,CAGhB"}
@@ -1,5 +1,5 @@
1
1
  import { components, operations, paths } from '@cryptlex/web-api-types';
2
- import { PaginationState, SortingState, Table } from '@tanstack/react-table';
2
+ import { ColumnHelper, PaginationState, SortingState, Table } from '@tanstack/react-table';
3
3
  import { LucideIcon } from 'lucide-react';
4
4
  import { default as createClient } from 'openapi-fetch';
5
5
  import { PressEvent } from 'react-aria-components';
@@ -13,35 +13,20 @@ export declare function formatDate(date: string | null | undefined): string | nu
13
13
  export declare function getLicenseStatus(license: any): string;
14
14
  export declare function getValidityDisplay(validity: number | undefined): string;
15
15
  export declare function secondsToDuration(seconds: number): string;
16
- export declare function getValueFromData(data: any, accessor: string | number | symbol): any;
17
16
  export declare const ALL_OS: {
18
17
  [key: string]: string;
19
18
  };
20
- export type VisibilityState<T> = {
21
- [K in keyof T]?: boolean;
22
- };
23
- export type TableActions = {
19
+ export type TableAction = {
24
20
  onClick: (e: PressEvent, t: Table<any>) => void;
25
21
  bulk: boolean;
26
22
  icon: LucideIcon;
27
23
  tooltip?: string;
28
- }[];
29
- export type TableFetchFn<TData, TOperation extends keyof operations> = (p: PaginationState, s: SortingState, q: string, f: ApiFilters<TOperation>) => Promise<{
24
+ };
25
+ export type TableFetchFn<TData extends object> = (p: PaginationState, s: SortingState, q: string, f: Record<string, any>) => Promise<{
30
26
  total: number;
31
27
  data: TData[] | undefined;
32
28
  }>;
33
- /*** Type for hide some of the columns based on the dto of the particular page
34
- ** `id`, `updatedAt` are by default hidden
35
- */
36
- export type DefaultVisibilityState<T> = {
37
- [K in keyof T]?: boolean;
38
- };
39
- type Client = ReturnType<typeof createClient<paths>>;
40
- type GetPaths = {
41
- [P in keyof paths]: paths[P] extends {
42
- get: any;
43
- } ? P : never;
44
- }[keyof paths];
29
+ export type _CtxClient = ReturnType<typeof createClient<paths>>;
45
30
  export type ApiSchema<T extends keyof components['schemas']> = components['schemas'][T];
46
31
  export type ApiQuery<T extends keyof operations> = NonNullable<operations[T]['parameters']['query']>;
47
32
  export type ApiGetAllParameters = {
@@ -52,5 +37,14 @@ export type ApiGetAllParameters = {
52
37
  };
53
38
  export type ApiFilter<T extends keyof operations> = Omit<ApiQuery<T>, 'page' | 'limit' | 'sort' | 'search'>;
54
39
  export type ApiFilters<T extends keyof operations> = NonNullable<Omit<ApiQuery<T>, 'page' | 'limit' | 'sort' | 'search'>>;
55
- export declare function createTableFetchFn<Return, Operation extends keyof operations>(ctxclient: Client, path: GetPaths): TableFetchFn<Return, Operation>;
56
- export {};
40
+ export declare function getTableCallback<T extends object>(getter: (q: Record<string, any>) => Promise<{
41
+ data?: T[];
42
+ error?: {
43
+ code?: string | null;
44
+ message: string;
45
+ };
46
+ response: Response;
47
+ }>): {
48
+ callback: TableFetchFn<T>;
49
+ columnHelper: ColumnHelper<T>;
50
+ };
@@ -1,2 +1,2 @@
1
- import{jsx as d}from"react/jsx-runtime";import{createColumnHelper as p}from"@tanstack/react-table";import{intervalToDuration as m}from"date-fns";import{Checkbox as i}from"./checkbox.js";import"react-aria-components";import"./field.js";import"class-variance-authority";import"../utils/primitives.js";import"clsx";import"lucide-react";import"../utils/form-utils.js";import"../utils/form-context.js";import"@tanstack/react-form";import"react";const n=p(),R=[n.accessor("checkbox",{header:({table:e})=>d(i,{isIndeterminate:e.getIsSomeRowsSelected()&&!e.getIsAllPageRowsSelected(),isSelected:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected(),onChange:()=>e.toggleAllPageRowsSelected(),"aria-label":"Select all"}),cell:({row:e})=>d(i,{isSelected:e.getIsSelected(),onChange:()=>e.toggleSelected(),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1})],O=[n.accessor("id",{header:()=>"ID"})],b=[n.accessor("createdAt",{header:()=>"Creation Date",cell:({row:e})=>{const t=e.getValue("createdAt");return c(t)},enableHiding:!1}),n.accessor("updatedAt",{header:()=>"Last Updated",cell:({row:e})=>{const t=e.getValue("updatedAt");return c(t)},enableHiding:!1})];function c(e){if(!e)return null;const t=new Date(e);return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function H(e){const t=e.expiresAt&&new Date(e.expiresAt)<new Date;switch(!0){case(e.revoked&&e.suspended&&t):return"Revoked, Suspended, Expired";case(e.revoked&&e.suspended):return"Revoked, Suspended";case(e.revoked&&t):return"Revoked, Expired";case(e.suspended&&t):return"Suspended, Expired";case e.suspended:return"Suspended";case e.revoked:return"Revoked";case t:return"Expired";default:return"Active"}}function P(e){return e===0||!e?"Lifetime":g(e)}function g(e){const t=m({start:0,end:e*1e3});return[t.years&&`${t.years}y`,t.months&&`${t.months}m`,t.days&&`${t.days}d`,t.hours&&`${t.hours}h`].filter(Boolean).join(" ").trim()}function $(e,t){const r=t.toString().split(".");let o=e;for(const a of r)o=o?.[a];return o}const B={windows:"Windows",macos:"macOS",linux:"Linux",ios:"iOS",android:"Android"};function F(e,t){return async(r,o,a,u)=>{const l={...u,page:r.pageIndex+1,limit:r.pageSize,sort:S(o[0]),search:a};return e.GET(t,{query:l}).then(s=>({total:Number.parseInt(s.response.headers.get("Pagination-Count")||"0"),data:s.data}))}}function S(e){return e?e.desc?`-${e.id}`:`+${e.id}`:"-createdAt"}export{B as ALL_OS,R as TABLE_CHECK_BOX_COLUMN,b as TABLE_DEFAULT_DATE_COLUMNS,O as TABLE_ID_COLUMN,F as createTableFetchFn,c as formatDate,H as getLicenseStatus,P as getValidityDisplay,$ as getValueFromData,g as secondsToDuration};
1
+ import{jsx as s}from"react/jsx-runtime";import{createColumnHelper as c}from"@tanstack/react-table";import{intervalToDuration as g}from"date-fns";import{Checkbox as d}from"./checkbox.js";import"react-aria-components";import"lucide-react";import"./field.js";import"class-variance-authority";import"../utils/primitives.js";import"clsx";import"lodash-es";import"../utils/form-utils.js";import"react";import"../utils/form-context.js";import"@tanstack/react-form";const r=c(),b=[r.accessor("checkbox",{header:({table:e})=>s(d,{isIndeterminate:e.getIsSomeRowsSelected()&&!e.getIsAllPageRowsSelected(),isSelected:e.getIsAllPageRowsSelected()||e.getIsSomePageRowsSelected(),onChange:()=>e.toggleAllPageRowsSelected(),"aria-label":"Select all"}),cell:({row:e})=>s(d,{isSelected:e.getIsSelected(),onChange:()=>e.toggleSelected(),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1})],H=[r.accessor("id",{header:()=>"ID"})],O=[r.accessor("createdAt",{header:()=>"Creation Date",cell:({row:e})=>{const t=e.getValue("createdAt");return i(t)},enableHiding:!1}),r.accessor("updatedAt",{header:()=>"Last Updated",cell:({row:e})=>{const t=e.getValue("updatedAt");return i(t)},enableHiding:!1})];function i(e){if(!e)return null;const t=new Date(e);return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function P(e){const t=e.expiresAt&&new Date(e.expiresAt)<new Date;switch(!0){case(e.revoked&&e.suspended&&t):return"Revoked, Suspended, Expired";case(e.revoked&&e.suspended):return"Revoked, Suspended";case(e.revoked&&t):return"Revoked, Expired";case(e.suspended&&t):return"Suspended, Expired";case e.suspended:return"Suspended";case e.revoked:return"Revoked";case t:return"Expired";default:return"Active"}}function $(e){return e===0||!e?"Lifetime":S(e)}function S(e){const t=g({start:0,end:e*1e3});return[t.years&&`${t.years}y`,t.months&&`${t.months}m`,t.days&&`${t.days}d`,t.hours&&`${t.hours}h`].filter(Boolean).join(" ").trim()}const B={windows:"Windows",macos:"macOS",linux:"Linux",ios:"iOS",android:"Android"};function U(e){const t=async(a,u,l,p)=>{const m={...p,page:a.pageIndex+1,limit:a.pageSize,sort:f(u[0]),search:l},n=await e(m);return{total:Number.parseInt(n.response.headers.get("Pagination-Count")||"0"),data:n.data}},o=c();return{callback:t,columnHelper:o}}function f(e){return e?e.desc?`-${e.id}`:`+${e.id}`:"-createdAt"}export{B as ALL_OS,b as TABLE_CHECK_BOX_COLUMN,O as TABLE_DEFAULT_DATE_COLUMNS,H as TABLE_ID_COLUMN,i as formatDate,P as getLicenseStatus,U as getTableCallback,$ as getValidityDisplay,S as secondsToDuration};
2
2
  //# sourceMappingURL=data-table-commons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-table-commons.js","sources":["../../lib/components/data-table-commons.tsx"],"sourcesContent":["import type { components, operations, paths } from '@cryptlex/web-api-types';\nimport type { PaginationState, SortingState, Table } from '@tanstack/react-table';\nimport { createColumnHelper } from '@tanstack/react-table';\nimport { intervalToDuration } from 'date-fns';\nimport { Checkbox } from 'lib/components/checkbox';\nimport type { LucideIcon } from 'lucide-react';\nimport type createClient from 'openapi-fetch';\nimport type { PressEvent } from 'react-aria-components';\n\nconst cH = createColumnHelper<any>();\nexport const TABLE_CHECK_BOX_COLUMN = [\n cH.accessor('checkbox', {\n header: ({ table }) => (\n <Checkbox\n isIndeterminate={table.getIsSomeRowsSelected() && !table.getIsAllPageRowsSelected()}\n isSelected={table.getIsAllPageRowsSelected() || table.getIsSomePageRowsSelected()}\n onChange={() => table.toggleAllPageRowsSelected()}\n aria-label=\"Select all\"\n />\n ),\n\n cell: ({ row }) => (\n <Checkbox isSelected={row.getIsSelected()} onChange={() => row.toggleSelected()} aria-label=\"Select row\" />\n ),\n enableSorting: false,\n enableHiding: false,\n }),\n];\n\nexport const TABLE_ID_COLUMN = [\n cH.accessor('id', {\n header: () => 'ID',\n }),\n];\nexport const TABLE_DEFAULT_DATE_COLUMNS = [\n cH.accessor('createdAt', {\n header: () => 'Creation Date',\n cell: ({ row }) => {\n const date = row.getValue('createdAt') satisfies string | null | undefined;\n return formatDate(date);\n },\n enableHiding: false,\n }),\n cH.accessor('updatedAt', {\n header: () => 'Last Updated',\n cell: ({ row }) => {\n const date = row.getValue('updatedAt') satisfies string | null | undefined;\n return formatDate(date);\n },\n enableHiding: false,\n }),\n];\n\n// TODO, i18n using react-aria\nexport function formatDate(date: string | null | undefined) {\n if (!date) return null;\n const _date = new Date(date);\n return new Intl.DateTimeFormat(undefined, {\n dateStyle: 'medium',\n timeStyle: 'short',\n }).format(_date);\n}\n/**\n * Format multiple license parameters (expired, suspended, revoked) into a single status\n */\nexport function getLicenseStatus(license: any): string {\n const licenseExpired = license.expiresAt && new Date(license.expiresAt) < new Date();\n // Status Column\n switch (true) {\n case license.revoked && license.suspended && licenseExpired:\n return 'Revoked, Suspended, Expired';\n case license.revoked && license.suspended:\n return 'Revoked, Suspended';\n case license.revoked && licenseExpired:\n return 'Revoked, Expired';\n case license.suspended && licenseExpired:\n return 'Suspended, Expired';\n case license.suspended:\n return 'Suspended';\n case license.revoked:\n return 'Revoked';\n case licenseExpired:\n return 'Expired';\n default:\n return 'Active';\n }\n}\n\nexport function getValidityDisplay(validity: number | undefined) {\n if (validity === 0 || !validity) {\n return 'Lifetime';\n } else {\n return secondsToDuration(validity);\n }\n}\nexport function secondsToDuration(seconds: number): string {\n //@ts-ignore\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 getValueFromData(data: any, accessor: string | number | symbol) {\n const accessors = accessor.toString().split('.');\n let value = data;\n for (const acc of accessors) {\n value = value?.[acc];\n }\n return value;\n}\nexport const ALL_OS: { [key: string]: string } = {\n windows: 'Windows',\n macos: 'macOS',\n linux: 'Linux',\n ios: 'iOS',\n android: 'Android',\n};\n\nexport type VisibilityState<T> = {\n [K in keyof T]?: boolean;\n};\n\nexport type TableActions = {\n onClick: (e: PressEvent, t: Table<any>) => void;\n bulk: boolean;\n icon: LucideIcon;\n tooltip?: string;\n}[];\n\nexport type TableFetchFn<TData, TOperation extends keyof operations> = (\n p: PaginationState,\n s: SortingState,\n q: string,\n f: ApiFilters<TOperation>\n) => Promise<{\n total: number;\n data: TData[] | undefined;\n}>;\n/*** Type for hide some of the columns based on the dto of the particular page\n ** `id`, `updatedAt` are by default hidden\n */\nexport type DefaultVisibilityState<T> = {\n [K in keyof T]?: boolean;\n};\n\ntype Client = ReturnType<typeof createClient<paths>>;\n\n// Helper type to extract valid GET paths\ntype GetPaths = {\n [P in keyof paths]: paths[P] extends { get: any } ? P : never;\n}[keyof paths];\n\nexport type ApiSchema<T extends keyof components['schemas']> = components['schemas'][T];\nexport type ApiQuery<T extends keyof operations> = NonNullable<operations[T]['parameters']['query']>;\nexport type ApiGetAllParameters = {\n page: number;\n limit: number;\n search?: string;\n sort?: string;\n};\n\nexport type ApiFilter<T extends keyof operations> = Omit<ApiQuery<T>, 'page' | 'limit' | 'sort' | 'search'>;\nexport type ApiFilters<T extends keyof operations> = NonNullable<\n Omit<ApiQuery<T>, 'page' | 'limit' | 'sort' | 'search'>\n>;\n\nexport function createTableFetchFn<Return, Operation extends keyof operations>(\n ctxclient: Client,\n path: GetPaths\n): TableFetchFn<Return, Operation> {\n return async (pagination, sorting, searching, filters) => {\n const query: ApiQuery<Operation> = {\n ...filters,\n page: pagination.pageIndex + 1,\n limit: pagination.pageSize,\n sort: generateSortParam(sorting[0]),\n search: searching,\n };\n\n // const pathParams = merge(_baseQueryObject, params);\n\n return ctxclient.GET(path, { query }).then(value => {\n const rowCount = Number.parseInt(value.response.headers.get('Pagination-Count') || '0');\n return { total: rowCount, data: value.data };\n });\n };\n}\n\nfunction generateSortParam(sort: { id: string; desc: boolean } | undefined): string {\n if (sort) {\n if (sort.desc) {\n return `-${sort.id}`;\n } else {\n return `+${sort.id}`;\n }\n } else {\n return '-createdAt';\n }\n}\n"],"names":["cH","createColumnHelper","TABLE_CHECK_BOX_COLUMN","table","jsx","Checkbox","row","TABLE_ID_COLUMN","TABLE_DEFAULT_DATE_COLUMNS","date","formatDate","_date","getLicenseStatus","license","licenseExpired","getValidityDisplay","validity","secondsToDuration","seconds","duration","intervalToDuration","getValueFromData","data","accessor","accessors","value","acc","ALL_OS","createTableFetchFn","ctxclient","path","pagination","sorting","searching","filters","query","generateSortParam","sort"],"mappings":"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"}
1
+ {"version":3,"file":"data-table-commons.js","sources":["../../lib/components/data-table-commons.tsx"],"sourcesContent":["import type { components, operations, paths } from '@cryptlex/web-api-types';\nimport type { ColumnHelper, PaginationState, SortingState, Table } from '@tanstack/react-table';\nimport { createColumnHelper } from '@tanstack/react-table';\nimport { intervalToDuration } from 'date-fns';\nimport type { LucideIcon } from 'lucide-react';\nimport type createClient from 'openapi-fetch';\nimport type { PressEvent } from 'react-aria-components';\nimport { Checkbox } from '../components/checkbox';\n\nconst cH = createColumnHelper<any>();\nexport const TABLE_CHECK_BOX_COLUMN = [\n cH.accessor('checkbox', {\n header: ({ table }) => (\n <Checkbox\n isIndeterminate={table.getIsSomeRowsSelected() && !table.getIsAllPageRowsSelected()}\n isSelected={table.getIsAllPageRowsSelected() || table.getIsSomePageRowsSelected()}\n onChange={() => table.toggleAllPageRowsSelected()}\n aria-label=\"Select all\"\n />\n ),\n\n cell: ({ row }) => (\n <Checkbox isSelected={row.getIsSelected()} onChange={() => row.toggleSelected()} aria-label=\"Select row\" />\n ),\n enableSorting: false,\n enableHiding: false,\n }),\n];\n\nexport const TABLE_ID_COLUMN = [\n cH.accessor('id', {\n header: () => 'ID',\n }),\n];\nexport const TABLE_DEFAULT_DATE_COLUMNS = [\n cH.accessor('createdAt', {\n header: () => 'Creation Date',\n cell: ({ row }) => {\n const date = row.getValue('createdAt') satisfies string | null | undefined;\n return formatDate(date);\n },\n enableHiding: false,\n }),\n cH.accessor('updatedAt', {\n header: () => 'Last Updated',\n cell: ({ row }) => {\n const date = row.getValue('updatedAt') satisfies string | null | undefined;\n return formatDate(date);\n },\n enableHiding: false,\n }),\n];\n\n// TODO, i18n using react-aria\nexport function formatDate(date: string | null | undefined) {\n if (!date) return null;\n const _date = new Date(date);\n return new Intl.DateTimeFormat(undefined, {\n dateStyle: 'medium',\n timeStyle: 'short',\n }).format(_date);\n}\n/**\n * Format multiple license parameters (expired, suspended, revoked) into a single status\n */\nexport function getLicenseStatus(license: any): string {\n const licenseExpired = license.expiresAt && new Date(license.expiresAt) < new Date();\n // Status Column\n switch (true) {\n case license.revoked && license.suspended && licenseExpired:\n return 'Revoked, Suspended, Expired';\n case license.revoked && license.suspended:\n return 'Revoked, Suspended';\n case license.revoked && licenseExpired:\n return 'Revoked, Expired';\n case license.suspended && licenseExpired:\n return 'Suspended, Expired';\n case license.suspended:\n return 'Suspended';\n case license.revoked:\n return 'Revoked';\n case licenseExpired:\n return 'Expired';\n default:\n return 'Active';\n }\n}\n\nexport function getValidityDisplay(validity: number | undefined) {\n if (validity === 0 || !validity) {\n return 'Lifetime';\n } else {\n return secondsToDuration(validity);\n }\n}\nexport function secondsToDuration(seconds: number): string {\n //@ts-ignore\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 const ALL_OS: { [key: string]: string } = {\n windows: 'Windows',\n macos: 'macOS',\n linux: 'Linux',\n ios: 'iOS',\n android: 'Android',\n};\n\nexport type TableAction = {\n onClick: (e: PressEvent, t: Table<any>) => void;\n bulk: boolean;\n icon: LucideIcon;\n tooltip?: string;\n};\n\nexport type TableFetchFn<TData extends object> = (\n p: PaginationState,\n s: SortingState,\n q: string,\n f: Record<string, any>\n) => Promise<{\n total: number;\n data: TData[] | undefined;\n}>;\n\nexport type _CtxClient = ReturnType<typeof createClient<paths>>;\n\nexport type ApiSchema<T extends keyof components['schemas']> = components['schemas'][T];\nexport type ApiQuery<T extends keyof operations> = NonNullable<operations[T]['parameters']['query']>;\nexport type ApiGetAllParameters = {\n page: number;\n limit: number;\n search?: string;\n sort?: string;\n};\n\nexport type ApiFilter<T extends keyof operations> = Omit<ApiQuery<T>, 'page' | 'limit' | 'sort' | 'search'>;\nexport type ApiFilters<T extends keyof operations> = NonNullable<\n Omit<ApiQuery<T>, 'page' | 'limit' | 'sort' | 'search'>\n>;\n\nexport function getTableCallback<T extends object>(\n getter: (\n q: Record<string, any>\n ) => Promise<{ data?: T[]; error?: { code?: string | null; message: string }; response: Response }>\n): { callback: TableFetchFn<T>; columnHelper: ColumnHelper<T> } {\n const callback: TableFetchFn<T> = async (pagination, sorting, searching, filters) => {\n const query = {\n ...filters,\n page: pagination.pageIndex + 1,\n limit: pagination.pageSize,\n sort: generateSortParam(sorting[0]),\n search: searching,\n };\n\n const _f = await getter(query);\n\n return {\n total: Number.parseInt(_f.response.headers.get('Pagination-Count') || '0'),\n data: _f.data,\n };\n };\n\n const columnHelper = createColumnHelper<T>();\n\n return { callback, columnHelper };\n}\n\nfunction generateSortParam(sort: { id: string; desc: boolean } | undefined): string {\n if (sort) {\n if (sort.desc) {\n return `-${sort.id}`;\n } else {\n return `+${sort.id}`;\n }\n } else {\n return '-createdAt';\n }\n}\n"],"names":["cH","createColumnHelper","TABLE_CHECK_BOX_COLUMN","table","jsx","Checkbox","row","TABLE_ID_COLUMN","TABLE_DEFAULT_DATE_COLUMNS","date","formatDate","_date","getLicenseStatus","license","licenseExpired","getValidityDisplay","validity","secondsToDuration","seconds","duration","intervalToDuration","ALL_OS","getTableCallback","getter","callback","pagination","sorting","searching","filters","query","generateSortParam","_f","columnHelper","sort"],"mappings":"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"}
@@ -1,9 +1,25 @@
1
- import { OperationKeys } from 'lib/components/data-table';
2
- import { ApiFilters } from 'lib/components/data-table-commons';
3
- import { MultiSelectProps } from 'lib/components/multi-select';
1
+ import { operations } from '@cryptlex/web-api-types';
2
+ import { CalendarDateTime } from '@internationalized/date';
3
+ import { ApiFilters } from '../components/data-table-commons';
4
+ import { MultiSelectProps } from '../components/multi-select';
4
5
  export declare const FILTER_COMPARISON_OPERATORS: readonly ["eq", "ne", "cn", "nc", "sw", "ew", "in", "nin", "gt", "gte", "lt", "lte"];
5
6
  export type FilterComparisonOperator = (typeof FILTER_COMPARISON_OPERATORS)[number];
6
7
  export declare const COMPARISON_OPERATOR_LABELS: Record<FilterComparisonOperator, string>;
8
+ type BaseLocalFilter<T extends FilterType, V> = {
9
+ id: string;
10
+ type: T;
11
+ property: string;
12
+ operator: FilterComparisonOperator;
13
+ value: V | undefined;
14
+ displayValue?: string;
15
+ };
16
+ type EnumLocalFilter = BaseLocalFilter<'enum', Set<string | number>>;
17
+ type IdLocalFilter = BaseLocalFilter<'id', string>;
18
+ type BoolLocalFilter = BaseLocalFilter<'bool', boolean>;
19
+ type StringLocalFilter = BaseLocalFilter<'string', string>;
20
+ type DateLocalFilter = BaseLocalFilter<'date', CalendarDateTime>;
21
+ type IdSearchLocalFilter = BaseLocalFilter<'id-search', Set<string | number>>;
22
+ export type TableFilter = EnumLocalFilter | IdLocalFilter | BoolLocalFilter | StringLocalFilter | DateLocalFilter | IdSearchLocalFilter;
7
23
  export type FilterConfig = {
8
24
  type: 'enum';
9
25
  options: MultiSelectProps['items'];
@@ -23,5 +39,6 @@ export type FilterConfig = {
23
39
  type: 'date';
24
40
  };
25
41
  export type FilterType = FilterConfig['type'];
26
- export type FiltersConfig<TOperation extends OperationKeys> = Required<Record<keyof ApiFilters<TOperation>, FilterConfig>>;
42
+ export type FiltersConfig<TOperation extends keyof operations> = Required<Record<keyof ApiFilters<TOperation>, FilterConfig>>;
27
43
  export declare function DataTableFilter({ className, ...props }: React.ComponentProps<'section'>): import("react/jsx-runtime").JSX.Element;
44
+ export {};
@@ -1,2 +1,2 @@
1
- import"react/jsx-runtime";import"./button.js";import{C as y,D as z,F as G}from"./data-table.js";import"./date-picker.js";import"./id-search.js";import"./menu.js";import"./popover.js";import"../utils/form-hook.js";import"../utils/primitives.js";import"../utils/resource-names.js";import"lucide-react";import"react";import"class-variance-authority";import"react-aria-components";import"./loader.js";import"clsx";import"@tanstack/react-query";import"@tanstack/react-table";import"@dnd-kit/sortable";import"@dnd-kit/core";import"@dnd-kit/utilities";import"./data-table-commons.js";import"date-fns";import"./checkbox.js";import"./field.js";import"../utils/form-utils.js";import"../utils/form-context.js";import"@tanstack/react-form";import"./searchfield.js";import"./table.js";import"lodash-es";import"@internationalized/date";import"./calendar.js";import"./datefield.js";import"./list-box.js";import"./select.js";import"./multi-select.js";import"./numberfield.js";import"./textfield.js";export{y as COMPARISON_OPERATOR_LABELS,z as DataTableFilter,G as FILTER_COMPARISON_OPERATORS};
1
+ import"react/jsx-runtime";import"lucide-react";import"react";import"./button.js";import{C as z,D as G,F as H}from"./data-table.js";import"./date-picker.js";import"./id-search.js";import"./menu.js";import"./popover.js";import"../utils/form-hook.js";import"../utils/primitives.js";import"../utils/resource-names.js";import"class-variance-authority";import"react-aria-components";import"./loader.js";import"clsx";import"lodash-es";import"@tanstack/react-query";import"@tanstack/react-table";import"@uidotdev/usehooks";import"@dnd-kit/sortable";import"@dnd-kit/core";import"@dnd-kit/utilities";import"./data-table-commons.js";import"date-fns";import"./checkbox.js";import"./field.js";import"../utils/form-utils.js";import"../utils/form-context.js";import"@tanstack/react-form";import"./searchfield.js";import"./table.js";import"@internationalized/date";import"./calendar.js";import"./datefield.js";import"./list-box.js";import"./select.js";import"./multi-select.js";import"./numberfield.js";import"./textfield.js";export{z as COMPARISON_OPERATOR_LABELS,G as DataTableFilter,H as FILTER_COMPARISON_OPERATORS};
2
2
  //# sourceMappingURL=data-table-filter.js.map
@@ -1,72 +1,83 @@
1
- import { components, operations } from '@cryptlex/web-api-types';
2
- import { ColumnDef, TableState, VisibilityState } from '@tanstack/react-table';
3
- import { ApiFilters, ApiSchema, TableActions, TableFetchFn } from 'lib/components/data-table-commons';
4
- import { FiltersConfig } from 'lib/components/data-table-filter';
1
+ import { operations } from '@cryptlex/web-api-types';
2
+ import { ColumnDef, TableState } from '@tanstack/react-table';
3
+ import { TableAction, TableFetchFn } from '../components/data-table-commons';
4
+ import { FiltersConfig, TableFilter } from '../components/data-table-filter';
5
5
  /** Reserved name for actions column */
6
6
  export declare const ACTIONS_COLUMN_ID = "tableActions";
7
- export type Schemas = ApiSchema<keyof components['schemas']>;
8
- export type OperationKeys = keyof operations;
9
- type DataTableFactory<TData extends Schemas> = {
10
- fetchFn: TableFetchFn<TData, OperationKeys>;
11
- columns: ColumnDef<TData, any>[];
7
+ type DataTableFactory<T extends object, TOperation extends keyof operations> = {
8
+ callback: TableFetchFn<T>;
9
+ columns: ColumnDef<T, any>[];
12
10
  allowSelection?: boolean;
13
- columnsToHideByDefault?: VisibilityState;
14
- filterConfig: FiltersConfig<OperationKeys>;
11
+ columnsToHideByDefault?: Partial<Record<keyof T, boolean>>;
12
+ filterConfig: FiltersConfig<TOperation>;
13
+ initialFilters: TableFilter[];
15
14
  };
16
15
  type DataTableState = Pick<TableState, 'sorting' | 'pagination'> & {};
17
16
  /**
18
17
  * Hook for handling all data-table state. Used in DataTableContext
19
18
  */
20
- export declare function useDataTableState<TData extends Schemas>({ columns, fetchFn, columnsToHideByDefault, allowSelection, filterConfig, }: DataTableFactory<TData>): {
19
+ export declare function useDataTableState<T extends object, TOperation extends keyof operations>({ columns, callback, filterConfig, columnsToHideByDefault, allowSelection, initialFilters, }: DataTableFactory<T, TOperation>): {
21
20
  tableState: Pick<TableState, "sorting" | "pagination">;
22
21
  updateTableState: (updates: Partial<DataTableState>) => void;
23
22
  query: import('@tanstack/react-query').UseQueryResult<{
24
23
  total: number;
25
- data: TData[] | undefined;
24
+ data: T[] | undefined;
26
25
  }, Error>;
27
26
  setSearchQuery: import('react').Dispatch<import('react').SetStateAction<string>>;
28
27
  searchQuery: string;
29
28
  tanTable: import('@tanstack/react-table').Table<any>;
30
- mergedFilters: ApiFilters<keyof operations>;
31
- filters: ApiFilters<keyof operations>[];
32
- setFilters: import('react').Dispatch<import('react').SetStateAction<ApiFilters<keyof operations>[]>>;
33
- filterConfig: Required<Record<never, import('lib/components/data-table-filter').FilterConfig>>;
29
+ mergedFilters: {
30
+ [x: string]: {
31
+ [x: string]: string | boolean | Set<string | number> | import('@internationalized/date').CalendarDateTime | undefined;
32
+ };
33
+ };
34
+ filters: TableFilter[];
35
+ setFilters: import('react').Dispatch<import('react').SetStateAction<TableFilter[]>>;
36
+ filterConfig: Required<Record<Exclude<keyof import('../components/data-table-commons').ApiQuery<TOperation>, "search" | "sort" | "page" | "limit">, import('../components/data-table-filter').FilterConfig>>;
34
37
  };
35
38
  export declare const DataTableContext: import('react').Context<{
36
39
  tableState: Pick<TableState, "sorting" | "pagination">;
37
40
  updateTableState: (updates: Partial<DataTableState>) => void;
38
41
  query: import('@tanstack/react-query').UseQueryResult<{
39
42
  total: number;
40
- data: Schemas[] | undefined;
43
+ data: object[] | undefined;
41
44
  }, Error>;
42
45
  setSearchQuery: import('react').Dispatch<import('react').SetStateAction<string>>;
43
46
  searchQuery: string;
44
47
  tanTable: import('@tanstack/react-table').Table<any>;
45
- mergedFilters: ApiFilters<keyof operations>;
46
- filters: ApiFilters<keyof operations>[];
47
- setFilters: import('react').Dispatch<import('react').SetStateAction<ApiFilters<keyof operations>[]>>;
48
- filterConfig: Required<Record<never, import('lib/components/data-table-filter').FilterConfig>>;
48
+ mergedFilters: {
49
+ [x: string]: {
50
+ [x: string]: string | boolean | Set<string | number> | import('@internationalized/date').CalendarDateTime | undefined;
51
+ };
52
+ };
53
+ filters: TableFilter[];
54
+ setFilters: import('react').Dispatch<import('react').SetStateAction<TableFilter[]>>;
55
+ filterConfig: Required<Record<never, import('../components/data-table-filter').FilterConfig>>;
49
56
  } | null>;
50
57
  export declare const useDataTable: () => {
51
58
  tableState: Pick<TableState, "sorting" | "pagination">;
52
59
  updateTableState: (updates: Partial<DataTableState>) => void;
53
60
  query: import('@tanstack/react-query').UseQueryResult<{
54
61
  total: number;
55
- data: Schemas[] | undefined;
62
+ data: object[] | undefined;
56
63
  }, Error>;
57
64
  setSearchQuery: import('react').Dispatch<import('react').SetStateAction<string>>;
58
65
  searchQuery: string;
59
66
  tanTable: import('@tanstack/react-table').Table<any>;
60
- mergedFilters: ApiFilters<keyof operations>;
61
- filters: ApiFilters<keyof operations>[];
62
- setFilters: import('react').Dispatch<import('react').SetStateAction<ApiFilters<keyof operations>[]>>;
63
- filterConfig: Required<Record<never, import('lib/components/data-table-filter').FilterConfig>>;
67
+ mergedFilters: {
68
+ [x: string]: {
69
+ [x: string]: string | boolean | Set<string | number> | import('@internationalized/date').CalendarDateTime | undefined;
70
+ };
71
+ };
72
+ filters: TableFilter[];
73
+ setFilters: import('react').Dispatch<import('react').SetStateAction<TableFilter[]>>;
74
+ filterConfig: Required<Record<never, import('../components/data-table-filter').FilterConfig>>;
64
75
  };
65
76
  export declare function DataTableProvider({ children, ...props }: {
66
77
  children: React.ReactNode;
67
78
  } & ReturnType<typeof useDataTableState>): import("react/jsx-runtime").JSX.Element;
68
79
  export type DataTableProps = React.ComponentProps<'section'> & {
69
- tableActions: TableActions;
80
+ tableActions: TableAction[];
70
81
  };
71
82
  export declare function DataTable({ tableActions, className, ...props }: DataTableProps): import("react/jsx-runtime").JSX.Element;
72
83
  export {};