@gbmtech/aurora-ui 0.0.3 → 0.0.5
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/cjs/components/badge.cjs +1 -1
- package/dist/cjs/components/badge.cjs.map +1 -1
- package/dist/cjs/components/button.cjs +1 -1
- package/dist/cjs/components/button.cjs.map +1 -1
- package/dist/cjs/components/label.cjs +1 -1
- package/dist/cjs/components/label.cjs.map +1 -1
- package/dist/cjs/components/multi-select.cjs +1 -1
- package/dist/cjs/components/multi-select.cjs.map +1 -1
- package/dist/cjs/lib/utils.cjs +1 -1
- package/dist/cjs/lib/utils.cjs.map +1 -1
- package/dist/esm/components/badge.js +1 -1
- package/dist/esm/components/badge.js.map +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.js.map +1 -1
- package/dist/esm/components/label.js +1 -1
- package/dist/esm/components/label.js.map +1 -1
- package/dist/esm/components/multi-select.js +1 -1
- package/dist/esm/components/multi-select.js.map +1 -1
- package/dist/esm/lib/utils.js +1 -1
- package/dist/esm/lib/utils.js.map +1 -1
- package/dist/types/components/badge.d.ts +26 -11
- package/dist/types/components/button.d.ts +78 -11
- package/dist/types/components/label.d.ts +2 -2
- package/dist/types/components/multi-select.d.ts +19 -9
- package/dist/types/lib/utils.d.ts +10 -1
- package/package.json +15 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,r)=>{for(var _ in r)__webpack_require__.o(r,_)&&!__webpack_require__.o(e,_)&&Object.defineProperty(e,_,{enumerable:!0,get:r[_]})},__webpack_require__.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{badgeVariants:()=>badgeVariants,Badge:()=>Badge});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,r)=>{for(var _ in r)__webpack_require__.o(r,_)&&!__webpack_require__.o(e,_)&&Object.defineProperty(e,_,{enumerable:!0,get:r[_]})},__webpack_require__.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{badgeVariants:()=>badgeVariants,Badge:()=>Badge});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),utils_cjs_namespaceObject=require("../lib/utils.cjs"),badgeVariants=(0,utils_cjs_namespaceObject.tv)({base:"inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Badge({className:e,variant:r,..._}){return(0,jsx_runtime_namespaceObject.jsx)("div",{className:(0,utils_cjs_namespaceObject.cn)(badgeVariants({variant:r}),e),..._})}for(var __webpack_i__ in exports.Badge=__webpack_exports__.Badge,exports.badgeVariants=__webpack_exports__.badgeVariants,__webpack_exports__)-1===["Badge","badgeVariants"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
2
2
|
//# sourceMappingURL=badge.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\badge.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/badge.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"components\\badge.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/badge.tsx"],"sourcesContent":["import { ComponentProps } from 'react'\r\n\r\nimport { VariantProps, cn, tv } from '../lib/utils'\r\n\r\nconst badgeVariants = tv({\r\n base: 'inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',\r\n variants: {\r\n variant: {\r\n default:\r\n 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',\r\n secondary:\r\n 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',\r\n destructive:\r\n 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',\r\n outline: 'text-foreground',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n },\r\n})\r\n\r\ntype BadgeProps = ComponentProps<'div'> & VariantProps<typeof badgeVariants>\r\n\r\nfunction Badge({ className, variant, ...props }: BadgeProps) {\r\n return (\r\n <div className={cn(badgeVariants({ variant }), className)} {...props} />\r\n )\r\n}\r\n\r\nexport { Badge, badgeVariants, type BadgeProps }\r\n"],"names":["badgeVariants","tv","Badge","className","variant","props","cn"],"mappings":"i7BAIMA,cAAgBC,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EAAG,CACvB,KAAM,yKACN,SAAU,CACR,QAAS,CACP,QACE,4EACF,UACE,kFACF,YACE,wFACF,QAAS,iBACX,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,GAIA,SAASC,MAAM,CAAEC,UAAAA,CAAS,CAAEC,QAAAA,CAAO,CAAE,GAAGC,EAAmB,EACzD,MACE,oCAAC,OAAI,UAAWC,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EAAGN,cAAc,CAAEI,QAAAA,CAAQ,GAAID,GAAa,GAAGE,CAAK,A,EAExE,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{buttonVariants:()=>buttonVariants,Button:()=>Button});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),ssr_namespaceObject=require("@phosphor-icons/react/dist/ssr"),react_slot_namespaceObject=require("@radix-ui/react-slot"),
|
|
1
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{buttonVariants:()=>buttonVariants,Button:()=>Button});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),ssr_namespaceObject=require("@phosphor-icons/react/dist/ssr"),react_slot_namespaceObject=require("@radix-ui/react-slot"),utils_cjs_namespaceObject=require("../lib/utils.cjs"),buttonVariants=(0,utils_cjs_namespaceObject.tv)({base:"flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gbm-sky focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 max-lg:text-sm",variants:{variant:{primary:"bg-gbm-sky text-white hover:bg-gbm-ocean",secondary:"border border-stroke bg-white text-gbm-dark hover:bg-gray-100",tertiary:"border border-stroke bg-white text-gbm-sky hover:bg-gray-100",outline:"border border-gbm-sky bg-white text-gbm-sky hover:bg-gbm-sky hover:text-white",ghost:"text-gbm-dark hover:border-gbm-blue hover:bg-gray-100",destructive:"bg-rose-600 text-white hover:bg-rose-700",link:"text-gbm-dark underline-offset-2 hover:underline"},size:{sm:"h-10 gap-1.5 px-3 py-2",md:"h-12 gap-4 px-3 py-2",lg:"h-14 gap-6 px-3 py-4",icon:"h-10 w-10 p-2"},rounded:{true:"rounded-full",false:"rounded-md"},loading:{true:"pointer-events-none",false:""}},defaultVariants:{variant:"primary",size:"sm",rounded:!1,loading:!1}});function Button({className:e,children:t,variant:r,size:_,rounded:a,disabled:s,loading:n,asChild:o=!1,...i}){let c=o?react_slot_namespaceObject.Slot:"button";return(0,jsx_runtime_namespaceObject.jsx)(c,{className:(0,utils_cjs_namespaceObject.cn)(buttonVariants({variant:r,size:_,rounded:a,loading:n,className:e})),"data-variant":r,disabled:s||n,type:"button",...i,children:(0,jsx_runtime_namespaceObject.jsx)(react_slot_namespaceObject.Slottable,{children:n?(0,jsx_runtime_namespaceObject.jsx)(ssr_namespaceObject.CircleNotch,{className:"animate-spin",size:16}):t})})}for(var __webpack_i__ in exports.Button=__webpack_exports__.Button,exports.buttonVariants=__webpack_exports__.buttonVariants,__webpack_exports__)-1===["Button","buttonVariants"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
2
2
|
//# sourceMappingURL=button.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\button.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/button.tsx"],"sourcesContent":["import { CircleNotch } from '@phosphor-icons/react/dist/ssr'\r\nimport { Slot, Slottable } from '@radix-ui/react-slot'\r\nimport {
|
|
1
|
+
{"version":3,"file":"components\\button.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/button.tsx"],"sourcesContent":["import { CircleNotch } from '@phosphor-icons/react/dist/ssr'\r\nimport { Slot, Slottable } from '@radix-ui/react-slot'\r\nimport { ComponentProps } from 'react'\r\n\r\nimport type { VariantProps } from '../lib/utils'\r\n\r\nimport { cn, tv } from '../lib/utils'\r\n\r\nconst buttonVariants = tv({\r\n base: 'flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gbm-sky focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 max-lg:text-sm',\r\n variants: {\r\n variant: {\r\n primary: 'bg-gbm-sky text-white hover:bg-gbm-ocean',\r\n secondary:\r\n 'border border-stroke bg-white text-gbm-dark hover:bg-gray-100',\r\n tertiary: 'border border-stroke bg-white text-gbm-sky hover:bg-gray-100',\r\n outline:\r\n 'border border-gbm-sky bg-white text-gbm-sky hover:bg-gbm-sky hover:text-white',\r\n ghost: 'text-gbm-dark hover:border-gbm-blue hover:bg-gray-100',\r\n destructive: 'bg-rose-600 text-white hover:bg-rose-700',\r\n link: 'text-gbm-dark underline-offset-2 hover:underline',\r\n },\r\n size: {\r\n sm: 'h-10 gap-1.5 px-3 py-2',\r\n md: 'h-12 gap-4 px-3 py-2',\r\n lg: 'h-14 gap-6 px-3 py-4',\r\n icon: 'h-10 w-10 p-2',\r\n },\r\n rounded: {\r\n true: 'rounded-full',\r\n false: 'rounded-md',\r\n },\r\n loading: {\r\n true: 'pointer-events-none',\r\n false: '',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'primary',\r\n size: 'sm',\r\n rounded: false,\r\n loading: false,\r\n },\r\n})\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: Button\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport type ButtonProps = ComponentProps<'button'> &\r\n VariantProps<typeof buttonVariants> & {\r\n asChild?: boolean\r\n }\r\n\r\nfunction Button({\r\n className,\r\n children,\r\n variant,\r\n size,\r\n rounded,\r\n disabled,\r\n loading,\r\n asChild = false,\r\n ...props\r\n}: ButtonProps) {\r\n const Comp = asChild ? Slot : 'button'\r\n\r\n return (\r\n <Comp\r\n className={cn(\r\n buttonVariants({ variant, size, rounded, loading, className })\r\n )}\r\n data-variant={variant}\r\n disabled={disabled || loading}\r\n type=\"button\"\r\n {...props}\r\n >\r\n <Slottable>\r\n {loading ? (\r\n <CircleNotch className=\"animate-spin\" size={16} />\r\n ) : (\r\n children\r\n )}\r\n </Slottable>\r\n </Comp>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Exports\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport { Button, buttonVariants }\r\n"],"names":["buttonVariants","tv","Button","className","children","variant","size","rounded","disabled","loading","asChild","props","Comp","Slot","cn","Slottable","CircleNotch"],"mappings":"8iCAQMA,eAAiBC,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EAAG,CACxB,KAAM,iRACN,SAAU,CACR,QAAS,CACP,QAAS,2CACT,UACE,gEACF,SAAU,+DACV,QACE,gFACF,MAAO,wDACP,YAAa,2CACb,KAAM,kDACR,EACA,KAAM,CACJ,GAAI,yBACJ,GAAI,uBACJ,GAAI,uBACJ,KAAM,eACR,EACA,QAAS,CACP,KAAM,eACN,MAAO,YACT,EACA,QAAS,CACP,KAAM,sBACN,MAAO,EACT,CACF,EACA,gBAAiB,CACf,QAAS,UACT,KAAM,KACN,QAAS,GACT,QAAS,EACX,CACF,GAWA,SAASC,OAAO,CACdC,UAAAA,CAAS,CACTC,SAAAA,CAAQ,CACRC,QAAAA,CAAO,CACPC,KAAAA,CAAI,CACJC,QAAAA,CAAO,CACPC,SAAAA,CAAQ,CACRC,QAAAA,CAAO,CACPC,QAAAA,EAAU,EAAK,CACf,GAAGC,EACS,EACZ,IAAMC,EAAOF,EAAUG,2BAAAA,IAAIA,CAAG,SAE9B,MACE,oCAACD,EAAAA,CACC,UAAWE,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EACTd,eAAe,CAAEK,QAAAA,EAASC,KAAAA,EAAMC,QAAAA,EAASE,QAAAA,EAASN,UAAAA,CAAU,IAE9D,eAAcE,EACd,SAAUG,GAAYC,EACtB,KAAK,SACJ,GAAGE,CAAK,C,SAET,oCAACI,2BAAAA,SAASA,CAAAA,C,SACPN,EACC,oCAACO,oBAAAA,WAAWA,CAAAA,CAAC,UAAU,eAAe,KAAM,E,GAE5CZ,C,IAKV,C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var
|
|
2
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Label:()=>Label});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),react_label_namespaceObject=require("@radix-ui/react-label"),utils_cjs_namespaceObject=require("../lib/utils.cjs");function Label({className:e,..._}){return(0,jsx_runtime_namespaceObject.jsx)(react_label_namespaceObject.Root,{className:(0,utils_cjs_namespaceObject.cn)("font-medium text-base text-gbm-dark leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),..._})}for(var __webpack_i__ in exports.Label=__webpack_exports__.Label,__webpack_exports__)-1===["Label"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
3
3
|
//# sourceMappingURL=label.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\label.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/label.tsx"],"sourcesContent":["\r\n\r\nimport * as LabelPrimitive from '@radix-ui/react-label'\r\nimport {
|
|
1
|
+
{"version":3,"file":"components\\label.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/label.tsx"],"sourcesContent":["\r\n\r\nimport * as LabelPrimitive from '@radix-ui/react-label'\r\nimport { ComponentProps } from 'react'\r\n\r\nimport { cn } from '../lib/utils'\r\n\r\nfunction Label({\r\n className,\r\n ...props\r\n}: ComponentProps<typeof LabelPrimitive.Root>) {\r\n return (\r\n <LabelPrimitive.Root\r\n className={cn(\r\n 'font-medium text-base text-gbm-dark leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nexport { Label }\r\n"],"names":["Label","className","props","LabelPrimitive","cn"],"mappings":";88BAOA,SAASA,MAAM,CACbC,UAAAA,CAAS,CACT,GAAGC,EACwC,EAC3C,MACE,oCAACC,4BAAAA,IAAmB,EAClB,UAAWC,GAAAA,0BAAAA,EAAAA,EACT,6GACAH,GAED,GAAGC,CAAK,EAGf,C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,a)=>{for(var t in a)__webpack_require__.o(a,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},__webpack_require__.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{MultiSelect:()=>MultiSelect});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),ssr_namespaceObject=require("@phosphor-icons/react/dist/ssr"),
|
|
2
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,a)=>{for(var t in a)__webpack_require__.o(a,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},__webpack_require__.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{MultiSelect:()=>MultiSelect,multiSelectVariants:()=>multiSelectVariants});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),ssr_namespaceObject=require("@phosphor-icons/react/dist/ssr"),external_react_namespaceObject=require("react"),utils_cjs_namespaceObject=require("../lib/utils.cjs"),external_badge_cjs_namespaceObject=require("./badge.cjs"),external_button_cjs_namespaceObject=require("./button.cjs"),external_checkbox_cjs_namespaceObject=require("./checkbox.cjs"),external_command_cjs_namespaceObject=require("./command.cjs"),external_popover_cjs_namespaceObject=require("./popover.cjs"),multiSelectVariants=(0,utils_cjs_namespaceObject.tv)({base:"h-6 gap-0 px-1.5 font-normal text-xs",variants:{variant:{default:"rounded-sm bg-azure-50 text-azure-500 hover:bg-card/80"}},defaultVariants:{variant:"default"}});function MultiSelect({options:e,onValueChange:a,variant:t,defaultValue:c=[],placeholder:s="Select options",maxCount:n=2,modalPopover:r=!1,className:_,...m}){let[l,i]=(0,external_react_namespaceObject.useState)(c),[j,p]=(0,external_react_namespaceObject.useState)(!1),o=e=>{let t=l.includes(e)?l.filter(a=>a!==e):[...l,e];i(t),a?.(t)},u=()=>{i([]),a?.([])},b=()=>{let e=l.slice(0,n);i(e),a?.(e)};return(0,jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover,{open:j,onOpenChange:p,modal:r,children:[(0,jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger,{asChild:!0,children:(0,jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button,{...m,onClick:()=>{p(e=>!e)},className:(0,utils_cjs_namespaceObject.cn)("flex h-12 w-auto min-w-60 items-center justify-between rounded-md border border-stroke bg-white px-3 hover:bg-gray-50",_),children:l.length>0?(0,jsx_runtime_namespaceObject.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,jsx_runtime_namespaceObject.jsxs)("div",{className:"flex items-center gap-x-1",children:[l.slice(0,n).map(a=>{let c=e.find(e=>e.value===a),s=c?.icon;return(0,jsx_runtime_namespaceObject.jsxs)(external_badge_cjs_namespaceObject.Badge,{className:(0,utils_cjs_namespaceObject.cn)(multiSelectVariants({variant:t})),children:[s&&(0,jsx_runtime_namespaceObject.jsx)(s,{className:"mr-2 h-4 w-4"}),(0,jsx_runtime_namespaceObject.jsx)("span",{className:"max-w-32 truncate",children:c?.label}),(0,jsx_runtime_namespaceObject.jsx)(ssr_namespaceObject.X,{className:"ml-1 size-3 cursor-pointer",onClick:e=>{e.stopPropagation(),o(a)}})]},a)}),l.length>n&&(0,jsx_runtime_namespaceObject.jsxs)(external_badge_cjs_namespaceObject.Badge,{className:(0,utils_cjs_namespaceObject.cn)(multiSelectVariants({variant:t})),children:[`+ ${l.length-n} ...`,(0,jsx_runtime_namespaceObject.jsx)(ssr_namespaceObject.X,{className:"ml-1 size-3 cursor-pointer",onClick:e=>{e.stopPropagation(),b()}})]})]}),(0,jsx_runtime_namespaceObject.jsx)("div",{className:"ml-4 flex items-center",children:j?(0,jsx_runtime_namespaceObject.jsx)(ssr_namespaceObject.CaretUp,{weight:"bold",className:"size-4 cursor-pointer text-gbm-dark"}):(0,jsx_runtime_namespaceObject.jsx)(ssr_namespaceObject.CaretDown,{weight:"bold",className:"size-4 cursor-pointer text-gbm-dark"})})]}):(0,jsx_runtime_namespaceObject.jsxs)("div",{className:"mx-auto flex w-full items-center justify-between",children:[(0,jsx_runtime_namespaceObject.jsx)("span",{className:"font-normal text-gbm-dark/50 text-sm",children:"Select options"===s?"Selecione as op\xe7\xf5es":s}),j?(0,jsx_runtime_namespaceObject.jsx)(ssr_namespaceObject.CaretUp,{weight:"bold",className:"ml-2 size-4 cursor-pointer text-gbm-dark"}):(0,jsx_runtime_namespaceObject.jsx)(ssr_namespaceObject.CaretDown,{weight:"bold",className:"ml-2 size-4 cursor-pointer text-gbm-dark"})]})})}),(0,jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent,{className:"w-auto p-0",align:"start",onEscapeKeyDown:()=>p(!1),children:(0,jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.Command,{children:[(0,jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandInput,{placeholder:"Pesquisar...",onKeyDown:e=>{"Enter"===e.key&&p(!0)}}),(0,jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.CommandList,{children:[(0,jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandEmpty,{children:"Nenhum resultado encontrado."}),(0,jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.CommandGroup,{children:[(0,jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.CommandItem,{onSelect:()=>{if(l.length===e.length)u();else{let t=e.map(e=>e.value);i(t),a?.(t)}},className:"cursor-pointer",children:[(0,jsx_runtime_namespaceObject.jsx)(external_checkbox_cjs_namespaceObject.Checkbox,{checked:l.length===e.length,className:"mr-2"}),(0,jsx_runtime_namespaceObject.jsx)("span",{children:"(Selecionar todos)"})]},"all"),e.map(e=>{let a=l.includes(e.value);return(0,jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.CommandItem,{onSelect:()=>o(e.value),className:"cursor-pointer",children:[(0,jsx_runtime_namespaceObject.jsx)(external_checkbox_cjs_namespaceObject.Checkbox,{checked:a,className:"mr-2"}),e.icon&&(0,jsx_runtime_namespaceObject.jsx)(e.icon,{className:"mr-2 size-4 text-gbm-dark"}),(0,jsx_runtime_namespaceObject.jsx)("span",{children:e.label})]},e.value)})]})]})]})})]})}for(var __webpack_i__ in exports.MultiSelect=__webpack_exports__.MultiSelect,exports.multiSelectVariants=__webpack_exports__.multiSelectVariants,__webpack_exports__)-1===["MultiSelect","multiSelectVariants"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
3
3
|
//# sourceMappingURL=multi-select.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\multi-select.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/multi-select.tsx"],"sourcesContent":["\r\n\r\nimport { CaretDown, CaretUp, X } from '@phosphor-icons/react/dist/ssr'\r\nimport { type VariantProps, cva } from 'class-variance-authority'\r\nimport {\r\n ButtonHTMLAttributes,\r\n ComponentType,\r\n KeyboardEvent,\r\n forwardRef,\r\n useState,\r\n} from 'react'\r\n\r\nimport { cn } from '../lib/utils'\r\nimport { Badge } from './badge'\r\nimport { Button } from './button'\r\nimport { Checkbox } from './checkbox'\r\nimport {\r\n Command,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandInput,\r\n CommandItem,\r\n CommandList,\r\n} from './command'\r\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\r\n\r\nconst multiSelectVariants = cva('h-6 gap-0 px-1.5 font-normal text-xs', {\r\n variants: {\r\n variant: {\r\n default: 'rounded-sm bg-azure-50 text-azure-500 hover:bg-card/80',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n },\r\n})\r\n\r\ninterface MultiSelectProps\r\n extends ButtonHTMLAttributes<HTMLButtonElement>,\r\n VariantProps<typeof multiSelectVariants> {\r\n options: {\r\n label: string\r\n value: string\r\n icon?: ComponentType<{ className?: string }>\r\n }[]\r\n defaultValue?: string[]\r\n placeholder?: string\r\n maxCount?: number\r\n modalPopover?: boolean\r\n asChild?: boolean\r\n className?: string\r\n onValueChange?: (value: string[]) => void\r\n}\r\n\r\nexport const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(\r\n (\r\n {\r\n options,\r\n onValueChange,\r\n variant,\r\n defaultValue = [],\r\n placeholder = 'Select options',\r\n maxCount = 2,\r\n modalPopover = false,\r\n className,\r\n ...props\r\n },\r\n ref\r\n ) => {\r\n const [selectedValues, setSelectedValues] = useState<string[]>(defaultValue)\r\n const [isPopoverOpen, setIsPopoverOpen] = useState(false)\r\n\r\n const handleInputKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === 'Enter') {\r\n setIsPopoverOpen(true)\r\n }\r\n }\r\n\r\n const toggleOption = (option: string) => {\r\n const newSelectedValues = selectedValues.includes(option)\r\n ? selectedValues.filter(value => value !== option)\r\n : [...selectedValues, option]\r\n setSelectedValues(newSelectedValues)\r\n onValueChange?.(newSelectedValues)\r\n }\r\n\r\n const handleClear = () => {\r\n setSelectedValues([])\r\n onValueChange?.([])\r\n }\r\n\r\n const handleTogglePopover = () => {\r\n setIsPopoverOpen(prev => !prev)\r\n }\r\n\r\n const clearExtraOptions = () => {\r\n const newSelectedValues = selectedValues.slice(0, maxCount)\r\n setSelectedValues(newSelectedValues)\r\n onValueChange?.(newSelectedValues)\r\n }\r\n\r\n const toggleAll = () => {\r\n if (selectedValues.length === options.length) {\r\n handleClear()\r\n } else {\r\n const allValues = options.map(option => option.value)\r\n setSelectedValues(allValues)\r\n onValueChange?.(allValues)\r\n }\r\n }\r\n\r\n return (\r\n <Popover\r\n open={isPopoverOpen}\r\n onOpenChange={setIsPopoverOpen}\r\n modal={modalPopover}\r\n >\r\n <PopoverTrigger asChild>\r\n <Button\r\n ref={ref}\r\n {...props}\r\n onClick={handleTogglePopover}\r\n className={cn(\r\n 'flex h-12 w-auto min-w-60 items-center justify-between rounded-md border border-stroke bg-white px-3 hover:bg-gray-50',\r\n className\r\n )}\r\n >\r\n {selectedValues.length > 0 ? (\r\n <div className=\"flex w-full items-center justify-between\">\r\n <div className=\"flex items-center gap-x-1\">\r\n {selectedValues.slice(0, maxCount).map(value => {\r\n const option = options.find(o => o.value === value)\r\n const IconComponent = option?.icon\r\n return (\r\n <Badge\r\n key={value}\r\n className={cn(multiSelectVariants({ variant }))}\r\n >\r\n {IconComponent && (\r\n <IconComponent className=\"mr-2 h-4 w-4\" />\r\n )}\r\n <span className=\"max-w-32 truncate\">\r\n {option?.label}\r\n </span>\r\n <X\r\n className=\"ml-1 size-3 cursor-pointer\"\r\n onClick={event => {\r\n event.stopPropagation()\r\n toggleOption(value)\r\n }}\r\n />\r\n </Badge>\r\n )\r\n })}\r\n\r\n {selectedValues.length > maxCount && (\r\n <Badge className={cn(multiSelectVariants({ variant }))}>\r\n {`+ ${selectedValues.length - maxCount} ...`}\r\n <X\r\n className=\"ml-1 size-3 cursor-pointer\"\r\n onClick={event => {\r\n event.stopPropagation()\r\n clearExtraOptions()\r\n }}\r\n />\r\n </Badge>\r\n )}\r\n </div>\r\n <div className=\"ml-4 flex items-center\">\r\n {isPopoverOpen ? (\r\n <CaretUp\r\n weight=\"bold\"\r\n className=\"size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n ) : (\r\n <CaretDown\r\n weight=\"bold\"\r\n className=\"size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n ) : (\r\n <div className=\"mx-auto flex w-full items-center justify-between\">\r\n <span className=\"font-normal text-gbm-dark/50 text-sm\">\r\n {placeholder === 'Select options'\r\n ? 'Selecione as opções'\r\n : placeholder}\r\n </span>\r\n {isPopoverOpen ? (\r\n <CaretUp\r\n weight=\"bold\"\r\n className=\"ml-2 size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n ) : (\r\n <CaretDown\r\n weight=\"bold\"\r\n className=\"ml-2 size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n )}\r\n </div>\r\n )}\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent\r\n className=\"w-auto p-0\"\r\n align=\"start\"\r\n onEscapeKeyDown={() => setIsPopoverOpen(false)}\r\n >\r\n <Command>\r\n <CommandInput\r\n placeholder=\"Pesquisar...\"\r\n onKeyDown={handleInputKeyDown}\r\n />\r\n <CommandList>\r\n <CommandEmpty>Nenhum resultado encontrado.</CommandEmpty>\r\n <CommandGroup>\r\n <CommandItem\r\n key=\"all\"\r\n onSelect={toggleAll}\r\n className=\"cursor-pointer\"\r\n >\r\n <Checkbox\r\n checked={selectedValues.length === options.length}\r\n className=\"mr-2\"\r\n />\r\n <span>(Selecionar todos)</span>\r\n </CommandItem>\r\n {options.map(option => {\r\n const isSelected = selectedValues.includes(option.value)\r\n return (\r\n <CommandItem\r\n key={option.value}\r\n onSelect={() => toggleOption(option.value)}\r\n className=\"cursor-pointer\"\r\n >\r\n <Checkbox checked={isSelected} className=\"mr-2\" />\r\n {option.icon && (\r\n <option.icon className=\"mr-2 size-4 text-gbm-dark\" />\r\n )}\r\n <span>{option.label}</span>\r\n </CommandItem>\r\n )\r\n })}\r\n </CommandGroup>\r\n </CommandList>\r\n </Command>\r\n </PopoverContent>\r\n </Popover>\r\n )\r\n }\r\n)\r\n\r\nMultiSelect.displayName = 'MultiSelect'\r\n"],"names":["multiSelectVariants","cva","MultiSelect","forwardRef","options","onValueChange","variant","defaultValue","placeholder","maxCount","modalPopover","className","props","ref","selectedValues","setSelectedValues","useState","isPopoverOpen","setIsPopoverOpen","toggleOption","option","newSelectedValues","value","handleClear","clearExtraOptions","Popover","PopoverTrigger","Button","prev","cn","o","IconComponent","Badge","X","event","CaretUp","CaretDown","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandGroup","CommandItem","allValues","Checkbox","isSelected"],"mappings":";m5CA0BMA,oBAAsBC,GAAAA,kDAAAA,GAAAA,EAAI,uCAAwC,CACtE,SAAU,CACR,QAAS,CACP,QAAS,wDACX,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,GAmBaC,YAAcC,GAAAA,+BAAAA,UAAAA,EACzB,CACE,CACEC,QAAAA,CAAO,CACPC,cAAAA,CAAa,CACbC,QAAAA,CAAO,CACPC,aAAAA,EAAe,EAAE,CACjBC,YAAAA,EAAc,gBAAgB,CAC9BC,SAAAA,EAAW,CAAC,CACZC,aAAAA,EAAe,EAAK,CACpBC,UAAAA,CAAS,CACT,GAAGC,EACJ,CACDC,KAEA,GAAM,CAACC,EAAgBC,EAAkB,CAAGC,GAAAA,+BAAAA,QAAAA,EAAmBT,GACzD,CAACU,EAAeC,EAAiB,CAAGF,GAAAA,+BAAAA,QAAAA,EAAS,IAQ7CG,EAAe,IACnB,IAAME,EAAoBP,EAAe,QAAQ,CAACM,GAC9CN,EAAe,M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U,M,GAEZ,oCAAC,Q,SAAK,oB,KARF,OAULA,EAAQ,GAAG,CAACgB,IACX,IAAM0B,EAAahC,EAAe,QAAQ,CAACM,EAAO,KAAK,EACvD,MACE,qCAACuB,qCAAAA,WAAWA,CAAAA,CAEV,SAAU,IAAMxB,EAAaC,EAAO,KAAK,EACzC,UAAU,iB,UAEV,oCAACyB,sCAAAA,QAAQA,CAAAA,CAAC,QAASC,EAAY,UAAU,M,GACxC1B,EAAO,IAAI,EACV,oCAACA,EAAO,IAAI,EAAC,UAAU,2B,GAEzB,oCAAC,Q,SAAMA,EAAO,KAAK,KARdA,EAAO,KAAK,CAWvB,G,aAOd,G,yBAGFlB,YAAY,WAAW,CAAG,c"}
|
|
1
|
+
{"version":3,"file":"components\\multi-select.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/components/multi-select.tsx"],"sourcesContent":["\r\n\r\nimport { CaretDown, CaretUp, X } from '@phosphor-icons/react/dist/ssr'\r\nimport { ComponentProps, ComponentType, KeyboardEvent, useState } from 'react'\r\n\r\nimport { VariantProps, cn, tv } from '../lib/utils'\r\nimport { Badge } from './badge'\r\nimport { Button } from './button'\r\nimport { Checkbox } from './checkbox'\r\nimport {\r\n Command,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandInput,\r\n CommandItem,\r\n CommandList,\r\n} from './command'\r\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\r\n\r\nconst multiSelectVariants = tv({\r\n base: 'h-6 gap-0 px-1.5 font-normal text-xs',\r\n variants: {\r\n variant: {\r\n default: 'rounded-sm bg-azure-50 text-azure-500 hover:bg-card/80',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n },\r\n})\r\n\r\ntype MultiSelectProps = ComponentProps<'button'> &\r\n VariantProps<typeof multiSelectVariants> & {\r\n options: {\r\n label: string\r\n value: string\r\n icon?: ComponentType<{ className?: string }>\r\n }[]\r\n defaultValue?: string[]\r\n placeholder?: string\r\n maxCount?: number\r\n modalPopover?: boolean\r\n asChild?: boolean\r\n className?: string\r\n onValueChange?: (value: string[]) => void\r\n }\r\n\r\nfunction MultiSelect({\r\n options,\r\n onValueChange,\r\n variant,\r\n defaultValue = [],\r\n placeholder = 'Select options',\r\n maxCount = 2,\r\n modalPopover = false,\r\n className,\r\n ...props\r\n}: MultiSelectProps) {\r\n const [selectedValues, setSelectedValues] = useState<string[]>(defaultValue)\r\n const [isPopoverOpen, setIsPopoverOpen] = useState(false)\r\n\r\n const handleInputKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === 'Enter') {\r\n setIsPopoverOpen(true)\r\n }\r\n }\r\n\r\n const toggleOption = (option: string) => {\r\n const newSelectedValues = selectedValues.includes(option)\r\n ? selectedValues.filter(value => value !== option)\r\n : [...selectedValues, option]\r\n setSelectedValues(newSelectedValues)\r\n onValueChange?.(newSelectedValues)\r\n }\r\n\r\n const handleClear = () => {\r\n setSelectedValues([])\r\n onValueChange?.([])\r\n }\r\n\r\n const handleTogglePopover = () => {\r\n setIsPopoverOpen(prev => !prev)\r\n }\r\n\r\n const clearExtraOptions = () => {\r\n const newSelectedValues = selectedValues.slice(0, maxCount)\r\n setSelectedValues(newSelectedValues)\r\n onValueChange?.(newSelectedValues)\r\n }\r\n\r\n const toggleAll = () => {\r\n if (selectedValues.length === options.length) {\r\n handleClear()\r\n } else {\r\n const allValues = options.map(option => option.value)\r\n setSelectedValues(allValues)\r\n onValueChange?.(allValues)\r\n }\r\n }\r\n\r\n return (\r\n <Popover\r\n open={isPopoverOpen}\r\n onOpenChange={setIsPopoverOpen}\r\n modal={modalPopover}\r\n >\r\n <PopoverTrigger asChild>\r\n <Button\r\n {...props}\r\n onClick={handleTogglePopover}\r\n className={cn(\r\n 'flex h-12 w-auto min-w-60 items-center justify-between rounded-md border border-stroke bg-white px-3 hover:bg-gray-50',\r\n className\r\n )}\r\n >\r\n {selectedValues.length > 0 ? (\r\n <div className=\"flex w-full items-center justify-between\">\r\n <div className=\"flex items-center gap-x-1\">\r\n {selectedValues.slice(0, maxCount).map(value => {\r\n const option = options.find(o => o.value === value)\r\n const IconComponent = option?.icon\r\n return (\r\n <Badge\r\n key={value}\r\n className={cn(multiSelectVariants({ variant }))}\r\n >\r\n {IconComponent && (\r\n <IconComponent className=\"mr-2 h-4 w-4\" />\r\n )}\r\n <span className=\"max-w-32 truncate\">{option?.label}</span>\r\n <X\r\n className=\"ml-1 size-3 cursor-pointer\"\r\n onClick={event => {\r\n event.stopPropagation()\r\n toggleOption(value)\r\n }}\r\n />\r\n </Badge>\r\n )\r\n })}\r\n\r\n {selectedValues.length > maxCount && (\r\n <Badge className={cn(multiSelectVariants({ variant }))}>\r\n {`+ ${selectedValues.length - maxCount} ...`}\r\n <X\r\n className=\"ml-1 size-3 cursor-pointer\"\r\n onClick={event => {\r\n event.stopPropagation()\r\n clearExtraOptions()\r\n }}\r\n />\r\n </Badge>\r\n )}\r\n </div>\r\n <div className=\"ml-4 flex items-center\">\r\n {isPopoverOpen ? (\r\n <CaretUp\r\n weight=\"bold\"\r\n className=\"size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n ) : (\r\n <CaretDown\r\n weight=\"bold\"\r\n className=\"size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n ) : (\r\n <div className=\"mx-auto flex w-full items-center justify-between\">\r\n <span className=\"font-normal text-gbm-dark/50 text-sm\">\r\n {placeholder === 'Select options'\r\n ? 'Selecione as opções'\r\n : placeholder}\r\n </span>\r\n {isPopoverOpen ? (\r\n <CaretUp\r\n weight=\"bold\"\r\n className=\"ml-2 size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n ) : (\r\n <CaretDown\r\n weight=\"bold\"\r\n className=\"ml-2 size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n )}\r\n </div>\r\n )}\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent\r\n className=\"w-auto p-0\"\r\n align=\"start\"\r\n onEscapeKeyDown={() => setIsPopoverOpen(false)}\r\n >\r\n <Command>\r\n <CommandInput\r\n placeholder=\"Pesquisar...\"\r\n onKeyDown={handleInputKeyDown}\r\n />\r\n <CommandList>\r\n <CommandEmpty>Nenhum resultado encontrado.</CommandEmpty>\r\n <CommandGroup>\r\n <CommandItem\r\n key=\"all\"\r\n onSelect={toggleAll}\r\n className=\"cursor-pointer\"\r\n >\r\n <Checkbox\r\n checked={selectedValues.length === options.length}\r\n className=\"mr-2\"\r\n />\r\n <span>(Selecionar todos)</span>\r\n </CommandItem>\r\n {options.map(option => {\r\n const isSelected = selectedValues.includes(option.value)\r\n return (\r\n <CommandItem\r\n key={option.value}\r\n onSelect={() => toggleOption(option.value)}\r\n className=\"cursor-pointer\"\r\n >\r\n <Checkbox checked={isSelected} className=\"mr-2\" />\r\n {option.icon && (\r\n <option.icon className=\"mr-2 size-4 text-gbm-dark\" />\r\n )}\r\n <span>{option.label}</span>\r\n </CommandItem>\r\n )\r\n })}\r\n </CommandGroup>\r\n </CommandList>\r\n </Command>\r\n </PopoverContent>\r\n </Popover>\r\n )\r\n}\r\n\r\nexport { MultiSelect, multiSelectVariants }\r\n"],"names":["multiSelectVariants","tv","MultiSelect","options","onValueChange","variant","defaultValue","placeholder","maxCount","modalPopover","className","props","selectedValues","setSelectedValues","useState","isPopoverOpen","setIsPopoverOpen","toggleOption","option","newSelectedValues","value","handleClear","clearExtraOptions","Popover","PopoverTrigger","Button","prev","cn","o","IconComponent","Badge","X","event","CaretUp","CaretDown","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandGroup","CommandItem","allValues","Checkbox","isSelected"],"mappings":";y2CAmBMA,oBAAsBC,GAAAA,0BAAAA,EAAAA,EAAG,CAC7B,KAAM,uCACN,SAAU,CACR,QAAS,CACP,QAAS,wDACX,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,GAkBA,SAASC,YAAY,CACnBC,QAAAA,CAAO,CACPC,cAAAA,CAAa,CACbC,QAAAA,CAAO,CACPC,aAAAA,EAAe,EAAE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qCAAAA,WAAWA,CAAAA,CAEV,SAnHI,KAChB,GAAI7B,EAAe,MAAM,GAAKT,EAAQ,MAAM,CAC1CkB,QACK,CACL,IAAMqB,EAAYvC,EAAQ,GAAG,CAACe,GAAUA,EAAO,KAAK,EACpDL,EAAkB6B,GAClBtC,IAAgBsC,EAClB,CACF,EA4Gc,UAAU,iB,UAEV,oCAACC,sCAAAA,QAAQA,CAAAA,CACP,QAAS/B,EAAe,MAAM,GAAKT,EAAQ,MAAM,CACjD,UAAU,M,GAEZ,oCAAC,Q,SAAK,oB,KARF,OAULA,EAAQ,GAAG,CAACe,IACX,IAAM0B,EAAahC,EAAe,QAAQ,CAACM,EAAO,KAAK,EACvD,MACE,qCAACuB,qCAAAA,WAAWA,CAAAA,CAEV,SAAU,IAAMxB,EAAaC,EAAO,KAAK,EACzC,UAAU,iB,UAEV,oCAACyB,sCAAAA,QAAQA,CAAAA,CAAC,QAASC,EAAY,UAAU,M,GACxC1B,EAAO,IAAI,EACV,oCAACA,EAAO,IAAI,EAAC,UAAU,2B,GAEzB,oCAAC,Q,SAAMA,EAAO,KAAK,KARdA,EAAO,KAAK,CAWvB,G,aAOd,C"}
|
package/dist/cjs/lib/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{cn:()=>cn});let external_clsx_namespaceObject=require("clsx"),external_tailwind_merge_namespaceObject=require("tailwind-merge");function cn(...e){return(0,external_tailwind_merge_namespaceObject.twMerge)((0,external_clsx_namespaceObject.clsx)(e))}for(var __webpack_i__ in exports.cn=__webpack_exports__.cn,__webpack_exports__)-1===["cn"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
1
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{cn:()=>cn,tv:()=>external_tailwind_variants_namespaceObject.tv});let external_clsx_namespaceObject=require("clsx"),external_tailwind_merge_namespaceObject=require("tailwind-merge"),external_tailwind_variants_namespaceObject=require("tailwind-variants");function cn(...e){return(0,external_tailwind_merge_namespaceObject.twMerge)((0,external_clsx_namespaceObject.clsx)(e))}for(var __webpack_i__ in exports.cn=__webpack_exports__.cn,exports.tv=__webpack_exports__.tv,__webpack_exports__)-1===["cn","tv"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib\\utils.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/lib/utils.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"lib\\utils.cjs","sources":["webpack://@gbmtech/aurora-ui/./src/lib/utils.ts"],"sourcesContent":["import type { ClassValue } from \"clsx\";\r\n\r\nimport { clsx } from \"clsx\";\r\nimport { twMerge } from \"tailwind-merge\";\r\n\r\n/**\r\n * Combines class names using `clsx` and merges them using `tailwind-merge`.\r\n * This ensures optimized class name handling for conditional and Tailwind-based classes.\r\n *\r\n * @param inputs - List of class names or conditional class name objects.\r\n * @returns A single optimized string of class names.\r\n */\r\nexport function cn(...inputs: ClassValue[]): string {\r\n return twMerge(clsx(inputs));\r\n}\r\n\r\nexport type { VariantProps } from \"tailwind-variants\";\r\n\r\nexport { tv } from \"tailwind-variants\";"],"names":["cn","inputs","twMerge","clsx"],"mappings":"ygCAYO,SAASA,GAAG,GAAGC,CAAoB,EACxC,MAAOC,AAAAA,GAAAA,wCAAAA,OAAAA,AAAAA,EAAQC,AAAAA,GAAAA,8BAAAA,IAAAA,AAAAA,EAAKF,GACtB,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as r from"react/jsx-runtime";import*as e from"
|
|
1
|
+
import*as r from"react/jsx-runtime";import*as e from"../lib/utils.js";let t=(0,e.tv)({base:"inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function n({className:n,variant:o,...a}){return(0,r.jsx)("div",{className:(0,e.cn)(t({variant:o}),n),...a})}export{n as Badge,t as badgeVariants};
|
|
2
2
|
//# sourceMappingURL=badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\badge.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/badge.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"components\\badge.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/badge.tsx"],"sourcesContent":["import { ComponentProps } from 'react'\r\n\r\nimport { VariantProps, cn, tv } from '../lib/utils'\r\n\r\nconst badgeVariants = tv({\r\n base: 'inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',\r\n variants: {\r\n variant: {\r\n default:\r\n 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',\r\n secondary:\r\n 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',\r\n destructive:\r\n 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',\r\n outline: 'text-foreground',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n },\r\n})\r\n\r\ntype BadgeProps = ComponentProps<'div'> & VariantProps<typeof badgeVariants>\r\n\r\nfunction Badge({ className, variant, ...props }: BadgeProps) {\r\n return (\r\n <div className={cn(badgeVariants({ variant }), className)} {...props} />\r\n )\r\n}\r\n\r\nexport { Badge, badgeVariants, type BadgeProps }\r\n"],"names":["badgeVariants","tv","Badge","className","variant","props","cn"],"mappings":"sEAIA,IAAMA,EAAgBC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EAAG,CACvB,KAAM,yKACN,SAAU,CACR,QAAS,CACP,QACE,4EACF,UACE,kFACF,YACE,wFACF,QAAS,iBACX,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,GAIA,SAASC,EAAM,CAAEC,UAAAA,CAAS,CAAEC,QAAAA,CAAO,CAAE,GAAGC,EAAmB,EACzD,MACE,UAAC,OAAI,UAAWC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EAAGN,EAAc,CAAEI,QAAAA,CAAQ,GAAID,GAAa,GAAGE,CAAK,A,EAExE,Q"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"react/jsx-runtime";import*as
|
|
1
|
+
import*as e from"react/jsx-runtime";import*as t from"@phosphor-icons/react/dist/ssr";import*as r from"@radix-ui/react-slot";import*as o from"../lib/utils.js";let i=(0,o.tv)({base:"flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gbm-sky focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 max-lg:text-sm",variants:{variant:{primary:"bg-gbm-sky text-white hover:bg-gbm-ocean",secondary:"border border-stroke bg-white text-gbm-dark hover:bg-gray-100",tertiary:"border border-stroke bg-white text-gbm-sky hover:bg-gray-100",outline:"border border-gbm-sky bg-white text-gbm-sky hover:bg-gbm-sky hover:text-white",ghost:"text-gbm-dark hover:border-gbm-blue hover:bg-gray-100",destructive:"bg-rose-600 text-white hover:bg-rose-700",link:"text-gbm-dark underline-offset-2 hover:underline"},size:{sm:"h-10 gap-1.5 px-3 py-2",md:"h-12 gap-4 px-3 py-2",lg:"h-14 gap-6 px-3 py-4",icon:"h-10 w-10 p-2"},rounded:{true:"rounded-full",false:"rounded-md"},loading:{true:"pointer-events-none",false:""}},defaultVariants:{variant:"primary",size:"sm",rounded:!1,loading:!1}});function s({className:s,children:a,variant:n,size:b,rounded:d,disabled:g,loading:l,asChild:m=!1,...u}){let c=m?r.Slot:"button";return(0,e.jsx)(c,{className:(0,o.cn)(i({variant:n,size:b,rounded:d,loading:l,className:s})),"data-variant":n,disabled:g||l,type:"button",...u,children:(0,e.jsx)(r.Slottable,{children:l?(0,e.jsx)(t.CircleNotch,{className:"animate-spin",size:16}):a})})}export{s as Button,i as buttonVariants};
|
|
2
2
|
//# sourceMappingURL=button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\button.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/button.tsx"],"sourcesContent":["import { CircleNotch } from '@phosphor-icons/react/dist/ssr'\r\nimport { Slot, Slottable } from '@radix-ui/react-slot'\r\nimport {
|
|
1
|
+
{"version":3,"file":"components\\button.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/button.tsx"],"sourcesContent":["import { CircleNotch } from '@phosphor-icons/react/dist/ssr'\r\nimport { Slot, Slottable } from '@radix-ui/react-slot'\r\nimport { ComponentProps } from 'react'\r\n\r\nimport type { VariantProps } from '../lib/utils'\r\n\r\nimport { cn, tv } from '../lib/utils'\r\n\r\nconst buttonVariants = tv({\r\n base: 'flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gbm-sky focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 max-lg:text-sm',\r\n variants: {\r\n variant: {\r\n primary: 'bg-gbm-sky text-white hover:bg-gbm-ocean',\r\n secondary:\r\n 'border border-stroke bg-white text-gbm-dark hover:bg-gray-100',\r\n tertiary: 'border border-stroke bg-white text-gbm-sky hover:bg-gray-100',\r\n outline:\r\n 'border border-gbm-sky bg-white text-gbm-sky hover:bg-gbm-sky hover:text-white',\r\n ghost: 'text-gbm-dark hover:border-gbm-blue hover:bg-gray-100',\r\n destructive: 'bg-rose-600 text-white hover:bg-rose-700',\r\n link: 'text-gbm-dark underline-offset-2 hover:underline',\r\n },\r\n size: {\r\n sm: 'h-10 gap-1.5 px-3 py-2',\r\n md: 'h-12 gap-4 px-3 py-2',\r\n lg: 'h-14 gap-6 px-3 py-4',\r\n icon: 'h-10 w-10 p-2',\r\n },\r\n rounded: {\r\n true: 'rounded-full',\r\n false: 'rounded-md',\r\n },\r\n loading: {\r\n true: 'pointer-events-none',\r\n false: '',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'primary',\r\n size: 'sm',\r\n rounded: false,\r\n loading: false,\r\n },\r\n})\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Component: Button\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport type ButtonProps = ComponentProps<'button'> &\r\n VariantProps<typeof buttonVariants> & {\r\n asChild?: boolean\r\n }\r\n\r\nfunction Button({\r\n className,\r\n children,\r\n variant,\r\n size,\r\n rounded,\r\n disabled,\r\n loading,\r\n asChild = false,\r\n ...props\r\n}: ButtonProps) {\r\n const Comp = asChild ? Slot : 'button'\r\n\r\n return (\r\n <Comp\r\n className={cn(\r\n buttonVariants({ variant, size, rounded, loading, className })\r\n )}\r\n data-variant={variant}\r\n disabled={disabled || loading}\r\n type=\"button\"\r\n {...props}\r\n >\r\n <Slottable>\r\n {loading ? (\r\n <CircleNotch className=\"animate-spin\" size={16} />\r\n ) : (\r\n children\r\n )}\r\n </Slottable>\r\n </Comp>\r\n )\r\n}\r\n\r\n/* -----------------------------------------------------------------------------\r\n * Exports\r\n * -------------------------------------------------------------------------- */\r\n\r\nexport { Button, buttonVariants }\r\n"],"names":["buttonVariants","tv","Button","className","children","variant","size","rounded","disabled","loading","asChild","props","Comp","Slot","cn","Slottable","CircleNotch"],"mappings":"8JAQA,IAAMA,EAAiBC,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EAAG,CACxB,KAAM,iRACN,SAAU,CACR,QAAS,CACP,QAAS,2CACT,UACE,gEACF,SAAU,+DACV,QACE,gFACF,MAAO,wDACP,YAAa,2CACb,KAAM,kDACR,EACA,KAAM,CACJ,GAAI,yBACJ,GAAI,uBACJ,GAAI,uBACJ,KAAM,eACR,EACA,QAAS,CACP,KAAM,eACN,MAAO,YACT,EACA,QAAS,CACP,KAAM,sBACN,MAAO,EACT,CACF,EACA,gBAAiB,CACf,QAAS,UACT,KAAM,KACN,QAAS,GACT,QAAS,EACX,CACF,GAWA,SAASC,EAAO,CACdC,UAAAA,CAAS,CACTC,SAAAA,CAAQ,CACRC,QAAAA,CAAO,CACPC,KAAAA,CAAI,CACJC,QAAAA,CAAO,CACPC,SAAAA,CAAQ,CACRC,QAAAA,CAAO,CACPC,QAAAA,EAAU,EAAK,CACf,GAAGC,EACS,EACZ,IAAMC,EAAOF,EAAUG,EAAAA,IAAIA,CAAG,SAE9B,MACE,UAACD,EAAAA,CACC,UAAWE,AAAAA,GAAAA,EAAAA,EAAAA,AAAAA,EACTd,EAAe,CAAEK,QAAAA,EAASC,KAAAA,EAAMC,QAAAA,EAASE,QAAAA,EAASN,UAAAA,CAAU,IAE9D,eAAcE,EACd,SAAUG,GAAYC,EACtB,KAAK,SACJ,GAAGE,CAAK,C,SAET,UAACI,EAAAA,SAASA,CAAAA,C,SACPN,EACC,UAACO,EAAAA,WAAWA,CAAAA,CAAC,UAAU,eAAe,KAAM,E,GAE5CZ,C,IAKV,Q"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import*as
|
|
2
|
+
import*as e from"react/jsx-runtime";import*as r from"@radix-ui/react-label";import*as t from"../lib/utils.js";function a({className:a,...o}){return(0,e.jsx)(r.Root,{className:(0,t.cn)("font-medium text-base text-gbm-dark leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",a),...o})}export{a as Label};
|
|
3
3
|
//# sourceMappingURL=label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\label.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/label.tsx"],"sourcesContent":["\r\n\r\nimport * as LabelPrimitive from '@radix-ui/react-label'\r\nimport {
|
|
1
|
+
{"version":3,"file":"components\\label.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/label.tsx"],"sourcesContent":["\r\n\r\nimport * as LabelPrimitive from '@radix-ui/react-label'\r\nimport { ComponentProps } from 'react'\r\n\r\nimport { cn } from '../lib/utils'\r\n\r\nfunction Label({\r\n className,\r\n ...props\r\n}: ComponentProps<typeof LabelPrimitive.Root>) {\r\n return (\r\n <LabelPrimitive.Root\r\n className={cn(\r\n 'font-medium text-base text-gbm-dark leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nexport { Label }\r\n"],"names":["Label","className","props","LabelPrimitive","cn"],"mappings":";8GAOA,SAASA,EAAM,CACbC,UAAAA,CAAS,CACT,GAAGC,EACwC,EAC3C,MACE,UAACC,EAAAA,IAAmB,EAClB,UAAWC,GAAAA,EAAAA,EAAAA,EACT,6GACAH,GAED,GAAGC,CAAK,EAGf,Q"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import*as e from"react/jsx-runtime";import*as s from"@phosphor-icons/react/dist/ssr";import*as
|
|
2
|
+
import*as e from"react/jsx-runtime";import*as s from"@phosphor-icons/react/dist/ssr";import*as t from"react";import*as a from"../lib/utils.js";import*as r from"./badge.js";import*as l from"./button.js";import*as o from"./checkbox.js";import*as n from"./command.js";import*as i from"./popover.js";let c=(0,a.tv)({base:"h-6 gap-0 px-1.5 font-normal text-xs",variants:{variant:{default:"rounded-sm bg-azure-50 text-azure-500 hover:bg-card/80"}},defaultVariants:{variant:"default"}});function m({options:m,onValueChange:d,variant:x,defaultValue:p=[],placeholder:h="Select options",maxCount:u=2,modalPopover:j=!1,className:g,...b}){let[f,N]=(0,t.useState)(p),[v,w]=(0,t.useState)(!1),C=e=>{let s=f.includes(e)?f.filter(s=>s!==e):[...f,e];N(s),d?.(s)},k=()=>{N([]),d?.([])},S=()=>{let e=f.slice(0,u);N(e),d?.(e)};return(0,e.jsxs)(i.Popover,{open:v,onOpenChange:w,modal:j,children:[(0,e.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,e.jsx)(l.Button,{...b,onClick:()=>{w(e=>!e)},className:(0,a.cn)("flex h-12 w-auto min-w-60 items-center justify-between rounded-md border border-stroke bg-white px-3 hover:bg-gray-50",g),children:f.length>0?(0,e.jsxs)("div",{className:"flex w-full items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-x-1",children:[f.slice(0,u).map(t=>{let l=m.find(e=>e.value===t),o=l?.icon;return(0,e.jsxs)(r.Badge,{className:(0,a.cn)(c({variant:x})),children:[o&&(0,e.jsx)(o,{className:"mr-2 h-4 w-4"}),(0,e.jsx)("span",{className:"max-w-32 truncate",children:l?.label}),(0,e.jsx)(s.X,{className:"ml-1 size-3 cursor-pointer",onClick:e=>{e.stopPropagation(),C(t)}})]},t)}),f.length>u&&(0,e.jsxs)(r.Badge,{className:(0,a.cn)(c({variant:x})),children:[`+ ${f.length-u} ...`,(0,e.jsx)(s.X,{className:"ml-1 size-3 cursor-pointer",onClick:e=>{e.stopPropagation(),S()}})]})]}),(0,e.jsx)("div",{className:"ml-4 flex items-center",children:v?(0,e.jsx)(s.CaretUp,{weight:"bold",className:"size-4 cursor-pointer text-gbm-dark"}):(0,e.jsx)(s.CaretDown,{weight:"bold",className:"size-4 cursor-pointer text-gbm-dark"})})]}):(0,e.jsxs)("div",{className:"mx-auto flex w-full items-center justify-between",children:[(0,e.jsx)("span",{className:"font-normal text-gbm-dark/50 text-sm",children:"Select options"===h?"Selecione as op\xe7\xf5es":h}),v?(0,e.jsx)(s.CaretUp,{weight:"bold",className:"ml-2 size-4 cursor-pointer text-gbm-dark"}):(0,e.jsx)(s.CaretDown,{weight:"bold",className:"ml-2 size-4 cursor-pointer text-gbm-dark"})]})})}),(0,e.jsx)(i.PopoverContent,{className:"w-auto p-0",align:"start",onEscapeKeyDown:()=>w(!1),children:(0,e.jsxs)(n.Command,{children:[(0,e.jsx)(n.CommandInput,{placeholder:"Pesquisar...",onKeyDown:e=>{"Enter"===e.key&&w(!0)}}),(0,e.jsxs)(n.CommandList,{children:[(0,e.jsx)(n.CommandEmpty,{children:"Nenhum resultado encontrado."}),(0,e.jsxs)(n.CommandGroup,{children:[(0,e.jsxs)(n.CommandItem,{onSelect:()=>{if(f.length===m.length)k();else{let e=m.map(e=>e.value);N(e),d?.(e)}},className:"cursor-pointer",children:[(0,e.jsx)(o.Checkbox,{checked:f.length===m.length,className:"mr-2"}),(0,e.jsx)("span",{children:"(Selecionar todos)"})]},"all"),m.map(s=>{let t=f.includes(s.value);return(0,e.jsxs)(n.CommandItem,{onSelect:()=>C(s.value),className:"cursor-pointer",children:[(0,e.jsx)(o.Checkbox,{checked:t,className:"mr-2"}),s.icon&&(0,e.jsx)(s.icon,{className:"mr-2 size-4 text-gbm-dark"}),(0,e.jsx)("span",{children:s.label})]},s.value)})]})]})]})})]})}export{m as MultiSelect,c as multiSelectVariants};
|
|
3
3
|
//# sourceMappingURL=multi-select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\multi-select.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/multi-select.tsx"],"sourcesContent":["\r\n\r\nimport { CaretDown, CaretUp, X } from '@phosphor-icons/react/dist/ssr'\r\nimport { type VariantProps, cva } from 'class-variance-authority'\r\nimport {\r\n ButtonHTMLAttributes,\r\n ComponentType,\r\n KeyboardEvent,\r\n forwardRef,\r\n useState,\r\n} from 'react'\r\n\r\nimport { cn } from '../lib/utils'\r\nimport { Badge } from './badge'\r\nimport { Button } from './button'\r\nimport { Checkbox } from './checkbox'\r\nimport {\r\n Command,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandInput,\r\n CommandItem,\r\n CommandList,\r\n} from './command'\r\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\r\n\r\nconst multiSelectVariants = cva('h-6 gap-0 px-1.5 font-normal text-xs', {\r\n variants: {\r\n variant: {\r\n default: 'rounded-sm bg-azure-50 text-azure-500 hover:bg-card/80',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n },\r\n})\r\n\r\ninterface MultiSelectProps\r\n extends ButtonHTMLAttributes<HTMLButtonElement>,\r\n VariantProps<typeof multiSelectVariants> {\r\n options: {\r\n label: string\r\n value: string\r\n icon?: ComponentType<{ className?: string }>\r\n }[]\r\n defaultValue?: string[]\r\n placeholder?: string\r\n maxCount?: number\r\n modalPopover?: boolean\r\n asChild?: boolean\r\n className?: string\r\n onValueChange?: (value: string[]) => void\r\n}\r\n\r\nexport const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(\r\n (\r\n {\r\n options,\r\n onValueChange,\r\n variant,\r\n defaultValue = [],\r\n placeholder = 'Select options',\r\n maxCount = 2,\r\n modalPopover = false,\r\n className,\r\n ...props\r\n },\r\n ref\r\n ) => {\r\n const [selectedValues, setSelectedValues] = useState<string[]>(defaultValue)\r\n const [isPopoverOpen, setIsPopoverOpen] = useState(false)\r\n\r\n const handleInputKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === 'Enter') {\r\n setIsPopoverOpen(true)\r\n }\r\n }\r\n\r\n const toggleOption = (option: string) => {\r\n const newSelectedValues = selectedValues.includes(option)\r\n ? selectedValues.filter(value => value !== option)\r\n : [...selectedValues, option]\r\n setSelectedValues(newSelectedValues)\r\n onValueChange?.(newSelectedValues)\r\n }\r\n\r\n const handleClear = () => {\r\n setSelectedValues([])\r\n onValueChange?.([])\r\n }\r\n\r\n const handleTogglePopover = () => {\r\n setIsPopoverOpen(prev => !prev)\r\n }\r\n\r\n const clearExtraOptions = () => {\r\n const newSelectedValues = selectedValues.slice(0, maxCount)\r\n setSelectedValues(newSelectedValues)\r\n onValueChange?.(newSelectedValues)\r\n }\r\n\r\n const toggleAll = () => {\r\n if (selectedValues.length === options.length) {\r\n handleClear()\r\n } else {\r\n const allValues = options.map(option => option.value)\r\n setSelectedValues(allValues)\r\n onValueChange?.(allValues)\r\n }\r\n }\r\n\r\n return (\r\n <Popover\r\n open={isPopoverOpen}\r\n onOpenChange={setIsPopoverOpen}\r\n modal={modalPopover}\r\n >\r\n <PopoverTrigger asChild>\r\n <Button\r\n ref={ref}\r\n {...props}\r\n onClick={handleTogglePopover}\r\n className={cn(\r\n 'flex h-12 w-auto min-w-60 items-center justify-between rounded-md border border-stroke bg-white px-3 hover:bg-gray-50',\r\n className\r\n )}\r\n >\r\n {selectedValues.length > 0 ? (\r\n <div className=\"flex w-full items-center justify-between\">\r\n <div className=\"flex items-center gap-x-1\">\r\n {selectedValues.slice(0, maxCount).map(value => {\r\n const option = options.find(o => o.value === value)\r\n const IconComponent = option?.icon\r\n return (\r\n <Badge\r\n key={value}\r\n className={cn(multiSelectVariants({ variant }))}\r\n >\r\n {IconComponent && (\r\n <IconComponent className=\"mr-2 h-4 w-4\" />\r\n )}\r\n <span className=\"max-w-32 truncate\">\r\n {option?.label}\r\n </span>\r\n <X\r\n className=\"ml-1 size-3 cursor-pointer\"\r\n onClick={event => {\r\n event.stopPropagation()\r\n toggleOption(value)\r\n }}\r\n />\r\n </Badge>\r\n )\r\n })}\r\n\r\n {selectedValues.length > maxCount && (\r\n <Badge className={cn(multiSelectVariants({ variant }))}>\r\n {`+ ${selectedValues.length - maxCount} ...`}\r\n <X\r\n className=\"ml-1 size-3 cursor-pointer\"\r\n onClick={event => {\r\n event.stopPropagation()\r\n clearExtraOptions()\r\n }}\r\n />\r\n </Badge>\r\n )}\r\n </div>\r\n <div className=\"ml-4 flex items-center\">\r\n {isPopoverOpen ? (\r\n <CaretUp\r\n weight=\"bold\"\r\n className=\"size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n ) : (\r\n <CaretDown\r\n weight=\"bold\"\r\n className=\"size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n ) : (\r\n <div className=\"mx-auto flex w-full items-center justify-between\">\r\n <span className=\"font-normal text-gbm-dark/50 text-sm\">\r\n {placeholder === 'Select options'\r\n ? 'Selecione as opções'\r\n : placeholder}\r\n </span>\r\n {isPopoverOpen ? (\r\n <CaretUp\r\n weight=\"bold\"\r\n className=\"ml-2 size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n ) : (\r\n <CaretDown\r\n weight=\"bold\"\r\n className=\"ml-2 size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n )}\r\n </div>\r\n )}\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent\r\n className=\"w-auto p-0\"\r\n align=\"start\"\r\n onEscapeKeyDown={() => setIsPopoverOpen(false)}\r\n >\r\n <Command>\r\n <CommandInput\r\n placeholder=\"Pesquisar...\"\r\n onKeyDown={handleInputKeyDown}\r\n />\r\n <CommandList>\r\n <CommandEmpty>Nenhum resultado encontrado.</CommandEmpty>\r\n <CommandGroup>\r\n <CommandItem\r\n key=\"all\"\r\n onSelect={toggleAll}\r\n className=\"cursor-pointer\"\r\n >\r\n <Checkbox\r\n checked={selectedValues.length === options.length}\r\n className=\"mr-2\"\r\n />\r\n <span>(Selecionar todos)</span>\r\n </CommandItem>\r\n {options.map(option => {\r\n const isSelected = selectedValues.includes(option.value)\r\n return (\r\n <CommandItem\r\n key={option.value}\r\n onSelect={() => toggleOption(option.value)}\r\n className=\"cursor-pointer\"\r\n >\r\n <Checkbox checked={isSelected} className=\"mr-2\" />\r\n {option.icon && (\r\n <option.icon className=\"mr-2 size-4 text-gbm-dark\" />\r\n )}\r\n <span>{option.label}</span>\r\n </CommandItem>\r\n )\r\n })}\r\n </CommandGroup>\r\n </CommandList>\r\n </Command>\r\n </PopoverContent>\r\n </Popover>\r\n )\r\n }\r\n)\r\n\r\nMultiSelect.displayName = 'MultiSelect'\r\n"],"names":["multiSelectVariants","cva","MultiSelect","forwardRef","options","onValueChange","variant","defaultValue","placeholder","maxCount","modalPopover","className","props","ref","selectedValues","setSelectedValues","useState","isPopoverOpen","setIsPopoverOpen","toggleOption","option","newSelectedValues","value","handleClear","clearExtraOptions","Popover","PopoverTrigger","Button","prev","cn","o","IconComponent","Badge","X","event","CaretUp","CaretDown","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandGroup","CommandItem","allValues","Checkbox","isSelected"],"mappings":";mVA0BA,IAAMA,EAAsBC,GAAAA,EAAAA,GAAAA,EAAI,uCAAwC,CACtE,SAAU,CACR,QAAS,CACP,QAAS,wDACX,CACF,EACA,gBAAiB,CACf,QAAS,SACX,CACF,GAmBaC,EAAcC,GAAAA,EAAAA,UAAAA,EACzB,CACE,CACEC,QAAAA,CAAO,CACPC,cAAAA,CAAa,CACbC,QAAAA,CAAO,CACPC,aAAAA,EAAe,EAAE,CACjBC,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,EAAe,MAAM,GAAKV,EAAQ,MAAM,CAC1CmB,QACK,CACL,IAAMqB,EAAYxC,EAAQ,GAAG,CAACgB,GAAUA,EAAO,KAAK,EACpDL,EAAkB6B,GAClBvC,IAAgBuC,EAClB,CACF,EA+Gc,UAAU,iB,UAEV,UAACC,EAAAA,QAAQA,CAAAA,CACP,QAAS/B,EAAe,MAAM,GAAKV,EAAQ,MAAM,CACjD,UAAU,M,GAEZ,UAAC,Q,SAAK,oB,KARF,OAULA,EAAQ,GAAG,CAACgB,IACX,IAAM0B,EAAahC,EAAe,QAAQ,CAACM,EAAO,KAAK,EACvD,MACE,WAACuB,EAAAA,WAAWA,CAAAA,CAEV,SAAU,IAAMxB,EAAaC,EAAO,KAAK,EACzC,UAAU,iB,UAEV,UAACyB,EAAAA,QAAQA,CAAAA,CAAC,QAASC,EAAY,UAAU,M,GACxC1B,EAAO,IAAI,EACV,UAACA,EAAO,IAAI,EAAC,UAAU,2B,GAEzB,UAAC,Q,SAAMA,EAAO,KAAK,KARdA,EAAO,KAAK,CAWvB,G,aAOd,EAGFlB,CAAAA,EAAY,WAAW,CAAG,qB"}
|
|
1
|
+
{"version":3,"file":"components\\multi-select.js","sources":["webpack://@gbmtech/aurora-ui/./src/components/multi-select.tsx"],"sourcesContent":["\r\n\r\nimport { CaretDown, CaretUp, X } from '@phosphor-icons/react/dist/ssr'\r\nimport { ComponentProps, ComponentType, KeyboardEvent, useState } from 'react'\r\n\r\nimport { VariantProps, cn, tv } from '../lib/utils'\r\nimport { Badge } from './badge'\r\nimport { Button } from './button'\r\nimport { Checkbox } from './checkbox'\r\nimport {\r\n Command,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandInput,\r\n CommandItem,\r\n CommandList,\r\n} from './command'\r\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\r\n\r\nconst multiSelectVariants = tv({\r\n base: 'h-6 gap-0 px-1.5 font-normal text-xs',\r\n variants: {\r\n variant: {\r\n default: 'rounded-sm bg-azure-50 text-azure-500 hover:bg-card/80',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n },\r\n})\r\n\r\ntype MultiSelectProps = ComponentProps<'button'> &\r\n VariantProps<typeof multiSelectVariants> & {\r\n options: {\r\n label: string\r\n value: string\r\n icon?: ComponentType<{ className?: string }>\r\n }[]\r\n defaultValue?: string[]\r\n placeholder?: string\r\n maxCount?: number\r\n modalPopover?: boolean\r\n asChild?: boolean\r\n className?: string\r\n onValueChange?: (value: string[]) => void\r\n }\r\n\r\nfunction MultiSelect({\r\n options,\r\n onValueChange,\r\n variant,\r\n defaultValue = [],\r\n placeholder = 'Select options',\r\n maxCount = 2,\r\n modalPopover = false,\r\n className,\r\n ...props\r\n}: MultiSelectProps) {\r\n const [selectedValues, setSelectedValues] = useState<string[]>(defaultValue)\r\n const [isPopoverOpen, setIsPopoverOpen] = useState(false)\r\n\r\n const handleInputKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === 'Enter') {\r\n setIsPopoverOpen(true)\r\n }\r\n }\r\n\r\n const toggleOption = (option: string) => {\r\n const newSelectedValues = selectedValues.includes(option)\r\n ? selectedValues.filter(value => value !== option)\r\n : [...selectedValues, option]\r\n setSelectedValues(newSelectedValues)\r\n onValueChange?.(newSelectedValues)\r\n }\r\n\r\n const handleClear = () => {\r\n setSelectedValues([])\r\n onValueChange?.([])\r\n }\r\n\r\n const handleTogglePopover = () => {\r\n setIsPopoverOpen(prev => !prev)\r\n }\r\n\r\n const clearExtraOptions = () => {\r\n const newSelectedValues = selectedValues.slice(0, maxCount)\r\n setSelectedValues(newSelectedValues)\r\n onValueChange?.(newSelectedValues)\r\n }\r\n\r\n const toggleAll = () => {\r\n if (selectedValues.length === options.length) {\r\n handleClear()\r\n } else {\r\n const allValues = options.map(option => option.value)\r\n setSelectedValues(allValues)\r\n onValueChange?.(allValues)\r\n }\r\n }\r\n\r\n return (\r\n <Popover\r\n open={isPopoverOpen}\r\n onOpenChange={setIsPopoverOpen}\r\n modal={modalPopover}\r\n >\r\n <PopoverTrigger asChild>\r\n <Button\r\n {...props}\r\n onClick={handleTogglePopover}\r\n className={cn(\r\n 'flex h-12 w-auto min-w-60 items-center justify-between rounded-md border border-stroke bg-white px-3 hover:bg-gray-50',\r\n className\r\n )}\r\n >\r\n {selectedValues.length > 0 ? (\r\n <div className=\"flex w-full items-center justify-between\">\r\n <div className=\"flex items-center gap-x-1\">\r\n {selectedValues.slice(0, maxCount).map(value => {\r\n const option = options.find(o => o.value === value)\r\n const IconComponent = option?.icon\r\n return (\r\n <Badge\r\n key={value}\r\n className={cn(multiSelectVariants({ variant }))}\r\n >\r\n {IconComponent && (\r\n <IconComponent className=\"mr-2 h-4 w-4\" />\r\n )}\r\n <span className=\"max-w-32 truncate\">{option?.label}</span>\r\n <X\r\n className=\"ml-1 size-3 cursor-pointer\"\r\n onClick={event => {\r\n event.stopPropagation()\r\n toggleOption(value)\r\n }}\r\n />\r\n </Badge>\r\n )\r\n })}\r\n\r\n {selectedValues.length > maxCount && (\r\n <Badge className={cn(multiSelectVariants({ variant }))}>\r\n {`+ ${selectedValues.length - maxCount} ...`}\r\n <X\r\n className=\"ml-1 size-3 cursor-pointer\"\r\n onClick={event => {\r\n event.stopPropagation()\r\n clearExtraOptions()\r\n }}\r\n />\r\n </Badge>\r\n )}\r\n </div>\r\n <div className=\"ml-4 flex items-center\">\r\n {isPopoverOpen ? (\r\n <CaretUp\r\n weight=\"bold\"\r\n className=\"size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n ) : (\r\n <CaretDown\r\n weight=\"bold\"\r\n className=\"size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n )}\r\n </div>\r\n </div>\r\n ) : (\r\n <div className=\"mx-auto flex w-full items-center justify-between\">\r\n <span className=\"font-normal text-gbm-dark/50 text-sm\">\r\n {placeholder === 'Select options'\r\n ? 'Selecione as opções'\r\n : placeholder}\r\n </span>\r\n {isPopoverOpen ? (\r\n <CaretUp\r\n weight=\"bold\"\r\n className=\"ml-2 size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n ) : (\r\n <CaretDown\r\n weight=\"bold\"\r\n className=\"ml-2 size-4 cursor-pointer text-gbm-dark\"\r\n />\r\n )}\r\n </div>\r\n )}\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent\r\n className=\"w-auto p-0\"\r\n align=\"start\"\r\n onEscapeKeyDown={() => setIsPopoverOpen(false)}\r\n >\r\n <Command>\r\n <CommandInput\r\n placeholder=\"Pesquisar...\"\r\n onKeyDown={handleInputKeyDown}\r\n />\r\n <CommandList>\r\n <CommandEmpty>Nenhum resultado encontrado.</CommandEmpty>\r\n <CommandGroup>\r\n <CommandItem\r\n key=\"all\"\r\n onSelect={toggleAll}\r\n className=\"cursor-pointer\"\r\n >\r\n <Checkbox\r\n checked={selectedValues.length === options.length}\r\n className=\"mr-2\"\r\n />\r\n <span>(Selecionar todos)</span>\r\n </CommandItem>\r\n {options.map(option => {\r\n const isSelected = selectedValues.includes(option.value)\r\n return (\r\n <CommandItem\r\n key={option.value}\r\n onSelect={() => toggleOption(option.value)}\r\n className=\"cursor-pointer\"\r\n >\r\n <Checkbox checked={isSelected} className=\"mr-2\" />\r\n {option.icon && (\r\n <option.icon className=\"mr-2 size-4 text-gbm-dark\" />\r\n )}\r\n <span>{option.label}</span>\r\n </CommandItem>\r\n )\r\n })}\r\n </CommandGroup>\r\n </CommandList>\r\n </Command>\r\n </PopoverContent>\r\n </Popover>\r\n )\r\n}\r\n\r\nexport { MultiSelect, multiSelectVariants }\r\n"],"names":["multiSelectVariants","tv","MultiSelect","options","onValueChange","variant","defaultValue","placeholder","maxCount","modalPopover","className","props","selectedValues","setSelectedValues","useState","isPopoverOpen","setIsPopoverOpen","toggleOption","option","newSelectedValues","value","handleClear","clearExtraOptions","Popover","PopoverTrigger","Button","prev","cn","o","IconComponent","Badge","X","event","CaretUp","CaretDown","PopoverContent","Command","CommandInput","CommandList","CommandEmpty","CommandGroup","CommandItem","allValues","Checkbox","is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YAAY,eACZ,UAzIiB,IACrBL,UAAAA,EAAM,GAAG,EACXhB,EAAiB,GAErB,C,GAuIQ,WAACsB,EAAAA,WAAWA,CAAAA,C,UACV,UAACC,EAAAA,YAAYA,CAAAA,C,SAAC,8B,GACd,WAACC,EAAAA,YAAYA,CAAAA,C,UACX,WAACC,EAAAA,WAAWA,CAAAA,CAEV,SAnHI,KAChB,GAAI7B,EAAe,MAAM,GAAKT,EAAQ,MAAM,CAC1CkB,QACK,CACL,IAAMqB,EAAYvC,EAAQ,GAAG,CAACe,GAAUA,EAAO,KAAK,EACpDL,EAAkB6B,GAClBtC,IAAgBsC,EAClB,CACF,EA4Gc,UAAU,iB,UAEV,UAACC,EAAAA,QAAQA,CAAAA,CACP,QAAS/B,EAAe,MAAM,GAAKT,EAAQ,MAAM,CACjD,UAAU,M,GAEZ,UAAC,Q,SAAK,oB,KARF,OAULA,EAAQ,GAAG,CAACe,IACX,IAAM0B,EAAahC,EAAe,QAAQ,CAACM,EAAO,KAAK,EACvD,MACE,WAACuB,EAAAA,WAAWA,CAAAA,CAEV,SAAU,IAAMxB,EAAaC,EAAO,KAAK,EACzC,UAAU,iB,UAEV,UAACyB,EAAAA,QAAQA,CAAAA,CAAC,QAASC,EAAY,UAAU,M,GACxC1B,EAAO,IAAI,EACV,UAACA,EAAO,IAAI,EAAC,UAAU,2B,GAEzB,UAAC,Q,SAAMA,EAAO,KAAK,KARdA,EAAO,KAAK,CAWvB,G,aAOd,Q"}
|
package/dist/esm/lib/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as r from"clsx";import*as t from"tailwind-merge";function
|
|
1
|
+
import*as r from"clsx";import*as t from"tailwind-merge";import*as a from"tailwind-variants";function i(...a){return(0,t.twMerge)((0,r.clsx)(a))}var o=a.tv;export{i as cn,o as tv};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib\\utils.js","sources":["webpack://@gbmtech/aurora-ui/./src/lib/utils.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"lib\\utils.js","sources":["webpack://@gbmtech/aurora-ui/./src/lib/utils.ts"],"sourcesContent":["import type { ClassValue } from \"clsx\";\r\n\r\nimport { clsx } from \"clsx\";\r\nimport { twMerge } from \"tailwind-merge\";\r\n\r\n/**\r\n * Combines class names using `clsx` and merges them using `tailwind-merge`.\r\n * This ensures optimized class name handling for conditional and Tailwind-based classes.\r\n *\r\n * @param inputs - List of class names or conditional class name objects.\r\n * @returns A single optimized string of class names.\r\n */\r\nexport function cn(...inputs: ClassValue[]): string {\r\n return twMerge(clsx(inputs));\r\n}\r\n\r\nexport type { VariantProps } from \"tailwind-variants\";\r\n\r\nexport { tv } from \"tailwind-variants\";"],"names":["cn","inputs","twMerge","clsx"],"mappings":"4FAYO,SAASA,EAAG,GAAGC,CAAoB,EACxC,MAAOC,AAAAA,GAAAA,EAAAA,OAAAA,AAAAA,EAAQC,AAAAA,GAAAA,EAAAA,IAAAA,AAAAA,EAAKF,GACtB,C"}
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
declare const badgeVariants: (
|
|
4
|
-
variant
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { VariantProps } from '../lib/utils';
|
|
3
|
+
declare const badgeVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
default: string;
|
|
6
|
+
secondary: string;
|
|
7
|
+
destructive: string;
|
|
8
|
+
outline: string;
|
|
9
|
+
};
|
|
10
|
+
}, undefined, "inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", {
|
|
11
|
+
variant: {
|
|
12
|
+
default: string;
|
|
13
|
+
secondary: string;
|
|
14
|
+
destructive: string;
|
|
15
|
+
outline: string;
|
|
16
|
+
};
|
|
17
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
18
|
+
variant: {
|
|
19
|
+
default: string;
|
|
20
|
+
secondary: string;
|
|
21
|
+
destructive: string;
|
|
22
|
+
outline: string;
|
|
23
|
+
};
|
|
24
|
+
}, undefined, "inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", unknown, unknown, undefined>>;
|
|
25
|
+
type BadgeProps = ComponentProps<'div'> & VariantProps<typeof badgeVariants>;
|
|
8
26
|
declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
|
|
10
|
-
var displayName: string;
|
|
11
|
-
}
|
|
12
|
-
export { Badge, badgeVariants };
|
|
27
|
+
export { Badge, badgeVariants, type BadgeProps };
|
|
@@ -1,13 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
declare const buttonVariants: (
|
|
4
|
-
variant
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import type { VariantProps } from '../lib/utils';
|
|
3
|
+
declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
primary: string;
|
|
6
|
+
secondary: string;
|
|
7
|
+
tertiary: string;
|
|
8
|
+
outline: string;
|
|
9
|
+
ghost: string;
|
|
10
|
+
destructive: string;
|
|
11
|
+
link: string;
|
|
12
|
+
};
|
|
13
|
+
size: {
|
|
14
|
+
sm: string;
|
|
15
|
+
md: string;
|
|
16
|
+
lg: string;
|
|
17
|
+
icon: string;
|
|
18
|
+
};
|
|
19
|
+
rounded: {
|
|
20
|
+
true: string;
|
|
21
|
+
false: string;
|
|
22
|
+
};
|
|
23
|
+
loading: {
|
|
24
|
+
true: string;
|
|
25
|
+
false: string;
|
|
26
|
+
};
|
|
27
|
+
}, undefined, "flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gbm-sky focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 max-lg:text-sm", {
|
|
28
|
+
variant: {
|
|
29
|
+
primary: string;
|
|
30
|
+
secondary: string;
|
|
31
|
+
tertiary: string;
|
|
32
|
+
outline: string;
|
|
33
|
+
ghost: string;
|
|
34
|
+
destructive: string;
|
|
35
|
+
link: string;
|
|
36
|
+
};
|
|
37
|
+
size: {
|
|
38
|
+
sm: string;
|
|
39
|
+
md: string;
|
|
40
|
+
lg: string;
|
|
41
|
+
icon: string;
|
|
42
|
+
};
|
|
43
|
+
rounded: {
|
|
44
|
+
true: string;
|
|
45
|
+
false: string;
|
|
46
|
+
};
|
|
47
|
+
loading: {
|
|
48
|
+
true: string;
|
|
49
|
+
false: string;
|
|
50
|
+
};
|
|
51
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
52
|
+
variant: {
|
|
53
|
+
primary: string;
|
|
54
|
+
secondary: string;
|
|
55
|
+
tertiary: string;
|
|
56
|
+
outline: string;
|
|
57
|
+
ghost: string;
|
|
58
|
+
destructive: string;
|
|
59
|
+
link: string;
|
|
60
|
+
};
|
|
61
|
+
size: {
|
|
62
|
+
sm: string;
|
|
63
|
+
md: string;
|
|
64
|
+
lg: string;
|
|
65
|
+
icon: string;
|
|
66
|
+
};
|
|
67
|
+
rounded: {
|
|
68
|
+
true: string;
|
|
69
|
+
false: string;
|
|
70
|
+
};
|
|
71
|
+
loading: {
|
|
72
|
+
true: string;
|
|
73
|
+
false: string;
|
|
74
|
+
};
|
|
75
|
+
}, undefined, "flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gbm-sky focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 max-lg:text-sm", unknown, unknown, undefined>>;
|
|
76
|
+
export type ButtonProps = ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
10
77
|
asChild?: boolean;
|
|
11
|
-
}
|
|
12
|
-
declare
|
|
78
|
+
};
|
|
79
|
+
declare function Button({ className, children, variant, size, rounded, disabled, loading, asChild, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
13
80
|
export { Button, buttonVariants };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
-
import {
|
|
3
|
-
declare
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
declare function Label({ className, ...props }: ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export { Label };
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
declare const multiSelectVariants: (
|
|
4
|
-
variant
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ComponentProps, ComponentType } from 'react';
|
|
2
|
+
import { VariantProps } from '../lib/utils';
|
|
3
|
+
declare const multiSelectVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
}, undefined, "h-6 gap-0 px-1.5 font-normal text-xs", {
|
|
8
|
+
variant: {
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
12
|
+
variant: {
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
}, undefined, "h-6 gap-0 px-1.5 font-normal text-xs", unknown, unknown, undefined>>;
|
|
16
|
+
type MultiSelectProps = ComponentProps<'button'> & VariantProps<typeof multiSelectVariants> & {
|
|
7
17
|
options: {
|
|
8
18
|
label: string;
|
|
9
19
|
value: string;
|
|
@@ -18,6 +28,6 @@ interface MultiSelectProps extends ButtonHTMLAttributes<HTMLButtonElement>, Vari
|
|
|
18
28
|
asChild?: boolean;
|
|
19
29
|
className?: string;
|
|
20
30
|
onValueChange?: (value: string[]) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export {};
|
|
31
|
+
};
|
|
32
|
+
declare function MultiSelect({ options, onValueChange, variant, defaultValue, placeholder, maxCount, modalPopover, className, ...props }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export { MultiSelect, multiSelectVariants };
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ClassValue } from "clsx";
|
|
2
|
+
/**
|
|
3
|
+
* Combines class names using `clsx` and merges them using `tailwind-merge`.
|
|
4
|
+
* This ensures optimized class name handling for conditional and Tailwind-based classes.
|
|
5
|
+
*
|
|
6
|
+
* @param inputs - List of class names or conditional class name objects.
|
|
7
|
+
* @returns A single optimized string of class names.
|
|
8
|
+
*/
|
|
2
9
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
10
|
+
export type { VariantProps } from "tailwind-variants";
|
|
11
|
+
export { tv } from "tailwind-variants";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gbmtech/aurora-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -21,7 +21,17 @@
|
|
|
21
21
|
"default": "./dist/cjs/index.cjs"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"./styles.css": "./dist/esm/index.css"
|
|
24
|
+
"./styles.css": "./dist/esm/index.css",
|
|
25
|
+
"./button": {
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./dist/types/components/button.d.ts",
|
|
28
|
+
"default": "./dist/esm/components/button.js"
|
|
29
|
+
},
|
|
30
|
+
"require": {
|
|
31
|
+
"types": "./dist/types/components/button.d.ts",
|
|
32
|
+
"default": "./dist/cjs/components/button.cjs"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
25
35
|
},
|
|
26
36
|
"devDependencies": {
|
|
27
37
|
"@rsbuild/plugin-react": "^1.2.0",
|
|
@@ -53,8 +63,7 @@
|
|
|
53
63
|
"@radix-ui/react-switch": "^1.0.3",
|
|
54
64
|
"@radix-ui/react-tabs": "^1.0.4",
|
|
55
65
|
"@radix-ui/react-tooltip": "^1.0.7",
|
|
56
|
-
"
|
|
57
|
-
"clsx": "^2.0.0",
|
|
66
|
+
"clsx": "^2.1.1",
|
|
58
67
|
"cmdk": "^1.0.0",
|
|
59
68
|
"date-fns": "^4.1.0",
|
|
60
69
|
"framer-motion": "^12.5.0",
|
|
@@ -63,7 +72,8 @@
|
|
|
63
72
|
"react-day-picker": "^9.2.0",
|
|
64
73
|
"react-dom": "^18.3.1",
|
|
65
74
|
"react-hook-form": "^7.55.0",
|
|
66
|
-
"tailwind-merge": "^
|
|
75
|
+
"tailwind-merge": "^3.2.0",
|
|
76
|
+
"tailwind-variants": "^1.0.0",
|
|
67
77
|
"tailwindcss-animate": "^1.0.6",
|
|
68
78
|
"zod": "^3.24.1"
|
|
69
79
|
},
|