@simpleapps-com/augur-web 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.cjs.map +1 -1
- package/dist/accordion.js.map +1 -1
- package/dist/add-to-cart-button.cjs +46 -0
- package/dist/add-to-cart-button.cjs.map +1 -0
- package/dist/add-to-cart-button.d.cts +14 -0
- package/dist/add-to-cart-button.d.ts +14 -0
- package/dist/add-to-cart-button.js +46 -0
- package/dist/add-to-cart-button.js.map +1 -0
- package/dist/breadcrumbs.cjs.map +1 -1
- package/dist/breadcrumbs.d.cts +14 -0
- package/dist/breadcrumbs.d.ts +14 -0
- package/dist/breadcrumbs.js.map +1 -1
- package/dist/button.cjs +2 -2
- package/dist/button.d.cts +14 -1
- package/dist/button.d.ts +14 -1
- package/dist/button.js +1 -1
- package/dist/card.cjs.map +1 -1
- package/dist/card.js.map +1 -1
- package/dist/checkbox.cjs.map +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/{chunk-FHS7SJEQ.js → chunk-3FSJ76CI.js} +1 -1
- package/dist/chunk-3FSJ76CI.js.map +1 -0
- package/dist/{chunk-GPDD67CJ.js → chunk-6JHTOVHH.js} +2 -2
- package/dist/chunk-6JHTOVHH.js.map +1 -0
- package/dist/{chunk-SXJP4G5U.cjs → chunk-AMGUJSB4.cjs} +1 -1
- package/dist/chunk-AMGUJSB4.cjs.map +1 -0
- package/dist/{chunk-BYHOMRXR.js → chunk-BMQGSDHH.js} +1 -1
- package/dist/chunk-BMQGSDHH.js.map +1 -0
- package/dist/{chunk-ND6U4UQQ.js → chunk-C7E3ITLU.js} +1 -1
- package/dist/chunk-C7E3ITLU.js.map +1 -0
- package/dist/chunk-DONF5PIE.js +47 -0
- package/dist/chunk-DONF5PIE.js.map +1 -0
- package/dist/{chunk-NWGXDXRV.cjs → chunk-DQJDDXSH.cjs} +1 -1
- package/dist/chunk-DQJDDXSH.cjs.map +1 -0
- package/dist/chunk-ECZR6SW3.cjs +47 -0
- package/dist/chunk-ECZR6SW3.cjs.map +1 -0
- package/dist/{chunk-PTAWV5SA.js → chunk-FHUB6XI5.js} +1 -1
- package/dist/chunk-FHUB6XI5.js.map +1 -0
- package/dist/{chunk-VT4JLAIE.cjs → chunk-I4Q2GZZK.cjs} +1 -1
- package/dist/{chunk-VT4JLAIE.cjs.map → chunk-I4Q2GZZK.cjs.map} +1 -1
- package/dist/{chunk-DAU3SFHM.js → chunk-LCNFPBPV.js} +1 -1
- package/dist/chunk-LCNFPBPV.js.map +1 -0
- package/dist/{chunk-VMOQCPK5.cjs → chunk-LNMPVCIY.cjs} +3 -3
- package/dist/{chunk-VMOQCPK5.cjs.map → chunk-LNMPVCIY.cjs.map} +1 -1
- package/dist/{chunk-3RVGVJDI.cjs → chunk-MGOH4OFM.cjs} +1 -1
- package/dist/chunk-MGOH4OFM.cjs.map +1 -0
- package/dist/{chunk-N2TV6QZO.cjs → chunk-QLSIUW3X.cjs} +1 -1
- package/dist/chunk-QLSIUW3X.cjs.map +1 -0
- package/dist/{chunk-Q6H6D3AN.cjs → chunk-SHF52AZM.cjs} +1 -1
- package/dist/chunk-SHF52AZM.cjs.map +1 -0
- package/dist/{chunk-CK53LO3J.cjs → chunk-U35O67ZA.cjs} +1 -1
- package/dist/chunk-U35O67ZA.cjs.map +1 -0
- package/dist/{chunk-DZ6HBEMA.js → chunk-X5RKGEDZ.js} +1 -1
- package/dist/chunk-X5RKGEDZ.js.map +1 -0
- package/dist/{chunk-SVF5VSZ2.js → chunk-YKVFAVK5.js} +1 -1
- package/dist/chunk-YKVFAVK5.js.map +1 -0
- package/dist/command.cjs +2 -2
- package/dist/command.cjs.map +1 -1
- package/dist/command.d.cts +7 -7
- package/dist/command.d.ts +7 -7
- package/dist/command.js +1 -1
- package/dist/command.js.map +1 -1
- package/dist/dialog.cjs +2 -2
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu.cjs.map +1 -1
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/form-field.cjs +3 -3
- package/dist/form-field.d.cts +1 -0
- package/dist/form-field.d.ts +1 -0
- package/dist/form-field.js +2 -2
- package/dist/form-input.cjs +5 -5
- package/dist/form-input.cjs.map +1 -1
- package/dist/form-input.d.cts +8 -0
- package/dist/form-input.d.ts +8 -0
- package/dist/form-input.js +3 -3
- package/dist/form-input.js.map +1 -1
- package/dist/form-select.cjs +7 -7
- package/dist/form-select.cjs.map +1 -1
- package/dist/form-select.d.cts +14 -0
- package/dist/form-select.d.ts +14 -0
- package/dist/form-select.js +3 -3
- package/dist/form-select.js.map +1 -1
- package/dist/form-textarea.cjs +5 -5
- package/dist/form-textarea.cjs.map +1 -1
- package/dist/form-textarea.d.cts +1 -0
- package/dist/form-textarea.d.ts +1 -0
- package/dist/form-textarea.js +3 -3
- package/dist/form-textarea.js.map +1 -1
- package/dist/input.cjs +2 -2
- package/dist/input.js +1 -1
- package/dist/label.cjs +2 -2
- package/dist/label.js +1 -1
- package/dist/list-view.cjs.map +1 -1
- package/dist/list-view.d.cts +8 -0
- package/dist/list-view.d.ts +8 -0
- package/dist/list-view.js.map +1 -1
- package/dist/navigation-menu.cjs.map +1 -1
- package/dist/navigation-menu.js.map +1 -1
- package/dist/pagination.cjs +2 -2
- package/dist/pagination.cjs.map +1 -1
- package/dist/pagination.js +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/popover.cjs.map +1 -1
- package/dist/popover.js.map +1 -1
- package/dist/price-format.cjs +2 -2
- package/dist/price-format.d.cts +4 -0
- package/dist/price-format.d.ts +4 -0
- package/dist/price-format.js +1 -1
- package/dist/price.cjs +2 -2
- package/dist/price.cjs.map +1 -1
- package/dist/price.d.cts +17 -0
- package/dist/price.d.ts +17 -0
- package/dist/price.js +1 -1
- package/dist/price.js.map +1 -1
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +22 -3
- package/dist/provider.d.ts +22 -3
- package/dist/provider.js.map +1 -1
- package/dist/quantity-input.cjs.map +1 -1
- package/dist/quantity-input.d.cts +15 -0
- package/dist/quantity-input.d.ts +15 -0
- package/dist/quantity-input.js.map +1 -1
- package/dist/radio-group.cjs.map +1 -1
- package/dist/radio-group.js.map +1 -1
- package/dist/select.cjs +2 -2
- package/dist/select.js +1 -1
- package/dist/separator.cjs.map +1 -1
- package/dist/separator.js.map +1 -1
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/spinner.cjs +3 -41
- package/dist/spinner.cjs.map +1 -1
- package/dist/spinner.d.cts +1 -0
- package/dist/spinner.d.ts +1 -0
- package/dist/spinner.js +3 -41
- package/dist/spinner.js.map +1 -1
- package/dist/stock-label.cjs +85 -0
- package/dist/stock-label.cjs.map +1 -0
- package/dist/stock-label.d.cts +47 -0
- package/dist/stock-label.d.ts +47 -0
- package/dist/stock-label.js +85 -0
- package/dist/stock-label.js.map +1 -0
- package/dist/table.cjs.map +1 -1
- package/dist/table.js.map +1 -1
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/textarea.cjs +2 -2
- package/dist/textarea.js +1 -1
- package/package.json +16 -6
- package/dist/chunk-3RVGVJDI.cjs.map +0 -1
- package/dist/chunk-BYHOMRXR.js.map +0 -1
- package/dist/chunk-CK53LO3J.cjs.map +0 -1
- package/dist/chunk-DAU3SFHM.js.map +0 -1
- package/dist/chunk-DZ6HBEMA.js.map +0 -1
- package/dist/chunk-FHS7SJEQ.js.map +0 -1
- package/dist/chunk-GPDD67CJ.js.map +0 -1
- package/dist/chunk-N2TV6QZO.cjs.map +0 -1
- package/dist/chunk-ND6U4UQQ.js.map +0 -1
- package/dist/chunk-NWGXDXRV.cjs.map +0 -1
- package/dist/chunk-PTAWV5SA.js.map +0 -1
- package/dist/chunk-Q6H6D3AN.cjs.map +0 -1
- package/dist/chunk-SVF5VSZ2.js.map +0 -1
- package/dist/chunk-SXJP4G5U.cjs.map +0 -1
package/dist/pagination.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkQLSIUW3Xcjs = require('./chunk-QLSIUW3X.cjs');
|
|
6
6
|
|
|
7
7
|
// src/pagination.tsx
|
|
8
8
|
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
@@ -40,7 +40,7 @@ var PaginationLink = ({
|
|
|
40
40
|
{
|
|
41
41
|
"aria-current": isActive ? "page" : void 0,
|
|
42
42
|
className: _web.cn.call(void 0,
|
|
43
|
-
|
|
43
|
+
_chunkQLSIUW3Xcjs.buttonVariants.call(void 0, {
|
|
44
44
|
variant: isActive ? "outline" : "ghost",
|
|
45
45
|
size
|
|
46
46
|
}),
|
package/dist/pagination.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/pagination.cjs","../src/pagination.tsx"],"names":[],"mappings":"AAAA,uWAAY;AACZ,YAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/pagination.cjs","../src/pagination.tsx"],"names":[],"mappings":"AAAA,uWAAY;AACZ,YAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACA;ACHA,2EAAuB;AACvB,oCAA0D;AAC1D,sDAAmB;AAIjB,+CAAA;AADF,IAAM,WAAA,EAAa,CAAC,EAAE,SAAA,EAAW,GAAG,MAAM,CAAA,EAAA,mBACxC,6BAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,IAAA,EAAK,YAAA;AAAA,IACL,YAAA,EAAW,YAAA;AAAA,IACX,SAAA,EAAW,qBAAA,oCAAG,EAAsC,SAAS,CAAA;AAAA,IAC5D,GAAG;AAAA,EAAA;AACN,CAAA;AAEF,UAAA,CAAW,YAAA,EAAc,YAAA;AAEzB,IAAM,kBAAA,EAA0B,KAAA,CAAA,UAAA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tC,CAAA;AAEF,kBAAA,CAAmB,YAAA,EAAc,oBAAA;ADNjC;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,4SAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/pagination.cjs","sourcesContent":[null,"/** Pagination navigation components, styled with buttonVariants. */\n\"use client\";\n\nimport * as React from \"react\";\nimport { LuChevronLeft, LuChevronRight, LuEllipsis } from \"react-icons/lu\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { type ButtonProps, buttonVariants } from \"./button\";\n\nconst Pagination = ({ className, ...props }: React.ComponentProps<\"nav\">) => (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n);\nPagination.displayName = \"Pagination\";\n\nconst PaginationContent = React.forwardRef<\n HTMLUListElement,\n React.ComponentProps<\"ul\">\n>(({ className, ...props }, ref) => (\n <ul\n ref={ref}\n className={cn(\"flex flex-row items-center gap-1\", className)}\n {...props}\n />\n));\nPaginationContent.displayName = \"PaginationContent\";\n\nconst PaginationItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentProps<\"li\">\n>(({ className, ...props }, ref) => (\n <li ref={ref} className={cn(\"\", className)} {...props} />\n));\nPaginationItem.displayName = \"PaginationItem\";\n\ntype PaginationLinkProps = {\n isActive?: boolean;\n} & Pick<ButtonProps, \"size\"> &\n React.ComponentProps<\"a\">;\n\nconst PaginationLink = ({\n className,\n isActive,\n size = \"icon\",\n ...props\n}: PaginationLinkProps) => (\n <a\n aria-current={isActive ? \"page\" : undefined}\n className={cn(\n buttonVariants({\n variant: isActive ? \"outline\" : \"ghost\",\n size,\n }),\n className,\n )}\n {...props}\n />\n);\nPaginationLink.displayName = \"PaginationLink\";\n\nconst PaginationPrevious = ({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to previous page\"\n size=\"default\"\n className={cn(\"gap-1 pl-2.5\", className)}\n {...props}\n >\n <LuChevronLeft className=\"h-4 w-4\" />\n <span>Prev</span>\n </PaginationLink>\n);\nPaginationPrevious.displayName = \"PaginationPrevious\";\n\nconst PaginationNext = ({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to next page\"\n size=\"default\"\n className={cn(\"gap-1 pr-2.5\", className)}\n {...props}\n >\n <span>Next</span>\n <LuChevronRight className=\"h-4 w-4\" />\n </PaginationLink>\n);\nPaginationNext.displayName = \"PaginationNext\";\n\nconst PaginationEllipsis = ({\n className,\n ...props\n}: React.ComponentProps<\"span\">) => (\n <span\n aria-hidden\n className={cn(\"flex h-9 w-9 items-center justify-center\", className)}\n {...props}\n >\n <LuEllipsis className=\"h-4 w-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n);\nPaginationEllipsis.displayName = \"PaginationEllipsis\";\n\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n};\n"]}
|
package/dist/pagination.js
CHANGED
package/dist/pagination.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/pagination.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { LuChevronLeft, LuChevronRight, LuEllipsis } from \"react-icons/lu\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { type ButtonProps, buttonVariants } from \"./button\";\n\nconst Pagination = ({ className, ...props }: React.ComponentProps<\"nav\">) => (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n);\nPagination.displayName = \"Pagination\";\n\nconst PaginationContent = React.forwardRef<\n HTMLUListElement,\n React.ComponentProps<\"ul\">\n>(({ className, ...props }, ref) => (\n <ul\n ref={ref}\n className={cn(\"flex flex-row items-center gap-1\", className)}\n {...props}\n />\n));\nPaginationContent.displayName = \"PaginationContent\";\n\nconst PaginationItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentProps<\"li\">\n>(({ className, ...props }, ref) => (\n <li ref={ref} className={cn(\"\", className)} {...props} />\n));\nPaginationItem.displayName = \"PaginationItem\";\n\ntype PaginationLinkProps = {\n isActive?: boolean;\n} & Pick<ButtonProps, \"size\"> &\n React.ComponentProps<\"a\">;\n\nconst PaginationLink = ({\n className,\n isActive,\n size = \"icon\",\n ...props\n}: PaginationLinkProps) => (\n <a\n aria-current={isActive ? \"page\" : undefined}\n className={cn(\n buttonVariants({\n variant: isActive ? \"outline\" : \"ghost\",\n size,\n }),\n className,\n )}\n {...props}\n />\n);\nPaginationLink.displayName = \"PaginationLink\";\n\nconst PaginationPrevious = ({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to previous page\"\n size=\"default\"\n className={cn(\"gap-1 pl-2.5\", className)}\n {...props}\n >\n <LuChevronLeft className=\"h-4 w-4\" />\n <span>Prev</span>\n </PaginationLink>\n);\nPaginationPrevious.displayName = \"PaginationPrevious\";\n\nconst PaginationNext = ({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to next page\"\n size=\"default\"\n className={cn(\"gap-1 pr-2.5\", className)}\n {...props}\n >\n <span>Next</span>\n <LuChevronRight className=\"h-4 w-4\" />\n </PaginationLink>\n);\nPaginationNext.displayName = \"PaginationNext\";\n\nconst PaginationEllipsis = ({\n className,\n ...props\n}: React.ComponentProps<\"span\">) => (\n <span\n aria-hidden\n className={cn(\"flex h-9 w-9 items-center justify-center\", className)}\n {...props}\n >\n <LuEllipsis className=\"h-4 w-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n);\nPaginationEllipsis.displayName = \"PaginationEllipsis\";\n\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n};\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/pagination.tsx"],"sourcesContent":["/** Pagination navigation components, styled with buttonVariants. */\n\"use client\";\n\nimport * as React from \"react\";\nimport { LuChevronLeft, LuChevronRight, LuEllipsis } from \"react-icons/lu\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { type ButtonProps, buttonVariants } from \"./button\";\n\nconst Pagination = ({ className, ...props }: React.ComponentProps<\"nav\">) => (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n);\nPagination.displayName = \"Pagination\";\n\nconst PaginationContent = React.forwardRef<\n HTMLUListElement,\n React.ComponentProps<\"ul\">\n>(({ className, ...props }, ref) => (\n <ul\n ref={ref}\n className={cn(\"flex flex-row items-center gap-1\", className)}\n {...props}\n />\n));\nPaginationContent.displayName = \"PaginationContent\";\n\nconst PaginationItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentProps<\"li\">\n>(({ className, ...props }, ref) => (\n <li ref={ref} className={cn(\"\", className)} {...props} />\n));\nPaginationItem.displayName = \"PaginationItem\";\n\ntype PaginationLinkProps = {\n isActive?: boolean;\n} & Pick<ButtonProps, \"size\"> &\n React.ComponentProps<\"a\">;\n\nconst PaginationLink = ({\n className,\n isActive,\n size = \"icon\",\n ...props\n}: PaginationLinkProps) => (\n <a\n aria-current={isActive ? \"page\" : undefined}\n className={cn(\n buttonVariants({\n variant: isActive ? \"outline\" : \"ghost\",\n size,\n }),\n className,\n )}\n {...props}\n />\n);\nPaginationLink.displayName = \"PaginationLink\";\n\nconst PaginationPrevious = ({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to previous page\"\n size=\"default\"\n className={cn(\"gap-1 pl-2.5\", className)}\n {...props}\n >\n <LuChevronLeft className=\"h-4 w-4\" />\n <span>Prev</span>\n </PaginationLink>\n);\nPaginationPrevious.displayName = \"PaginationPrevious\";\n\nconst PaginationNext = ({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) => (\n <PaginationLink\n aria-label=\"Go to next page\"\n size=\"default\"\n className={cn(\"gap-1 pr-2.5\", className)}\n {...props}\n >\n <span>Next</span>\n <LuChevronRight className=\"h-4 w-4\" />\n </PaginationLink>\n);\nPaginationNext.displayName = \"PaginationNext\";\n\nconst PaginationEllipsis = ({\n className,\n ...props\n}: React.ComponentProps<\"span\">) => (\n <span\n aria-hidden\n className={cn(\"flex h-9 w-9 items-center justify-center\", className)}\n {...props}\n >\n <LuEllipsis className=\"h-4 w-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n);\nPaginationEllipsis.displayName = \"PaginationEllipsis\";\n\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n};\n"],"mappings":";;;;;;;AAGA,YAAY,WAAW;AACvB,SAAS,eAAe,gBAAgB,kBAAkB;AAC1D,SAAS,UAAU;AAIjB,cA0DA,YA1DA;AADF,IAAM,aAAa,CAAC,EAAE,WAAW,GAAG,MAAM,MACxC;AAAA,EAAC;AAAA;AAAA,IACC,MAAK;AAAA,IACL,cAAW;AAAA,IACX,WAAW,GAAG,sCAAsC,SAAS;AAAA,IAC5D,GAAG;AAAA;AACN;AAEF,WAAW,cAAc;AAEzB,IAAM,oBAA0B,iBAG9B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,WAAW,GAAG,oCAAoC,SAAS;AAAA,IAC1D,GAAG;AAAA;AACN,CACD;AACD,kBAAkB,cAAc;AAEhC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B,oBAAC,QAAG,KAAU,WAAW,GAAG,IAAI,SAAS,GAAI,GAAG,OAAO,CACxD;AACD,eAAe,cAAc;AAO7B,IAAM,iBAAiB,CAAC;AAAA,EACtB;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,MACE;AAAA,EAAC;AAAA;AAAA,IACC,gBAAc,WAAW,SAAS;AAAA,IAClC,WAAW;AAAA,MACT,eAAe;AAAA,QACb,SAAS,WAAW,YAAY;AAAA,QAChC;AAAA,MACF,CAAC;AAAA,MACD;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN;AAEF,eAAe,cAAc;AAE7B,IAAM,qBAAqB,CAAC;AAAA,EAC1B;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA;AAAA,IACC,cAAW;AAAA,IACX,MAAK;AAAA,IACL,WAAW,GAAG,gBAAgB,SAAS;AAAA,IACtC,GAAG;AAAA,IAEJ;AAAA,0BAAC,iBAAc,WAAU,WAAU;AAAA,MACnC,oBAAC,UAAK,kBAAI;AAAA;AAAA;AACZ;AAEF,mBAAmB,cAAc;AAEjC,IAAM,iBAAiB,CAAC;AAAA,EACtB;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA;AAAA,IACC,cAAW;AAAA,IACX,MAAK;AAAA,IACL,WAAW,GAAG,gBAAgB,SAAS;AAAA,IACtC,GAAG;AAAA,IAEJ;AAAA,0BAAC,UAAK,kBAAI;AAAA,MACV,oBAAC,kBAAe,WAAU,WAAU;AAAA;AAAA;AACtC;AAEF,eAAe,cAAc;AAE7B,IAAM,qBAAqB,CAAC;AAAA,EAC1B;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA;AAAA,IACC,eAAW;AAAA,IACX,WAAW,GAAG,4CAA4C,SAAS;AAAA,IAClE,GAAG;AAAA,IAEJ;AAAA,0BAAC,cAAW,WAAU,WAAU;AAAA,MAChC,oBAAC,UAAK,WAAU,WAAU,wBAAU;AAAA;AAAA;AACtC;AAEF,mBAAmB,cAAc;","names":[]}
|
package/dist/popover.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/popover.cjs","../src/popover.tsx"],"names":[],"mappings":"AAAA,uWAAY;AACZ,YAAY;AACZ;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/popover.cjs","../src/popover.tsx"],"names":[],"mappings":"AAAA,uWAAY;AACZ,YAAY;AACZ;AACA;ACAA,2EAAuB;AACvB,sHAAkC;AAClC,sDAAmB;AAaf,+CAAA;AAXJ,IAAM,QAAA,EAA2B,gBAAA,CAAA,IAAA;AAEjC,IAAM,eAAA,EAAkC,gBAAA,CAAA,OAAA;AAExC,IAAM,cAAA,EAAiC,gBAAA,CAAA,MAAA;AAEvC,IAAM,eAAA,EAAuB,KAAA,CAAA,UAAA,CAG3B,CAAC,EAAE,SAAA,EAAW,MAAA,EAAQ,QAAA,EAAU,WAAA,EAAa,CAAA,EAAG,GAAG,MAAM,CAAA,EAAG,GAAA,EAAA,mBAC5D,6BAAA,gBAAkB,CAAA,MAAA,EAAjB,EACC,QAAA,kBAAA,6BAAA;AAAA,EAAkB,gBAAA,CAAA,OAAA;AAAA,EAAjB;AAAA,IACC,GAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA,EAAW,qBAAA;AAAA,MACT,4aAAA;AAAA,MACA;AAAA,IACF,CAAA;AAAA,IACC,GAAG;AAAA,EAAA;AACN,EAAA,CACF,CACD,CAAA;AACD,cAAA,CAAe,YAAA,EAA+B,gBAAA,CAAA,OAAA,CAAQ,WAAA;ADLtD;AACE;AACA;AACA;AACA;AACF,mJAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/popover.cjs","sourcesContent":[null,"/** Styled wrapper around @radix-ui/react-popover. See https://www.radix-ui.com/primitives/docs/components/popover */\n\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\n\nconst Popover = PopoverPrimitive.Root;\n\nconst PopoverTrigger = PopoverPrimitive.Trigger;\n\nconst PopoverAnchor = PopoverPrimitive.Anchor;\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\n"]}
|
package/dist/popover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/popover.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\n\nconst Popover = PopoverPrimitive.Root;\n\nconst PopoverTrigger = PopoverPrimitive.Trigger;\n\nconst PopoverAnchor = PopoverPrimitive.Anchor;\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"sources":["../src/popover.tsx"],"sourcesContent":["/** Styled wrapper around @radix-ui/react-popover. See https://www.radix-ui.com/primitives/docs/components/popover */\n\"use client\";\n\nimport * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\n\nconst Popover = PopoverPrimitive.Root;\n\nconst PopoverTrigger = PopoverPrimitive.Trigger;\n\nconst PopoverAnchor = PopoverPrimitive.Anchor;\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };\n"],"mappings":";;;;AAGA,YAAY,WAAW;AACvB,YAAY,sBAAsB;AAClC,SAAS,UAAU;AAaf;AAXJ,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAExC,IAAM,gBAAiC;AAEvC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,QAAQ,UAAU,aAAa,GAAG,GAAG,MAAM,GAAG,QAC5D,oBAAkB,yBAAjB,EACC;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,GACF,CACD;AACD,eAAe,cAA+B,yBAAQ;","names":[]}
|
package/dist/price-format.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkI4Q2GZZKcjs = require('./chunk-I4Q2GZZK.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
exports.createFormatPrice =
|
|
7
|
+
exports.createFormatPrice = _chunkI4Q2GZZKcjs.createFormatPrice;
|
|
8
8
|
//# sourceMappingURL=price-format.cjs.map
|
package/dist/price-format.d.cts
CHANGED
|
@@ -12,6 +12,10 @@ interface FormatPriceOptions {
|
|
|
12
12
|
/** Multiply value by quantity before formatting. */
|
|
13
13
|
quantity?: number;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a pure price-formatting function. Server-safe (no React dependency).
|
|
17
|
+
* Use {@link createPrice} in client components for the full Price component.
|
|
18
|
+
*/
|
|
15
19
|
declare function createFormatPrice(config?: PriceFormatConfig): (value: number, options?: FormatPriceOptions) => string;
|
|
16
20
|
|
|
17
21
|
export { type FormatPriceOptions, type PriceFormatConfig, createFormatPrice };
|
package/dist/price-format.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ interface FormatPriceOptions {
|
|
|
12
12
|
/** Multiply value by quantity before formatting. */
|
|
13
13
|
quantity?: number;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a pure price-formatting function. Server-safe (no React dependency).
|
|
17
|
+
* Use {@link createPrice} in client components for the full Price component.
|
|
18
|
+
*/
|
|
15
19
|
declare function createFormatPrice(config?: PriceFormatConfig): (value: number, options?: FormatPriceOptions) => string;
|
|
16
20
|
|
|
17
21
|
export { type FormatPriceOptions, type PriceFormatConfig, createFormatPrice };
|
package/dist/price-format.js
CHANGED
package/dist/price.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkI4Q2GZZKcjs = require('./chunk-I4Q2GZZK.cjs');
|
|
6
6
|
|
|
7
7
|
// src/price.tsx
|
|
8
8
|
var _web = require('@simpleapps-com/augur-utils/web');
|
|
@@ -23,7 +23,7 @@ function createPrice(config = {}) {
|
|
|
23
23
|
uomSeparator,
|
|
24
24
|
classNames: factoryClassNames
|
|
25
25
|
} = { ...defaults, ...config };
|
|
26
|
-
const formatPrice =
|
|
26
|
+
const formatPrice = _chunkI4Q2GZZKcjs.createFormatPrice.call(void 0, { currency, locale, precision });
|
|
27
27
|
const slotKeys = [
|
|
28
28
|
"amount",
|
|
29
29
|
"uom",
|
package/dist/price.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/price.cjs","../src/price.tsx"],"names":["slots"],"mappings":"AAAA,ylBAAY;AACZ,YAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,sDAAmB;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/price.cjs","../src/price.tsx"],"names":["slots"],"mappings":"AAAA,ylBAAY;AACZ,YAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,sDAAmB;AAgIX,+CAA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AA,MAAC,EAAA,EAAK,SAAA,EAAW,KAAA,CAAM,MAAA,EAAS,QAAA,EAAA,UAAA,CAAU,CAAA;AAAA,MACzC,IAAA,mBACC,8BAAA,oBAAA,EAAA,EACE,QAAA,EAAA;AAAA,wBAAA,6BAAA,MAAC,EAAA,EAAK,SAAA,EAAW,qBAAA,MAAG,EAAQ,KAAA,CAAM,SAAS,CAAA,EACxC,QAAA,EAAA,aAAA,CACH,CAAA;AAAA,wBACA,6BAAA,MAAC,EAAA,EAAK,SAAA,EAAW,qBAAA,4BAAG,EAA8B,KAAA,CAAM,GAAG,CAAA,EACxD,QAAA,EAAA,IAAA,CACH;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,EAAA,CAEJ,CAAA;AAAA,EAEJ;AAEA,EAAA,KAAA,CAAM,YAAA,EAAc,OAAA;AAEpB,EAAA,OAAO,EAAE,KAAA,EAAO,YAAY,CAAA;AAC9B;ADxGA;AACE;AACF,kCAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/price.cjs","sourcesContent":[null,"\"use client\";\n\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { createFormatPrice } from \"./price-format\";\nimport type { FormatPriceOptions } from \"./price-format\";\n\n// Re-export server-safe types so client consumers get everything from one path\nexport type { PriceFormatConfig, FormatPriceOptions } from \"./price-format\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface PriceClassNames {\n /** The formatted amount text. */\n amount?: string;\n /** The UOM label (e.g. \"EACH\"). */\n uom?: string;\n /** The separator between price and UOM (e.g. \"/\"). */\n separator?: string;\n /** The zero-price label (e.g. \"Call for Price\"). */\n zero?: string;\n /** The loading skeleton. */\n skeleton?: string;\n /** The strikethrough original price. */\n original?: string;\n}\n\nexport interface PriceConfig {\n /** ISO 4217 currency code. Default: `\"USD\"`. */\n currency?: string;\n /** BCP 47 locale. Default: `\"en-US\"`. */\n locale?: string;\n /** Decimal places. Default: `2`. */\n precision?: number;\n /** Label shown when value is 0. Default: `\"Call for Price\"`. */\n zeroLabel?: string;\n /** Separator between price and UOM. Default: `\"/\"`. */\n uomSeparator?: string;\n /** Default class names for sub-elements. */\n classNames?: PriceClassNames;\n}\n\ntype PricePropsBase = {\n /** Unit price. */\n value?: number;\n /** Quantity — multiplied by value for extended price. */\n quantity?: number;\n /** Unit of measure label (e.g. \"EACH\", \"FT\"). */\n uom?: string;\n /** Override precision for this instance. */\n precision?: number;\n /** Original price shown as strikethrough for sale display. */\n originalValue?: number;\n /** Additional class names for the root element. */\n className?: string;\n /** Class names for sub-elements, merged with factory defaults. */\n classNames?: PriceClassNames;\n};\n\nexport type PriceProps =\n | (PricePropsBase & { loading?: false })\n | { loading: true; className?: string; classNames?: PriceClassNames };\n\nexport interface CreatePriceResult {\n Price: React.FC<PriceProps>;\n formatPrice: (value: number, options?: FormatPriceOptions) => string;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nconst defaults = {\n currency: \"USD\",\n locale: \"en-US\",\n precision: 2,\n zeroLabel: \"Call for Price\",\n uomSeparator: \"/\",\n} as const;\n\n/**\n * Factory that creates a `Price` component and a `formatPrice` function\n * pre-configured with site-level currency/locale/precision.\n *\n * @example\n * ```tsx\n * // lib/price.ts -- one-time site config\n * import { createPrice } from \"@simpleapps-com/augur-web/price\";\n * export const { Price, formatPrice } = createPrice({\n * currency: \"USD\",\n * zeroLabel: \"Call for Price\",\n * });\n *\n * // components/ProductCard.tsx\n * <Price value={item.price1} uom={item.default_selling_unit} />\n * ```\n */\nexport function createPrice(config: PriceConfig = {}): CreatePriceResult {\n const {\n currency,\n locale,\n precision,\n zeroLabel,\n uomSeparator,\n classNames: factoryClassNames,\n } = { ...defaults, ...config };\n\n const formatPrice = createFormatPrice({ currency, locale, precision });\n\n const slotKeys: (keyof PriceClassNames)[] = [\n \"amount\", \"uom\", \"separator\", \"zero\", \"skeleton\", \"original\",\n ];\n\n function mergeClassNames(\n instance?: PriceClassNames,\n ): PriceClassNames {\n if (!factoryClassNames && !instance) return {};\n const result: PriceClassNames = {};\n for (const key of slotKeys) {\n const merged = cn(factoryClassNames?.[key], instance?.[key]);\n if (merged) result[key] = merged;\n }\n return result;\n }\n\n function Price(props: PriceProps) {\n if (\"loading\" in props && props.loading) {\n const slots = mergeClassNames(props.classNames);\n return (\n <span\n className={cn(\n \"inline-block h-4 w-16 animate-pulse rounded bg-muted\",\n slots.skeleton,\n props.className,\n )}\n />\n );\n }\n\n const {\n value = 0,\n quantity,\n uom,\n precision: instancePrecision,\n originalValue,\n className,\n classNames: instanceClassNames,\n } = props as PricePropsBase;\n\n const slots = mergeClassNames(instanceClassNames);\n\n if (value === 0 && originalValue === undefined) {\n return (\n <span className={cn(\"text-muted-foreground\", slots.zero, className)}>\n {zeroLabel}\n </span>\n );\n }\n\n const formatted = formatPrice(value, {\n precision: instancePrecision,\n quantity,\n });\n\n return (\n <span className={className}>\n {originalValue !== undefined && (\n <s className={cn(\"mr-1 text-muted-foreground\", slots.original)}>\n {formatPrice(originalValue, { precision: instancePrecision })}\n </s>\n )}\n <span className={slots.amount}>{formatted}</span>\n {uom && (\n <>\n <span className={cn(\"ml-1\", slots.separator)}>\n {uomSeparator}\n </span>\n <span className={cn(\"ml-1 text-muted-foreground\", slots.uom)}>\n {uom}\n </span>\n </>\n )}\n </span>\n );\n }\n\n Price.displayName = \"Price\";\n\n return { Price, formatPrice };\n}\n"]}
|
package/dist/price.d.cts
CHANGED
|
@@ -56,6 +56,23 @@ interface CreatePriceResult {
|
|
|
56
56
|
Price: React.FC<PriceProps>;
|
|
57
57
|
formatPrice: (value: number, options?: FormatPriceOptions) => string;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Factory that creates a `Price` component and a `formatPrice` function
|
|
61
|
+
* pre-configured with site-level currency/locale/precision.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* // lib/price.ts -- one-time site config
|
|
66
|
+
* import { createPrice } from "@simpleapps-com/augur-web/price";
|
|
67
|
+
* export const { Price, formatPrice } = createPrice({
|
|
68
|
+
* currency: "USD",
|
|
69
|
+
* zeroLabel: "Call for Price",
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // components/ProductCard.tsx
|
|
73
|
+
* <Price value={item.price1} uom={item.default_selling_unit} />
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
59
76
|
declare function createPrice(config?: PriceConfig): CreatePriceResult;
|
|
60
77
|
|
|
61
78
|
export { type CreatePriceResult, FormatPriceOptions, type PriceClassNames, type PriceConfig, type PriceProps, createPrice };
|
package/dist/price.d.ts
CHANGED
|
@@ -56,6 +56,23 @@ interface CreatePriceResult {
|
|
|
56
56
|
Price: React.FC<PriceProps>;
|
|
57
57
|
formatPrice: (value: number, options?: FormatPriceOptions) => string;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Factory that creates a `Price` component and a `formatPrice` function
|
|
61
|
+
* pre-configured with site-level currency/locale/precision.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* // lib/price.ts -- one-time site config
|
|
66
|
+
* import { createPrice } from "@simpleapps-com/augur-web/price";
|
|
67
|
+
* export const { Price, formatPrice } = createPrice({
|
|
68
|
+
* currency: "USD",
|
|
69
|
+
* zeroLabel: "Call for Price",
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // components/ProductCard.tsx
|
|
73
|
+
* <Price value={item.price1} uom={item.default_selling_unit} />
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
59
76
|
declare function createPrice(config?: PriceConfig): CreatePriceResult;
|
|
60
77
|
|
|
61
78
|
export { type CreatePriceResult, FormatPriceOptions, type PriceClassNames, type PriceConfig, type PriceProps, createPrice };
|
package/dist/price.js
CHANGED
package/dist/price.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/price.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { createFormatPrice } from \"./price-format\";\nimport type { FormatPriceOptions } from \"./price-format\";\n\n// Re-export server-safe types so client consumers get everything from one path\nexport type { PriceFormatConfig, FormatPriceOptions } from \"./price-format\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface PriceClassNames {\n /** The formatted amount text. */\n amount?: string;\n /** The UOM label (e.g. \"EACH\"). */\n uom?: string;\n /** The separator between price and UOM (e.g. \"/\"). */\n separator?: string;\n /** The zero-price label (e.g. \"Call for Price\"). */\n zero?: string;\n /** The loading skeleton. */\n skeleton?: string;\n /** The strikethrough original price. */\n original?: string;\n}\n\nexport interface PriceConfig {\n /** ISO 4217 currency code. Default: `\"USD\"`. */\n currency?: string;\n /** BCP 47 locale. Default: `\"en-US\"`. */\n locale?: string;\n /** Decimal places. Default: `2`. */\n precision?: number;\n /** Label shown when value is 0. Default: `\"Call for Price\"`. */\n zeroLabel?: string;\n /** Separator between price and UOM. Default: `\"/\"`. */\n uomSeparator?: string;\n /** Default class names for sub-elements. */\n classNames?: PriceClassNames;\n}\n\ntype PricePropsBase = {\n /** Unit price. */\n value?: number;\n /** Quantity — multiplied by value for extended price. */\n quantity?: number;\n /** Unit of measure label (e.g. \"EACH\", \"FT\"). */\n uom?: string;\n /** Override precision for this instance. */\n precision?: number;\n /** Original price shown as strikethrough for sale display. */\n originalValue?: number;\n /** Additional class names for the root element. */\n className?: string;\n /** Class names for sub-elements, merged with factory defaults. */\n classNames?: PriceClassNames;\n};\n\nexport type PriceProps =\n | (PricePropsBase & { loading?: false })\n | { loading: true; className?: string; classNames?: PriceClassNames };\n\nexport interface CreatePriceResult {\n Price: React.FC<PriceProps>;\n formatPrice: (value: number, options?: FormatPriceOptions) => string;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nconst defaults = {\n currency: \"USD\",\n locale: \"en-US\",\n precision: 2,\n zeroLabel: \"Call for Price\",\n uomSeparator: \"/\",\n} as const;\n\nexport function createPrice(config: PriceConfig = {}): CreatePriceResult {\n const {\n currency,\n locale,\n precision,\n zeroLabel,\n uomSeparator,\n classNames: factoryClassNames,\n } = { ...defaults, ...config };\n\n const formatPrice = createFormatPrice({ currency, locale, precision });\n\n const slotKeys: (keyof PriceClassNames)[] = [\n \"amount\", \"uom\", \"separator\", \"zero\", \"skeleton\", \"original\",\n ];\n\n function mergeClassNames(\n instance?: PriceClassNames,\n ): PriceClassNames {\n if (!factoryClassNames && !instance) return {};\n const result: PriceClassNames = {};\n for (const key of slotKeys) {\n const merged = cn(factoryClassNames?.[key], instance?.[key]);\n if (merged) result[key] = merged;\n }\n return result;\n }\n\n function Price(props: PriceProps) {\n if (\"loading\" in props && props.loading) {\n const slots = mergeClassNames(props.classNames);\n return (\n <span\n className={cn(\n \"inline-block h-4 w-16 animate-pulse rounded bg-muted\",\n slots.skeleton,\n props.className,\n )}\n />\n );\n }\n\n const {\n value = 0,\n quantity,\n uom,\n precision: instancePrecision,\n originalValue,\n className,\n classNames: instanceClassNames,\n } = props as PricePropsBase;\n\n const slots = mergeClassNames(instanceClassNames);\n\n if (value === 0 && originalValue === undefined) {\n return (\n <span className={cn(\"text-muted-foreground\", slots.zero, className)}>\n {zeroLabel}\n </span>\n );\n }\n\n const formatted = formatPrice(value, {\n precision: instancePrecision,\n quantity,\n });\n\n return (\n <span className={className}>\n {originalValue !== undefined && (\n <s className={cn(\"mr-1 text-muted-foreground\", slots.original)}>\n {formatPrice(originalValue, { precision: instancePrecision })}\n </s>\n )}\n <span className={slots.amount}>{formatted}</span>\n {uom && (\n <>\n <span className={cn(\"ml-1\", slots.separator)}>\n {uomSeparator}\n </span>\n <span className={cn(\"ml-1 text-muted-foreground\", slots.uom)}>\n {uom}\n </span>\n </>\n )}\n </span>\n );\n }\n\n Price.displayName = \"Price\";\n\n return { Price, formatPrice };\n}\n"],"mappings":";;;;;;;AAEA,SAAS,UAAU;
|
|
1
|
+
{"version":3,"sources":["../src/price.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { createFormatPrice } from \"./price-format\";\nimport type { FormatPriceOptions } from \"./price-format\";\n\n// Re-export server-safe types so client consumers get everything from one path\nexport type { PriceFormatConfig, FormatPriceOptions } from \"./price-format\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface PriceClassNames {\n /** The formatted amount text. */\n amount?: string;\n /** The UOM label (e.g. \"EACH\"). */\n uom?: string;\n /** The separator between price and UOM (e.g. \"/\"). */\n separator?: string;\n /** The zero-price label (e.g. \"Call for Price\"). */\n zero?: string;\n /** The loading skeleton. */\n skeleton?: string;\n /** The strikethrough original price. */\n original?: string;\n}\n\nexport interface PriceConfig {\n /** ISO 4217 currency code. Default: `\"USD\"`. */\n currency?: string;\n /** BCP 47 locale. Default: `\"en-US\"`. */\n locale?: string;\n /** Decimal places. Default: `2`. */\n precision?: number;\n /** Label shown when value is 0. Default: `\"Call for Price\"`. */\n zeroLabel?: string;\n /** Separator between price and UOM. Default: `\"/\"`. */\n uomSeparator?: string;\n /** Default class names for sub-elements. */\n classNames?: PriceClassNames;\n}\n\ntype PricePropsBase = {\n /** Unit price. */\n value?: number;\n /** Quantity — multiplied by value for extended price. */\n quantity?: number;\n /** Unit of measure label (e.g. \"EACH\", \"FT\"). */\n uom?: string;\n /** Override precision for this instance. */\n precision?: number;\n /** Original price shown as strikethrough for sale display. */\n originalValue?: number;\n /** Additional class names for the root element. */\n className?: string;\n /** Class names for sub-elements, merged with factory defaults. */\n classNames?: PriceClassNames;\n};\n\nexport type PriceProps =\n | (PricePropsBase & { loading?: false })\n | { loading: true; className?: string; classNames?: PriceClassNames };\n\nexport interface CreatePriceResult {\n Price: React.FC<PriceProps>;\n formatPrice: (value: number, options?: FormatPriceOptions) => string;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nconst defaults = {\n currency: \"USD\",\n locale: \"en-US\",\n precision: 2,\n zeroLabel: \"Call for Price\",\n uomSeparator: \"/\",\n} as const;\n\n/**\n * Factory that creates a `Price` component and a `formatPrice` function\n * pre-configured with site-level currency/locale/precision.\n *\n * @example\n * ```tsx\n * // lib/price.ts -- one-time site config\n * import { createPrice } from \"@simpleapps-com/augur-web/price\";\n * export const { Price, formatPrice } = createPrice({\n * currency: \"USD\",\n * zeroLabel: \"Call for Price\",\n * });\n *\n * // components/ProductCard.tsx\n * <Price value={item.price1} uom={item.default_selling_unit} />\n * ```\n */\nexport function createPrice(config: PriceConfig = {}): CreatePriceResult {\n const {\n currency,\n locale,\n precision,\n zeroLabel,\n uomSeparator,\n classNames: factoryClassNames,\n } = { ...defaults, ...config };\n\n const formatPrice = createFormatPrice({ currency, locale, precision });\n\n const slotKeys: (keyof PriceClassNames)[] = [\n \"amount\", \"uom\", \"separator\", \"zero\", \"skeleton\", \"original\",\n ];\n\n function mergeClassNames(\n instance?: PriceClassNames,\n ): PriceClassNames {\n if (!factoryClassNames && !instance) return {};\n const result: PriceClassNames = {};\n for (const key of slotKeys) {\n const merged = cn(factoryClassNames?.[key], instance?.[key]);\n if (merged) result[key] = merged;\n }\n return result;\n }\n\n function Price(props: PriceProps) {\n if (\"loading\" in props && props.loading) {\n const slots = mergeClassNames(props.classNames);\n return (\n <span\n className={cn(\n \"inline-block h-4 w-16 animate-pulse rounded bg-muted\",\n slots.skeleton,\n props.className,\n )}\n />\n );\n }\n\n const {\n value = 0,\n quantity,\n uom,\n precision: instancePrecision,\n originalValue,\n className,\n classNames: instanceClassNames,\n } = props as PricePropsBase;\n\n const slots = mergeClassNames(instanceClassNames);\n\n if (value === 0 && originalValue === undefined) {\n return (\n <span className={cn(\"text-muted-foreground\", slots.zero, className)}>\n {zeroLabel}\n </span>\n );\n }\n\n const formatted = formatPrice(value, {\n precision: instancePrecision,\n quantity,\n });\n\n return (\n <span className={className}>\n {originalValue !== undefined && (\n <s className={cn(\"mr-1 text-muted-foreground\", slots.original)}>\n {formatPrice(originalValue, { precision: instancePrecision })}\n </s>\n )}\n <span className={slots.amount}>{formatted}</span>\n {uom && (\n <>\n <span className={cn(\"ml-1\", slots.separator)}>\n {uomSeparator}\n </span>\n <span className={cn(\"ml-1 text-muted-foreground\", slots.uom)}>\n {uom}\n </span>\n </>\n )}\n </span>\n );\n }\n\n Price.displayName = \"Price\";\n\n return { Price, formatPrice };\n}\n"],"mappings":";;;;;;;AAEA,SAAS,UAAU;AAgIX,SA4CE,UA5CF,KA4CE,YA5CF;AAzDR,IAAM,WAAW;AAAA,EACf,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,WAAW;AAAA,EACX,cAAc;AAChB;AAmBO,SAAS,YAAY,SAAsB,CAAC,GAAsB;AACvE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EACd,IAAI,EAAE,GAAG,UAAU,GAAG,OAAO;AAE7B,QAAM,cAAc,kBAAkB,EAAE,UAAU,QAAQ,UAAU,CAAC;AAErE,QAAM,WAAsC;AAAA,IAC1C;AAAA,IAAU;AAAA,IAAO;AAAA,IAAa;AAAA,IAAQ;AAAA,IAAY;AAAA,EACpD;AAEA,WAAS,gBACP,UACiB;AACjB,QAAI,CAAC,qBAAqB,CAAC,SAAU,QAAO,CAAC;AAC7C,UAAM,SAA0B,CAAC;AACjC,eAAW,OAAO,UAAU;AAC1B,YAAM,SAAS,GAAG,oBAAoB,GAAG,GAAG,WAAW,GAAG,CAAC;AAC3D,UAAI,OAAQ,QAAO,GAAG,IAAI;AAAA,IAC5B;AACA,WAAO;AAAA,EACT;AAEA,WAAS,MAAM,OAAmB;AAChC,QAAI,aAAa,SAAS,MAAM,SAAS;AACvC,YAAMA,SAAQ,gBAAgB,MAAM,UAAU;AAC9C,aACE;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,YACT;AAAA,YACAA,OAAM;AAAA,YACN,MAAM;AAAA,UACR;AAAA;AAAA,MACF;AAAA,IAEJ;AAEA,UAAM;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,YAAY;AAAA,IACd,IAAI;AAEJ,UAAM,QAAQ,gBAAgB,kBAAkB;AAEhD,QAAI,UAAU,KAAK,kBAAkB,QAAW;AAC9C,aACE,oBAAC,UAAK,WAAW,GAAG,yBAAyB,MAAM,MAAM,SAAS,GAC/D,qBACH;AAAA,IAEJ;AAEA,UAAM,YAAY,YAAY,OAAO;AAAA,MACnC,WAAW;AAAA,MACX;AAAA,IACF,CAAC;AAED,WACE,qBAAC,UAAK,WACH;AAAA,wBAAkB,UACjB,oBAAC,OAAE,WAAW,GAAG,8BAA8B,MAAM,QAAQ,GAC1D,sBAAY,eAAe,EAAE,WAAW,kBAAkB,CAAC,GAC9D;AAAA,MAEF,oBAAC,UAAK,WAAW,MAAM,QAAS,qBAAU;AAAA,MACzC,OACC,iCACE;AAAA,4BAAC,UAAK,WAAW,GAAG,QAAQ,MAAM,SAAS,GACxC,wBACH;AAAA,QACA,oBAAC,UAAK,WAAW,GAAG,8BAA8B,MAAM,GAAG,GACxD,eACH;AAAA,SACF;AAAA,OAEJ;AAAA,EAEJ;AAEA,QAAM,cAAc;AAEpB,SAAO,EAAE,OAAO,YAAY;AAC9B;","names":["slots"]}
|
package/dist/provider.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/provider.cjs","../src/provider.tsx"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,yDAAmC;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/provider.cjs","../src/provider.tsx"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,yDAAmC;AA2D3B,+CAAA;AAXD,SAAS,iBAAA,CAAkB;AAAA,EAChC,MAAA;AAAA,EACA,GAAA;AAAA,EACA,IAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,EAA2B;AACzB,EAAA,uBACE,6BAAA,8BAAC,EAAA,EAAmB,GAAA,EAAU,IAAA,EAAY,SAAA,EAAsB,KAAA,EAAc,IAAA,EAAM,MAAA,EACjF,QAAA,EAAA,MAAA,CAAO,UAAA,kBACN,6BAAA;AAAA,IAAC,mCAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,MAAA,CAAO,SAAA,CAAU,KAAA;AAAA,MACxB,eAAA,EAAiB,MAAA,CAAO,SAAA,CAAU,eAAA;AAAA,MAClC,QAAA,EAAU,MAAA,CAAO,SAAA,CAAU,QAAA;AAAA,MAC3B,KAAA,EAAO,MAAA,CAAO,SAAA,CAAU,KAAA;AAAA,MAEvB;AAAA,IAAA;AAAA,EACH,EAAA,EAEA,SAAA,CAEJ,CAAA;AAEJ;AD9CA;AACE;AACF,8CAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/provider.cjs","sourcesContent":[null,"import React, { type ReactNode } from \"react\";\nimport { AugurHooksProvider } from \"@simpleapps-com/augur-hooks\";\nimport type { AugurSiteConfig, AugurAuthContext, CacheConfig } from \"@simpleapps-com/augur-core\";\nimport type { AugurCallbacks } from \"@simpleapps-com/augur-hooks\";\nimport { AnalyticsProvider } from \"./gtm\";\n\nexport interface AugurSiteProviderProps {\n /** Site configuration created with `defineSite()`. */\n config: AugurSiteConfig;\n /** SDK client instance. */\n api?: unknown;\n /** Auth context (NextAuth, Clerk, etc.). */\n auth?: AugurAuthContext;\n /** Callback registry for server action overrides. */\n callbacks?: AugurCallbacks;\n /** Cache configuration (edge/Redis). */\n cache?: CacheConfig;\n children: ReactNode;\n}\n\n/**\n * Unified site provider that composes AugurHooksProvider with analytics\n * based on the site config.\n *\n * The `auth` prop accepts any object matching `AugurAuthContext`.\n * Map your auth provider manually — augur-hooks is auth-provider-agnostic\n * so it works with NextAuth, Clerk, Supabase Auth, etc.\n *\n * NextAuth example:\n * ```tsx\n * import { useSession } from \"next-auth/react\";\n *\n * function Providers({ children }: { children: React.ReactNode }) {\n * const { data: session, status } = useSession();\n * const auth = useMemo<AugurAuthContext>(() => ({\n * status,\n * customerId: session?.user?.customerId,\n * userId: session?.user?.id,\n * cartHdrUid: session?.user?.cartHdrUid,\n * }), [session, status]);\n *\n * return (\n * <AugurSiteProvider config={siteConfig} api={api} auth={auth}>\n * {children}\n * </AugurSiteProvider>\n * );\n * }\n * ```\n */\nexport function AugurSiteProvider({\n config,\n api,\n auth,\n callbacks,\n cache,\n children,\n}: AugurSiteProviderProps) {\n return (\n <AugurHooksProvider api={api} auth={auth} callbacks={callbacks} cache={cache} site={config}>\n {config.analytics ? (\n <AnalyticsProvider\n gtmId={config.analytics.gtmId}\n consentRequired={config.analytics.consentRequired}\n strategy={config.analytics.strategy}\n debug={config.analytics.debug}\n >\n {children}\n </AnalyticsProvider>\n ) : (\n children\n )}\n </AugurHooksProvider>\n );\n}\n"]}
|
package/dist/provider.d.cts
CHANGED
|
@@ -20,10 +20,29 @@ interface AugurSiteProviderProps {
|
|
|
20
20
|
* Unified site provider that composes AugurHooksProvider with analytics
|
|
21
21
|
* based on the site config.
|
|
22
22
|
*
|
|
23
|
+
* The `auth` prop accepts any object matching `AugurAuthContext`.
|
|
24
|
+
* Map your auth provider manually — augur-hooks is auth-provider-agnostic
|
|
25
|
+
* so it works with NextAuth, Clerk, Supabase Auth, etc.
|
|
26
|
+
*
|
|
27
|
+
* NextAuth example:
|
|
23
28
|
* ```tsx
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
29
|
+
* import { useSession } from "next-auth/react";
|
|
30
|
+
*
|
|
31
|
+
* function Providers({ children }: { children: React.ReactNode }) {
|
|
32
|
+
* const { data: session, status } = useSession();
|
|
33
|
+
* const auth = useMemo<AugurAuthContext>(() => ({
|
|
34
|
+
* status,
|
|
35
|
+
* customerId: session?.user?.customerId,
|
|
36
|
+
* userId: session?.user?.id,
|
|
37
|
+
* cartHdrUid: session?.user?.cartHdrUid,
|
|
38
|
+
* }), [session, status]);
|
|
39
|
+
*
|
|
40
|
+
* return (
|
|
41
|
+
* <AugurSiteProvider config={siteConfig} api={api} auth={auth}>
|
|
42
|
+
* {children}
|
|
43
|
+
* </AugurSiteProvider>
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
27
46
|
* ```
|
|
28
47
|
*/
|
|
29
48
|
declare function AugurSiteProvider({ config, api, auth, callbacks, cache, children, }: AugurSiteProviderProps): react_jsx_runtime.JSX.Element;
|
package/dist/provider.d.ts
CHANGED
|
@@ -20,10 +20,29 @@ interface AugurSiteProviderProps {
|
|
|
20
20
|
* Unified site provider that composes AugurHooksProvider with analytics
|
|
21
21
|
* based on the site config.
|
|
22
22
|
*
|
|
23
|
+
* The `auth` prop accepts any object matching `AugurAuthContext`.
|
|
24
|
+
* Map your auth provider manually — augur-hooks is auth-provider-agnostic
|
|
25
|
+
* so it works with NextAuth, Clerk, Supabase Auth, etc.
|
|
26
|
+
*
|
|
27
|
+
* NextAuth example:
|
|
23
28
|
* ```tsx
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
29
|
+
* import { useSession } from "next-auth/react";
|
|
30
|
+
*
|
|
31
|
+
* function Providers({ children }: { children: React.ReactNode }) {
|
|
32
|
+
* const { data: session, status } = useSession();
|
|
33
|
+
* const auth = useMemo<AugurAuthContext>(() => ({
|
|
34
|
+
* status,
|
|
35
|
+
* customerId: session?.user?.customerId,
|
|
36
|
+
* userId: session?.user?.id,
|
|
37
|
+
* cartHdrUid: session?.user?.cartHdrUid,
|
|
38
|
+
* }), [session, status]);
|
|
39
|
+
*
|
|
40
|
+
* return (
|
|
41
|
+
* <AugurSiteProvider config={siteConfig} api={api} auth={auth}>
|
|
42
|
+
* {children}
|
|
43
|
+
* </AugurSiteProvider>
|
|
44
|
+
* );
|
|
45
|
+
* }
|
|
27
46
|
* ```
|
|
28
47
|
*/
|
|
29
48
|
declare function AugurSiteProvider({ config, api, auth, callbacks, cache, children, }: AugurSiteProviderProps): react_jsx_runtime.JSX.Element;
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\nimport { AugurHooksProvider } from \"@simpleapps-com/augur-hooks\";\nimport type { AugurSiteConfig, AugurAuthContext, CacheConfig } from \"@simpleapps-com/augur-core\";\nimport type { AugurCallbacks } from \"@simpleapps-com/augur-hooks\";\nimport { AnalyticsProvider } from \"./gtm\";\n\nexport interface AugurSiteProviderProps {\n /** Site configuration created with `defineSite()`. */\n config: AugurSiteConfig;\n /** SDK client instance. */\n api?: unknown;\n /** Auth context (NextAuth, Clerk, etc.). */\n auth?: AugurAuthContext;\n /** Callback registry for server action overrides. */\n callbacks?: AugurCallbacks;\n /** Cache configuration (edge/Redis). */\n cache?: CacheConfig;\n children: ReactNode;\n}\n\n/**\n * Unified site provider that composes AugurHooksProvider with analytics\n * based on the site config.\n *\n * ```tsx\n * <AugurSiteProvider config={siteConfig} api={api} auth={auth}>\n *
|
|
1
|
+
{"version":3,"sources":["../src/provider.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\nimport { AugurHooksProvider } from \"@simpleapps-com/augur-hooks\";\nimport type { AugurSiteConfig, AugurAuthContext, CacheConfig } from \"@simpleapps-com/augur-core\";\nimport type { AugurCallbacks } from \"@simpleapps-com/augur-hooks\";\nimport { AnalyticsProvider } from \"./gtm\";\n\nexport interface AugurSiteProviderProps {\n /** Site configuration created with `defineSite()`. */\n config: AugurSiteConfig;\n /** SDK client instance. */\n api?: unknown;\n /** Auth context (NextAuth, Clerk, etc.). */\n auth?: AugurAuthContext;\n /** Callback registry for server action overrides. */\n callbacks?: AugurCallbacks;\n /** Cache configuration (edge/Redis). */\n cache?: CacheConfig;\n children: ReactNode;\n}\n\n/**\n * Unified site provider that composes AugurHooksProvider with analytics\n * based on the site config.\n *\n * The `auth` prop accepts any object matching `AugurAuthContext`.\n * Map your auth provider manually — augur-hooks is auth-provider-agnostic\n * so it works with NextAuth, Clerk, Supabase Auth, etc.\n *\n * NextAuth example:\n * ```tsx\n * import { useSession } from \"next-auth/react\";\n *\n * function Providers({ children }: { children: React.ReactNode }) {\n * const { data: session, status } = useSession();\n * const auth = useMemo<AugurAuthContext>(() => ({\n * status,\n * customerId: session?.user?.customerId,\n * userId: session?.user?.id,\n * cartHdrUid: session?.user?.cartHdrUid,\n * }), [session, status]);\n *\n * return (\n * <AugurSiteProvider config={siteConfig} api={api} auth={auth}>\n * {children}\n * </AugurSiteProvider>\n * );\n * }\n * ```\n */\nexport function AugurSiteProvider({\n config,\n api,\n auth,\n callbacks,\n cache,\n children,\n}: AugurSiteProviderProps) {\n return (\n <AugurHooksProvider api={api} auth={auth} callbacks={callbacks} cache={cache} site={config}>\n {config.analytics ? (\n <AnalyticsProvider\n gtmId={config.analytics.gtmId}\n consentRequired={config.analytics.consentRequired}\n strategy={config.analytics.strategy}\n debug={config.analytics.debug}\n >\n {children}\n </AnalyticsProvider>\n ) : (\n children\n )}\n </AugurHooksProvider>\n );\n}\n"],"mappings":";;;;;;AACA,SAAS,0BAA0B;AA2D3B;AAXD,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,SACE,oBAAC,sBAAmB,KAAU,MAAY,WAAsB,OAAc,MAAM,QACjF,iBAAO,YACN;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,OAAO,UAAU;AAAA,MACxB,iBAAiB,OAAO,UAAU;AAAA,MAClC,UAAU,OAAO,UAAU;AAAA,MAC3B,OAAO,OAAO,UAAU;AAAA,MAEvB;AAAA;AAAA,EACH,IAEA,UAEJ;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/quantity-input.cjs","../src/quantity-input.tsx"],"names":[],"mappings":"AAAA,uWAAY;AACZ,YAAY;AACZ;AACA;ACDA,2EAAuB;AACvB,sDAAmB;AACnB,oCAAgC;AAoIxB,+CAAA;AApHR,SAAS,WAAA,CAAY,KAAA,EAAe,IAAA,EAAsB;AACxD,EAAA,GAAA,CAAI,KAAA,GAAQ,CAAA,EAAG,OAAO,KAAA;AACtB,EAAA,OAAO,IAAA,CAAK,IAAA,CAAK,MAAA,EAAQ,IAAI,EAAA,EAAI,IAAA;AACnC;AAEA,IAAM,cAAA,EAAsB,KAAA,CAAA,IAAA;AAAA,EACpB,KAAA,CAAA,UAAA;AAAA,IACJ,CACE;AAAA,MACE,KAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA,EAAM,CAAA;AAAA,MACN,GAAA;AAAA,MACA,KAAA,EAAO,CAAA;AAAA,MACP,SAAA,EAAW,CAAA;AAAA,MACX,YAAA,EAAc,IAAA;AAAA,MACd,SAAA,EAAW,KAAA;AAAA,MACX,SAAA;AAAA,MACA,cAAA;AAAA,MACA;AAAA,IACF,CAAA,EACA,GAAA,EAAA,GACG;AACH,MAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,EAAA,EAAU,KAAA,CAAA,QAAA;AAAA,QAAS,CAAA,EAAA,GACzC,KAAA,CAAM,OAAA,CAAQ,QAAQ;AAAA,MACxB,CAAA;AAEA,MAAM,KAAA,CAAA,SAAA,CAAU,CAAA,EAAA,GAAM;AACpB,QAAA,SAAA,CAAU,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAC,CAAA;AAAA,MACnC,CAAA,EAAG,CAAC,KAAA,EAAO,QAAQ,CAAC,CAAA;AAEpB,MAAA,MAAM,OAAA,EAAe,KAAA,CAAA,WAAA;AAAA,QACnB,CAAC,GAAA,EAAA,GAAgB;AACf,UAA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A,gBACT,SAAA,EAAW,qBAAA;AAAA,kBACT,gFAAA;AAAA,kBACA;AAAA,gBACF,CAAA;AAAA,gBAEA,QAAA,kBAAA,6BAAA,WAAC,EAAA,CAAA,CAAQ;AAAA,cAAA;AAAA,YACX,CAAA;AAAA,4BAEF,6BAAA;AAAA,cAAC,OAAA;AAAA,cAAA;AAAA,gBACC,GAAA;AAAA,gBACA,IAAA,EAAK,MAAA;AAAA,gBACL,SAAA,EAAW,SAAA,EAAW,EAAA,EAAI,UAAA,EAAY,SAAA;AAAA,gBACtC,KAAA,EAAO,MAAA;AAAA,gBACP,QAAA;AAAA,gBACA,SAAA,EAAW,aAAA;AAAA,gBACX,QAAA,EAAU,YAAA;AAAA,gBACV,MAAA,EAAQ,UAAA;AAAA,gBACR,SAAA,EAAW,qBAAA;AAAA,kBACT,yDAAA;AAAA,kBACA;AAAA,gBACF;AAAA,cAAA;AAAA,YACF,CAAA;AAAA,YACC,YAAA,mBACC,6BAAA;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACC,IAAA,EAAK,QAAA;AAAA,gBACL,YAAA,EAAW,mBAAA;AAAA,gBACX,QAAA,EAAU,WAAA;AAAA,gBACV,OAAA,EAAS,eAAA;AAAA,gBACT,SAAA,EAAW,qBAAA;AAAA,kBACT,gFAAA;AAAA,kBACA;AAAA,gBACF,CAAA;AAAA,gBAEA,QAAA,kBAAA,6BAAA,UAAC,EAAA,CAAA,CAAO;AAAA,cAAA;AAAA,YACV;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ,CAAA;AAAA,IAEJ;AAAA,EACF;AACF,CAAA;AACA,aAAA,CAAc,YAAA,EAAc,eAAA;ADzB5B;AACE;AACF,sCAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/quantity-input.cjs","sourcesContent":[null,"\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { LuMinus, LuPlus } from \"react-icons/lu\";\n\nexport interface QuantityInputProps {\n value: number;\n onChange: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n decimals?: number;\n showStepper?: boolean;\n disabled?: boolean;\n className?: string;\n inputClassName?: string;\n buttonClassName?: string;\n}\n\nfunction roundToStep(value: number, step: number): number {\n if (step <= 1) return value;\n return Math.ceil(value / step) * step;\n}\n\nconst QuantityInput = React.memo(\n React.forwardRef<HTMLInputElement, QuantityInputProps>(\n (\n {\n value,\n onChange,\n min = 0,\n max,\n step = 1,\n decimals = 0,\n showStepper = true,\n disabled = false,\n className,\n inputClassName,\n buttonClassName,\n },\n ref,\n ) => {\n const [qtyStr, setQtyStr] = React.useState(() =>\n value.toFixed(decimals),\n );\n\n React.useEffect(() => {\n setQtyStr(value.toFixed(decimals));\n }, [value, decimals]);\n\n const commit = React.useCallback(\n (raw: string) => {\n if (raw.trim() === \"\") {\n setQtyStr(min.toFixed(decimals));\n onChange(min);\n return;\n }\n\n let parsed = parseFloat(raw);\n if (isNaN(parsed)) parsed = min;\n\n parsed = roundToStep(parsed, step);\n if (parsed < min) parsed = min;\n if (max !== undefined && parsed > max) parsed = max;\n\n const rounded = parseFloat(parsed.toFixed(decimals));\n setQtyStr(rounded.toFixed(decimals));\n onChange(rounded);\n },\n [min, max, step, decimals, onChange],\n );\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n const allowed = [\n \"Backspace\",\n \"Delete\",\n \"ArrowLeft\",\n \"ArrowRight\",\n \"Tab\",\n \"Enter\",\n ];\n if (allowed.includes(e.key)) {\n if (e.key === \"Enter\") {\n commit(qtyStr);\n }\n return;\n }\n\n if (decimals > 0 && e.key === \".\" && !qtyStr.includes(\".\")) {\n return;\n }\n\n if (e.key >= \"0\" && e.key <= \"9\") {\n return;\n }\n\n e.preventDefault();\n },\n [decimals, qtyStr, commit],\n );\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const pattern = decimals > 0 ? /[^0-9.]/g : /[^0-9]/g;\n let cleaned = e.target.value.replace(pattern, \"\");\n if (decimals > 0) {\n const parts = cleaned.split(\".\");\n if (parts.length > 2) {\n cleaned = parts[0] + \".\" + parts.slice(1).join(\"\");\n }\n }\n setQtyStr(cleaned);\n },\n [decimals],\n );\n\n const handleBlur = React.useCallback(() => {\n commit(qtyStr);\n }, [commit, qtyStr]);\n\n const handleDecrement = React.useCallback(() => {\n const next = Math.max(value - step, min);\n onChange(next);\n }, [value, step, min, onChange]);\n\n const handleIncrement = React.useCallback(() => {\n const next = value + step;\n onChange(max !== undefined ? Math.min(next, max) : next);\n }, [value, step, max, onChange]);\n\n const minDisabled = disabled || value <= min;\n const maxDisabled = disabled || (max !== undefined && value >= max);\n\n return (\n <div\n className={cn(\n \"inline-flex items-center border rounded-md bg-background\",\n className,\n )}\n >\n {showStepper && (\n <button\n type=\"button\"\n aria-label=\"Decrease quantity\"\n disabled={minDisabled}\n onClick={handleDecrement}\n className={cn(\n \"h-10 w-10 flex items-center justify-center hover:bg-accent disabled:opacity-50\",\n buttonClassName,\n )}\n >\n <LuMinus />\n </button>\n )}\n <input\n ref={ref}\n type=\"text\"\n inputMode={decimals > 0 ? \"decimal\" : \"numeric\"}\n value={qtyStr}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n onBlur={handleBlur}\n className={cn(\n \"h-10 w-16 text-center bg-transparent focus:outline-none\",\n inputClassName,\n )}\n />\n {showStepper && (\n <button\n type=\"button\"\n aria-label=\"Increase quantity\"\n disabled={maxDisabled}\n onClick={handleIncrement}\n className={cn(\n \"h-10 w-10 flex items-center justify-center hover:bg-accent disabled:opacity-50\",\n buttonClassName,\n )}\n >\n <LuPlus />\n </button>\n )}\n </div>\n );\n },\n ),\n);\nQuantityInput.displayName = \"QuantityInput\";\n\nexport { QuantityInput };\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/quantity-input.cjs","../src/quantity-input.tsx"],"names":[],"mappings":"AAAA,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A;AAAA,YACX,CAAA;AAAA,4BAEF,6BAAA;AAAA,cAAC,OAAA;AAAA,cAAA;AAAA,gBACC,GAAA;AAAA,gBACA,IAAA,EAAK,MAAA;AAAA,gBACL,SAAA,EAAW,SAAA,EAAW,EAAA,EAAI,UAAA,EAAY,SAAA;AAAA,gBACtC,KAAA,EAAO,MAAA;AAAA,gBACP,QAAA;AAAA,gBACA,SAAA,EAAW,aAAA;AAAA,gBACX,QAAA,EAAU,YAAA;AAAA,gBACV,MAAA,EAAQ,UAAA;AAAA,gBACR,SAAA,EAAW,qBAAA;AAAA,kBACT,yDAAA;AAAA,kBACA;AAAA,gBACF;AAAA,cAAA;AAAA,YACF,CAAA;AAAA,YACC,YAAA,mBACC,6BAAA;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACC,IAAA,EAAK,QAAA;AAAA,gBACL,YAAA,EAAW,mBAAA;AAAA,gBACX,QAAA,EAAU,WAAA;AAAA,gBACV,OAAA,EAAS,eAAA;AAAA,gBACT,SAAA,EAAW,qBAAA;AAAA,kBACT,gFAAA;AAAA,kBACA;AAAA,gBACF,CAAA;AAAA,gBAEA,QAAA,kBAAA,6BAAA,UAAC,EAAA,CAAA,CAAO;AAAA,cAAA;AAAA,YACV;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ,CAAA;AAAA,IAEJ;AAAA,EACF;AACF,CAAA;AACA,aAAA,CAAc,YAAA,EAAc,eAAA;ADxC5B;AACE;AACF,sCAAC","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-web/dist/quantity-input.cjs","sourcesContent":[null,"\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { LuMinus, LuPlus } from \"react-icons/lu\";\n\nexport interface QuantityInputProps {\n /** Current quantity value (controlled). */\n value: number;\n /** Called with the new quantity after validation and rounding. */\n onChange: (value: number) => void;\n /** Minimum allowed quantity. Default: `0`. */\n min?: number;\n /** Maximum allowed quantity. */\n max?: number;\n /** Increment/decrement step size. Values are rounded up to the nearest step. Default: `1`. */\n step?: number;\n /** Number of decimal places to display. Default: `0`. */\n decimals?: number;\n /** Show +/- stepper buttons. Default: `true`. */\n showStepper?: boolean;\n disabled?: boolean;\n className?: string;\n inputClassName?: string;\n buttonClassName?: string;\n}\n\nfunction roundToStep(value: number, step: number): number {\n if (step <= 1) return value;\n return Math.ceil(value / step) * step;\n}\n\n/**\n * Numeric input with optional +/- stepper buttons for cart quantities.\n *\n * @example\n * ```tsx\n * <QuantityInput value={qty} onChange={setQty} min={1} step={1} />\n * ```\n */\nconst QuantityInput = React.memo(\n React.forwardRef<HTMLInputElement, QuantityInputProps>(\n (\n {\n value,\n onChange,\n min = 0,\n max,\n step = 1,\n decimals = 0,\n showStepper = true,\n disabled = false,\n className,\n inputClassName,\n buttonClassName,\n },\n ref,\n ) => {\n const [qtyStr, setQtyStr] = React.useState(() =>\n value.toFixed(decimals),\n );\n\n React.useEffect(() => {\n setQtyStr(value.toFixed(decimals));\n }, [value, decimals]);\n\n const commit = React.useCallback(\n (raw: string) => {\n if (raw.trim() === \"\") {\n setQtyStr(min.toFixed(decimals));\n onChange(min);\n return;\n }\n\n let parsed = parseFloat(raw);\n if (isNaN(parsed)) parsed = min;\n\n parsed = roundToStep(parsed, step);\n if (parsed < min) parsed = min;\n if (max !== undefined && parsed > max) parsed = max;\n\n const rounded = parseFloat(parsed.toFixed(decimals));\n setQtyStr(rounded.toFixed(decimals));\n onChange(rounded);\n },\n [min, max, step, decimals, onChange],\n );\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n const allowed = [\n \"Backspace\",\n \"Delete\",\n \"ArrowLeft\",\n \"ArrowRight\",\n \"Tab\",\n \"Enter\",\n ];\n if (allowed.includes(e.key)) {\n if (e.key === \"Enter\") {\n commit(qtyStr);\n }\n return;\n }\n\n if (decimals > 0 && e.key === \".\" && !qtyStr.includes(\".\")) {\n return;\n }\n\n if (e.key >= \"0\" && e.key <= \"9\") {\n return;\n }\n\n e.preventDefault();\n },\n [decimals, qtyStr, commit],\n );\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const pattern = decimals > 0 ? /[^0-9.]/g : /[^0-9]/g;\n let cleaned = e.target.value.replace(pattern, \"\");\n if (decimals > 0) {\n const parts = cleaned.split(\".\");\n if (parts.length > 2) {\n cleaned = parts[0] + \".\" + parts.slice(1).join(\"\");\n }\n }\n setQtyStr(cleaned);\n },\n [decimals],\n );\n\n const handleBlur = React.useCallback(() => {\n commit(qtyStr);\n }, [commit, qtyStr]);\n\n const handleDecrement = React.useCallback(() => {\n const next = Math.max(value - step, min);\n onChange(next);\n }, [value, step, min, onChange]);\n\n const handleIncrement = React.useCallback(() => {\n const next = value + step;\n onChange(max !== undefined ? Math.min(next, max) : next);\n }, [value, step, max, onChange]);\n\n const minDisabled = disabled || value <= min;\n const maxDisabled = disabled || (max !== undefined && value >= max);\n\n return (\n <div\n className={cn(\n \"inline-flex items-center border rounded-md bg-background\",\n className,\n )}\n >\n {showStepper && (\n <button\n type=\"button\"\n aria-label=\"Decrease quantity\"\n disabled={minDisabled}\n onClick={handleDecrement}\n className={cn(\n \"h-10 w-10 flex items-center justify-center hover:bg-accent disabled:opacity-50\",\n buttonClassName,\n )}\n >\n <LuMinus />\n </button>\n )}\n <input\n ref={ref}\n type=\"text\"\n inputMode={decimals > 0 ? \"decimal\" : \"numeric\"}\n value={qtyStr}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n onBlur={handleBlur}\n className={cn(\n \"h-10 w-16 text-center bg-transparent focus:outline-none\",\n inputClassName,\n )}\n />\n {showStepper && (\n <button\n type=\"button\"\n aria-label=\"Increase quantity\"\n disabled={maxDisabled}\n onClick={handleIncrement}\n className={cn(\n \"h-10 w-10 flex items-center justify-center hover:bg-accent disabled:opacity-50\",\n buttonClassName,\n )}\n >\n <LuPlus />\n </button>\n )}\n </div>\n );\n },\n ),\n);\nQuantityInput.displayName = \"QuantityInput\";\n\nexport { QuantityInput };\n"]}
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
interface QuantityInputProps {
|
|
4
|
+
/** Current quantity value (controlled). */
|
|
4
5
|
value: number;
|
|
6
|
+
/** Called with the new quantity after validation and rounding. */
|
|
5
7
|
onChange: (value: number) => void;
|
|
8
|
+
/** Minimum allowed quantity. Default: `0`. */
|
|
6
9
|
min?: number;
|
|
10
|
+
/** Maximum allowed quantity. */
|
|
7
11
|
max?: number;
|
|
12
|
+
/** Increment/decrement step size. Values are rounded up to the nearest step. Default: `1`. */
|
|
8
13
|
step?: number;
|
|
14
|
+
/** Number of decimal places to display. Default: `0`. */
|
|
9
15
|
decimals?: number;
|
|
16
|
+
/** Show +/- stepper buttons. Default: `true`. */
|
|
10
17
|
showStepper?: boolean;
|
|
11
18
|
disabled?: boolean;
|
|
12
19
|
className?: string;
|
|
13
20
|
inputClassName?: string;
|
|
14
21
|
buttonClassName?: string;
|
|
15
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Numeric input with optional +/- stepper buttons for cart quantities.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <QuantityInput value={qty} onChange={setQty} min={1} step={1} />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
16
31
|
declare const QuantityInput: React.NamedExoticComponent<QuantityInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
17
32
|
|
|
18
33
|
export { QuantityInput, type QuantityInputProps };
|
package/dist/quantity-input.d.ts
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
interface QuantityInputProps {
|
|
4
|
+
/** Current quantity value (controlled). */
|
|
4
5
|
value: number;
|
|
6
|
+
/** Called with the new quantity after validation and rounding. */
|
|
5
7
|
onChange: (value: number) => void;
|
|
8
|
+
/** Minimum allowed quantity. Default: `0`. */
|
|
6
9
|
min?: number;
|
|
10
|
+
/** Maximum allowed quantity. */
|
|
7
11
|
max?: number;
|
|
12
|
+
/** Increment/decrement step size. Values are rounded up to the nearest step. Default: `1`. */
|
|
8
13
|
step?: number;
|
|
14
|
+
/** Number of decimal places to display. Default: `0`. */
|
|
9
15
|
decimals?: number;
|
|
16
|
+
/** Show +/- stepper buttons. Default: `true`. */
|
|
10
17
|
showStepper?: boolean;
|
|
11
18
|
disabled?: boolean;
|
|
12
19
|
className?: string;
|
|
13
20
|
inputClassName?: string;
|
|
14
21
|
buttonClassName?: string;
|
|
15
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Numeric input with optional +/- stepper buttons for cart quantities.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <QuantityInput value={qty} onChange={setQty} min={1} step={1} />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
16
31
|
declare const QuantityInput: React.NamedExoticComponent<QuantityInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
17
32
|
|
|
18
33
|
export { QuantityInput, type QuantityInputProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/quantity-input.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { LuMinus, LuPlus } from \"react-icons/lu\";\n\nexport interface QuantityInputProps {\n value: number;\n onChange: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n decimals?: number;\n showStepper?: boolean;\n disabled?: boolean;\n className?: string;\n inputClassName?: string;\n buttonClassName?: string;\n}\n\nfunction roundToStep(value: number, step: number): number {\n if (step <= 1) return value;\n return Math.ceil(value / step) * step;\n}\n\nconst QuantityInput = React.memo(\n React.forwardRef<HTMLInputElement, QuantityInputProps>(\n (\n {\n value,\n onChange,\n min = 0,\n max,\n step = 1,\n decimals = 0,\n showStepper = true,\n disabled = false,\n className,\n inputClassName,\n buttonClassName,\n },\n ref,\n ) => {\n const [qtyStr, setQtyStr] = React.useState(() =>\n value.toFixed(decimals),\n );\n\n React.useEffect(() => {\n setQtyStr(value.toFixed(decimals));\n }, [value, decimals]);\n\n const commit = React.useCallback(\n (raw: string) => {\n if (raw.trim() === \"\") {\n setQtyStr(min.toFixed(decimals));\n onChange(min);\n return;\n }\n\n let parsed = parseFloat(raw);\n if (isNaN(parsed)) parsed = min;\n\n parsed = roundToStep(parsed, step);\n if (parsed < min) parsed = min;\n if (max !== undefined && parsed > max) parsed = max;\n\n const rounded = parseFloat(parsed.toFixed(decimals));\n setQtyStr(rounded.toFixed(decimals));\n onChange(rounded);\n },\n [min, max, step, decimals, onChange],\n );\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n const allowed = [\n \"Backspace\",\n \"Delete\",\n \"ArrowLeft\",\n \"ArrowRight\",\n \"Tab\",\n \"Enter\",\n ];\n if (allowed.includes(e.key)) {\n if (e.key === \"Enter\") {\n commit(qtyStr);\n }\n return;\n }\n\n if (decimals > 0 && e.key === \".\" && !qtyStr.includes(\".\")) {\n return;\n }\n\n if (e.key >= \"0\" && e.key <= \"9\") {\n return;\n }\n\n e.preventDefault();\n },\n [decimals, qtyStr, commit],\n );\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const pattern = decimals > 0 ? /[^0-9.]/g : /[^0-9]/g;\n let cleaned = e.target.value.replace(pattern, \"\");\n if (decimals > 0) {\n const parts = cleaned.split(\".\");\n if (parts.length > 2) {\n cleaned = parts[0] + \".\" + parts.slice(1).join(\"\");\n }\n }\n setQtyStr(cleaned);\n },\n [decimals],\n );\n\n const handleBlur = React.useCallback(() => {\n commit(qtyStr);\n }, [commit, qtyStr]);\n\n const handleDecrement = React.useCallback(() => {\n const next = Math.max(value - step, min);\n onChange(next);\n }, [value, step, min, onChange]);\n\n const handleIncrement = React.useCallback(() => {\n const next = value + step;\n onChange(max !== undefined ? Math.min(next, max) : next);\n }, [value, step, max, onChange]);\n\n const minDisabled = disabled || value <= min;\n const maxDisabled = disabled || (max !== undefined && value >= max);\n\n return (\n <div\n className={cn(\n \"inline-flex items-center border rounded-md bg-background\",\n className,\n )}\n >\n {showStepper && (\n <button\n type=\"button\"\n aria-label=\"Decrease quantity\"\n disabled={minDisabled}\n onClick={handleDecrement}\n className={cn(\n \"h-10 w-10 flex items-center justify-center hover:bg-accent disabled:opacity-50\",\n buttonClassName,\n )}\n >\n <LuMinus />\n </button>\n )}\n <input\n ref={ref}\n type=\"text\"\n inputMode={decimals > 0 ? \"decimal\" : \"numeric\"}\n value={qtyStr}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n onBlur={handleBlur}\n className={cn(\n \"h-10 w-16 text-center bg-transparent focus:outline-none\",\n inputClassName,\n )}\n />\n {showStepper && (\n <button\n type=\"button\"\n aria-label=\"Increase quantity\"\n disabled={maxDisabled}\n onClick={handleIncrement}\n className={cn(\n \"h-10 w-10 flex items-center justify-center hover:bg-accent disabled:opacity-50\",\n buttonClassName,\n )}\n >\n <LuPlus />\n </button>\n )}\n </div>\n );\n },\n ),\n);\nQuantityInput.displayName = \"QuantityInput\";\n\nexport { QuantityInput };\n"],"mappings":";;;;AAEA,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,SAAS,cAAc;
|
|
1
|
+
{"version":3,"sources":["../src/quantity-input.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@simpleapps-com/augur-utils/web\";\nimport { LuMinus, LuPlus } from \"react-icons/lu\";\n\nexport interface QuantityInputProps {\n /** Current quantity value (controlled). */\n value: number;\n /** Called with the new quantity after validation and rounding. */\n onChange: (value: number) => void;\n /** Minimum allowed quantity. Default: `0`. */\n min?: number;\n /** Maximum allowed quantity. */\n max?: number;\n /** Increment/decrement step size. Values are rounded up to the nearest step. Default: `1`. */\n step?: number;\n /** Number of decimal places to display. Default: `0`. */\n decimals?: number;\n /** Show +/- stepper buttons. Default: `true`. */\n showStepper?: boolean;\n disabled?: boolean;\n className?: string;\n inputClassName?: string;\n buttonClassName?: string;\n}\n\nfunction roundToStep(value: number, step: number): number {\n if (step <= 1) return value;\n return Math.ceil(value / step) * step;\n}\n\n/**\n * Numeric input with optional +/- stepper buttons for cart quantities.\n *\n * @example\n * ```tsx\n * <QuantityInput value={qty} onChange={setQty} min={1} step={1} />\n * ```\n */\nconst QuantityInput = React.memo(\n React.forwardRef<HTMLInputElement, QuantityInputProps>(\n (\n {\n value,\n onChange,\n min = 0,\n max,\n step = 1,\n decimals = 0,\n showStepper = true,\n disabled = false,\n className,\n inputClassName,\n buttonClassName,\n },\n ref,\n ) => {\n const [qtyStr, setQtyStr] = React.useState(() =>\n value.toFixed(decimals),\n );\n\n React.useEffect(() => {\n setQtyStr(value.toFixed(decimals));\n }, [value, decimals]);\n\n const commit = React.useCallback(\n (raw: string) => {\n if (raw.trim() === \"\") {\n setQtyStr(min.toFixed(decimals));\n onChange(min);\n return;\n }\n\n let parsed = parseFloat(raw);\n if (isNaN(parsed)) parsed = min;\n\n parsed = roundToStep(parsed, step);\n if (parsed < min) parsed = min;\n if (max !== undefined && parsed > max) parsed = max;\n\n const rounded = parseFloat(parsed.toFixed(decimals));\n setQtyStr(rounded.toFixed(decimals));\n onChange(rounded);\n },\n [min, max, step, decimals, onChange],\n );\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n const allowed = [\n \"Backspace\",\n \"Delete\",\n \"ArrowLeft\",\n \"ArrowRight\",\n \"Tab\",\n \"Enter\",\n ];\n if (allowed.includes(e.key)) {\n if (e.key === \"Enter\") {\n commit(qtyStr);\n }\n return;\n }\n\n if (decimals > 0 && e.key === \".\" && !qtyStr.includes(\".\")) {\n return;\n }\n\n if (e.key >= \"0\" && e.key <= \"9\") {\n return;\n }\n\n e.preventDefault();\n },\n [decimals, qtyStr, commit],\n );\n\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const pattern = decimals > 0 ? /[^0-9.]/g : /[^0-9]/g;\n let cleaned = e.target.value.replace(pattern, \"\");\n if (decimals > 0) {\n const parts = cleaned.split(\".\");\n if (parts.length > 2) {\n cleaned = parts[0] + \".\" + parts.slice(1).join(\"\");\n }\n }\n setQtyStr(cleaned);\n },\n [decimals],\n );\n\n const handleBlur = React.useCallback(() => {\n commit(qtyStr);\n }, [commit, qtyStr]);\n\n const handleDecrement = React.useCallback(() => {\n const next = Math.max(value - step, min);\n onChange(next);\n }, [value, step, min, onChange]);\n\n const handleIncrement = React.useCallback(() => {\n const next = value + step;\n onChange(max !== undefined ? Math.min(next, max) : next);\n }, [value, step, max, onChange]);\n\n const minDisabled = disabled || value <= min;\n const maxDisabled = disabled || (max !== undefined && value >= max);\n\n return (\n <div\n className={cn(\n \"inline-flex items-center border rounded-md bg-background\",\n className,\n )}\n >\n {showStepper && (\n <button\n type=\"button\"\n aria-label=\"Decrease quantity\"\n disabled={minDisabled}\n onClick={handleDecrement}\n className={cn(\n \"h-10 w-10 flex items-center justify-center hover:bg-accent disabled:opacity-50\",\n buttonClassName,\n )}\n >\n <LuMinus />\n </button>\n )}\n <input\n ref={ref}\n type=\"text\"\n inputMode={decimals > 0 ? \"decimal\" : \"numeric\"}\n value={qtyStr}\n disabled={disabled}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n onBlur={handleBlur}\n className={cn(\n \"h-10 w-16 text-center bg-transparent focus:outline-none\",\n inputClassName,\n )}\n />\n {showStepper && (\n <button\n type=\"button\"\n aria-label=\"Increase quantity\"\n disabled={maxDisabled}\n onClick={handleIncrement}\n className={cn(\n \"h-10 w-10 flex items-center justify-center hover:bg-accent disabled:opacity-50\",\n buttonClassName,\n )}\n >\n <LuPlus />\n </button>\n )}\n </div>\n );\n },\n ),\n);\nQuantityInput.displayName = \"QuantityInput\";\n\nexport { QuantityInput };\n"],"mappings":";;;;AAEA,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,S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