@kumix/ui 0.3.14 → 0.3.15
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/README.md +11 -11
- package/dist/components/motion/animated-toast-stack.js +4 -3
- package/dist/components/motion/animated-toast-stack.js.map +1 -1
- package/dist/components/motion/command-palette.d.ts.map +1 -1
- package/dist/components/motion/command-palette.js +2 -21
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/tabs.js +1 -1
- package/dist/components/motion/tabs.js.map +1 -1
- package/dist/components/motion/tooltip-surface.d.ts +12 -0
- package/dist/components/motion/tooltip-surface.d.ts.map +1 -0
- package/dist/components/motion/tooltip-surface.js +97 -0
- package/dist/components/motion/tooltip-surface.js.map +1 -0
- package/dist/components/motion/tooltip.d.ts +13 -3
- package/dist/components/motion/tooltip.d.ts.map +1 -1
- package/dist/components/motion/tooltip.js +74 -103
- package/dist/components/motion/tooltip.js.map +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts.map +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/autocomplete.js.map +1 -1
- package/dist/components/reui/badge.d.ts +2 -2
- package/dist/components/reui/filters/filters-builder.js +1 -1
- package/dist/components/reui/filters/filters-editors.js +1 -1
- package/dist/components/reui/frame.d.ts +5 -11
- package/dist/components/reui/frame.d.ts.map +1 -1
- package/dist/components/reui/frame.js +9 -16
- package/dist/components/reui/frame.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/reui/number-field.d.ts.map +1 -1
- package/dist/components/reui/number-field.js +3 -3
- package/dist/components/reui/number-field.js.map +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/item.d.ts +3 -3
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/hooks/use-dismiss.d.ts +1 -1
- package/dist/hooks/use-dismiss.d.ts.map +1 -1
- package/dist/hooks/use-dismiss.js.map +1 -1
- package/dist/lib/command-search.d.ts +10 -0
- package/dist/lib/command-search.d.ts.map +1 -0
- package/dist/lib/command-search.js +52 -0
- package/dist/lib/command-search.js.map +1 -0
- package/package.json +5 -5
|
@@ -18,9 +18,9 @@ const numberFieldGroupVariants = cva("relative flex w-full justify-between round
|
|
|
18
18
|
});
|
|
19
19
|
const numberFieldButtonVariants = cva("relative flex shrink-0 cursor-pointer items-center justify-center transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent", {
|
|
20
20
|
variants: { size: {
|
|
21
|
-
sm: "
|
|
22
|
-
default: "
|
|
23
|
-
lg: "
|
|
21
|
+
sm: ["px-1.5", "[&_svg:not([class*='size-'])]:size-3.5"],
|
|
22
|
+
default: ["px-2", "[&_svg:not([class*='size-'])]:size-4"],
|
|
23
|
+
lg: ["px-2.5", "[&_svg:not([class*='size-'])]:size-4"]
|
|
24
24
|
} },
|
|
25
25
|
defaultVariants: { size: "default" }
|
|
26
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field.js","names":["NumberFieldPrimitive"],"sources":["../../../src/components/reui/number-field.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { createContext, useContext, useId } from \"react\";\nimport { NumberField as NumberFieldPrimitive } from \"@base-ui/react/number-field\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { cva } from \"class-variance-authority\";\nimport { MinusIcon, PlusIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Label } from \"../ui/label\";\n\nconst NumberFieldContext = createContext<{\n fieldId: string;\n size: \"sm\" | \"default\" | \"lg\";\n} | null>(null);\n\nconst numberFieldGroupVariants = cva(\n \"relative flex w-full justify-between rounded-lg border border-input bg-transparent transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 focus-within:has-aria-invalid:border-destructive focus-within:has-aria-invalid:ring-destructive/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:focus-within:has-aria-invalid:ring-destructive/40\",\n {\n variants: {\n size: {\n sm: \"h-7 text-sm\",\n default: \"h-8 text-sm\",\n lg: \"h-9 text-sm\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nconst numberFieldButtonVariants = cva(\n \"relative flex shrink-0 cursor-pointer items-center justify-center transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent\",\n {\n variants: {\n size: {\n sm: \"([class*='size-'])]:size-3.5 ([class*='size-'])]:size-3.5 ([class*='size-'])]:size-3.5 ([class*='size-'])]:size-3 ([class*='size-'])]:size-3.5 ([class*='size-'])]:size-3.5 px-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n default:\n \"([class*='size-'])]:size-4 ([class*='size-'])]:size-4 ([class*='size-'])]:size-4 ([class*='size-'])]:size-3.5 ([class*='size-'])]:size-4 ([class*='size-'])]:size-3.5 px-2 [&_svg:not([class*='size-'])]:size-4\",\n lg: \"([class*='size-'])]:size-4 ([class*='size-'])]:size-4 ([class*='size-'])]:size-4 ([class*='size-'])]:size-3.5 ([class*='size-'])]:size-4 ([class*='size-'])]:size-3.5 px-2.5 [&_svg:not([class*='size-'])]:size-4\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nconst numberFieldInputVariants = cva(\n \"w-full min-w-0 flex-1 bg-transparent text-center tabular-nums outline-none\",\n {\n variants: {\n size: {\n sm: \"px-2 py-0.5\",\n default: \"px-2.5 py-1\",\n lg: \"px-2.5 py-1.5\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nfunction NumberField({\n id,\n className,\n size = \"default\",\n ...props\n}: NumberFieldPrimitive.Root.Props & VariantProps<typeof numberFieldGroupVariants>) {\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const sizeValue = size ?? \"default\";\n\n return (\n <NumberFieldContext.Provider value={{ fieldId, size: sizeValue }}>\n <NumberFieldPrimitive.Root\n className={cn(\"flex w-full flex-col items-start gap-2\", className)}\n data-size={sizeValue}\n data-slot=\"number-field\"\n id={fieldId}\n {...props}\n />\n </NumberFieldContext.Provider>\n );\n}\n\nfunction NumberFieldGroup({\n className,\n size: sizeProp,\n ...props\n}: NumberFieldPrimitive.Group.Props & Partial<VariantProps<typeof numberFieldGroupVariants>>) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\"NumberFieldGroup must be used within a NumberField component.\");\n }\n const size = sizeProp ?? context.size;\n\n return (\n <NumberFieldPrimitive.Group\n className={cn(numberFieldGroupVariants({ size }), className)}\n data-slot=\"number-field-group\"\n {...props}\n />\n );\n}\n\nfunction NumberFieldDecrement({\n className,\n size: sizeProp,\n children,\n ...props\n}: NumberFieldPrimitive.Decrement.Props &\n Partial<VariantProps<typeof numberFieldButtonVariants>> & {\n children?: React.ReactNode;\n }) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\"NumberFieldDecrement must be used within a NumberField component.\");\n }\n const size = sizeProp ?? context.size;\n\n return (\n <NumberFieldPrimitive.Decrement\n className={cn(numberFieldButtonVariants({ size }), \"rounded-s-lg border-e-0\", className)}\n data-slot=\"number-field-decrement\"\n {...props}\n >\n {children ?? <MinusIcon />}\n </NumberFieldPrimitive.Decrement>\n );\n}\n\nfunction NumberFieldIncrement({\n className,\n size: sizeProp,\n children,\n ...props\n}: NumberFieldPrimitive.Increment.Props &\n Partial<VariantProps<typeof numberFieldButtonVariants>> & {\n children?: ReactNode;\n }) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\"NumberFieldIncrement must be used within a NumberField component.\");\n }\n const size = sizeProp ?? context.size;\n\n return (\n <NumberFieldPrimitive.Increment\n className={cn(numberFieldButtonVariants({ size }), \"rounded-e-lg border-s-0\", className)}\n data-slot=\"number-field-increment\"\n {...props}\n >\n {children ?? <PlusIcon />}\n </NumberFieldPrimitive.Increment>\n );\n}\n\nfunction NumberFieldInput({\n className,\n size: sizeProp,\n ...props\n}: NumberFieldPrimitive.Input.Props & Partial<VariantProps<typeof numberFieldInputVariants>>) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\"NumberFieldInput must be used within a NumberField component.\");\n }\n const size = sizeProp ?? context.size;\n\n return (\n <NumberFieldPrimitive.Input\n className={cn(numberFieldInputVariants({ size }), className)}\n data-slot=\"number-field-input\"\n {...props}\n />\n );\n}\n\nfunction NumberFieldScrubArea({\n className,\n label,\n ...props\n}: NumberFieldPrimitive.ScrubArea.Props & {\n label: string;\n}) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\n \"NumberFieldScrubArea must be used within a NumberField component for accessibility.\",\n );\n }\n\n return (\n <NumberFieldPrimitive.ScrubArea\n className={cn(\"flex cursor-ew-resize\", className)}\n data-slot=\"number-field-scrub-area\"\n {...props}\n >\n <Label className=\"cursor-ew-resize\" htmlFor={context.fieldId}>\n {label}\n </Label>\n <NumberFieldPrimitive.ScrubAreaCursor className=\"drop-shadow-[0_1px_1px_#0008] filter\">\n <CursorGrowIcon />\n </NumberFieldPrimitive.ScrubAreaCursor>\n </NumberFieldPrimitive.ScrubArea>\n );\n}\n\nfunction CursorGrowIcon(props: React.ComponentProps<\"svg\">) {\n return (\n <svg\n fill=\"black\"\n height=\"14\"\n stroke=\"white\"\n viewBox=\"0 0 24 14\"\n width=\"26\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path d=\"M19.5 5.5L6.49737 5.51844V2L1 6.9999L6.5 12L6.49737 8.5L19.5 8.5V12L25 6.9999L19.5 2V5.5Z\" />\n </svg>\n );\n}\n\nexport {\n NumberField,\n NumberFieldDecrement,\n NumberFieldGroup,\n NumberFieldIncrement,\n NumberFieldInput,\n NumberFieldScrubArea,\n};\n"],"mappings":";;;;;;;;;AAYA,MAAM,qBAAqB,cAGjB,IAAI;AAEd,MAAM,2BAA2B,IAC/B,4fACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,SAAS;EACT,IAAI;CACN,EACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CACF;AAEA,MAAM,4BAA4B,IAChC,gOACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,SACE;EACF,IAAI;CACN,EACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CACF;AAEA,MAAM,2BAA2B,IAC/B,8EACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,SAAS;EACT,IAAI;CACN,EACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CACF;AAEA,SAAS,YAAY,EACnB,IACA,WACA,OAAO,WACP,GAAG,SAC+E;CAClF,MAAM,cAAc,MAAM;CAC1B,MAAM,UAAU,MAAM;CACtB,MAAM,YAAY,QAAQ;CAE1B,OACE,oBAAC,mBAAmB,UAApB;EAA6B,OAAO;GAAE;GAAS,MAAM;EAAU;EAC7D,UAAA,oBAACA,cAAqB,MAAtB;GACE,WAAW,GAAG,0CAA0C,SAAS;GACjE,aAAW;GACX,aAAU;GACV,IAAI;GACJ,GAAI;EACL,CAAA;CAC0B,CAAA;AAEjC;AAEA,SAAS,iBAAiB,EACxB,WACA,MAAM,UACN,GAAG,SACyF;CAC5F,MAAM,UAAU,WAAW,kBAAkB;CAC7C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,+DAA+D;CAEjF,MAAM,OAAO,YAAY,QAAQ;CAEjC,OACE,oBAACA,cAAqB,OAAtB;EACE,WAAW,GAAG,yBAAyB,EAAE,KAAK,CAAC,GA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GAAG,yBAAyB,SAAS;EAChD,aAAU;EACV,GAAI;EAHN,UAAA,CAKE,oBAAC,OAAD;GAAO,WAAU;GAAmB,SAAS,QAAQ;GAClD,UAAA;EACI,CAAA,GACP,oBAACA,cAAqB,iBAAtB;GAAsC,WAAU;GAC9C,UAAA,oBAAC,gBAAD,CAAiB,CAAA;EACmB,CAAA,CACR;;AAEpC;AAEA,SAAS,eAAe,OAAoC;CAC1D,OACE,oBAAC,OAAD;EACE,MAAK;EACL,QAAO;EACP,QAAO;EACP,SAAQ;EACR,OAAM;EACN,OAAM;EACN,GAAI;EAEJ,UAAA,oBAAC,QAAD,EAAM,GAAE,4FAA6F,CAAA;CAClG,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"number-field.js","names":["NumberFieldPrimitive"],"sources":["../../../src/components/reui/number-field.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { createContext, useContext, useId } from \"react\";\nimport { NumberField as NumberFieldPrimitive } from \"@base-ui/react/number-field\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { cva } from \"class-variance-authority\";\nimport { MinusIcon, PlusIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Label } from \"../ui/label\";\n\nconst NumberFieldContext = createContext<{\n fieldId: string;\n size: \"sm\" | \"default\" | \"lg\";\n} | null>(null);\n\nconst numberFieldGroupVariants = cva(\n \"relative flex w-full justify-between rounded-lg border border-input bg-transparent transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 focus-within:has-aria-invalid:border-destructive focus-within:has-aria-invalid:ring-destructive/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:focus-within:has-aria-invalid:ring-destructive/40\",\n {\n variants: {\n // Ladders restored from the pre-rename source. Rhea was added after they\n // were written, so its rungs are new: rhea tracks nova here because\n // .cn-input is h-8 px-2.5 in both sheets, where luma is h-9 px-3.\n size: {\n sm: \"h-7 text-sm\",\n default: \"h-8 text-sm\",\n lg: \"h-9 text-sm\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nconst numberFieldButtonVariants = cva(\n \"relative flex shrink-0 cursor-pointer items-center justify-center transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent\",\n {\n variants: {\n size: {\n sm: [\"px-1.5\", \"[&_svg:not([class*='size-'])]:size-3.5\"],\n default: [\"px-2\", \"[&_svg:not([class*='size-'])]:size-4\"],\n lg: [\"px-2.5\", \"[&_svg:not([class*='size-'])]:size-4\"],\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nconst numberFieldInputVariants = cva(\n \"w-full min-w-0 flex-1 bg-transparent text-center tabular-nums outline-none\",\n {\n variants: {\n size: {\n sm: \"px-2 py-0.5\",\n default: \"px-2.5 py-1\",\n lg: \"px-2.5 py-1.5\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nfunction NumberField({\n id,\n className,\n size = \"default\",\n ...props\n}: NumberFieldPrimitive.Root.Props & VariantProps<typeof numberFieldGroupVariants>) {\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const sizeValue = size ?? \"default\";\n\n return (\n <NumberFieldContext.Provider value={{ fieldId, size: sizeValue }}>\n <NumberFieldPrimitive.Root\n className={cn(\"flex w-full flex-col items-start gap-2\", className)}\n data-size={sizeValue}\n data-slot=\"number-field\"\n id={fieldId}\n {...props}\n />\n </NumberFieldContext.Provider>\n );\n}\n\nfunction NumberFieldGroup({\n className,\n size: sizeProp,\n ...props\n}: NumberFieldPrimitive.Group.Props & Partial<VariantProps<typeof numberFieldGroupVariants>>) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\"NumberFieldGroup must be used within a NumberField component.\");\n }\n const size = sizeProp ?? context.size;\n\n return (\n <NumberFieldPrimitive.Group\n className={cn(numberFieldGroupVariants({ size }), className)}\n data-slot=\"number-field-group\"\n {...props}\n />\n );\n}\n\nfunction NumberFieldDecrement({\n className,\n size: sizeProp,\n children,\n ...props\n}: NumberFieldPrimitive.Decrement.Props &\n Partial<VariantProps<typeof numberFieldButtonVariants>> & {\n children?: React.ReactNode;\n }) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\"NumberFieldDecrement must be used within a NumberField component.\");\n }\n const size = sizeProp ?? context.size;\n\n return (\n <NumberFieldPrimitive.Decrement\n className={cn(numberFieldButtonVariants({ size }), \"rounded-s-lg border-e-0\", className)}\n data-slot=\"number-field-decrement\"\n {...props}\n >\n {children ?? <MinusIcon />}\n </NumberFieldPrimitive.Decrement>\n );\n}\n\nfunction NumberFieldIncrement({\n className,\n size: sizeProp,\n children,\n ...props\n}: NumberFieldPrimitive.Increment.Props &\n Partial<VariantProps<typeof numberFieldButtonVariants>> & {\n children?: ReactNode;\n }) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\"NumberFieldIncrement must be used within a NumberField component.\");\n }\n const size = sizeProp ?? context.size;\n\n return (\n <NumberFieldPrimitive.Increment\n className={cn(numberFieldButtonVariants({ size }), \"rounded-e-lg border-s-0\", className)}\n data-slot=\"number-field-increment\"\n {...props}\n >\n {children ?? <PlusIcon />}\n </NumberFieldPrimitive.Increment>\n );\n}\n\nfunction NumberFieldInput({\n className,\n size: sizeProp,\n ...props\n}: NumberFieldPrimitive.Input.Props & Partial<VariantProps<typeof numberFieldInputVariants>>) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\"NumberFieldInput must be used within a NumberField component.\");\n }\n const size = sizeProp ?? context.size;\n\n return (\n <NumberFieldPrimitive.Input\n className={cn(numberFieldInputVariants({ size }), className)}\n data-slot=\"number-field-input\"\n {...props}\n />\n );\n}\n\nfunction NumberFieldScrubArea({\n className,\n label,\n ...props\n}: NumberFieldPrimitive.ScrubArea.Props & {\n label: string;\n}) {\n const context = useContext(NumberFieldContext);\n if (!context) {\n throw new Error(\n \"NumberFieldScrubArea must be used within a NumberField component for accessibility.\",\n );\n }\n\n return (\n <NumberFieldPrimitive.ScrubArea\n className={cn(\"flex cursor-ew-resize\", className)}\n data-slot=\"number-field-scrub-area\"\n {...props}\n >\n <Label className=\"cursor-ew-resize\" htmlFor={context.fieldId}>\n {label}\n </Label>\n <NumberFieldPrimitive.ScrubAreaCursor className=\"drop-shadow-[0_1px_1px_#0008] filter\">\n <CursorGrowIcon />\n </NumberFieldPrimitive.ScrubAreaCursor>\n </NumberFieldPrimitive.ScrubArea>\n );\n}\n\nfunction CursorGrowIcon(props: React.ComponentProps<\"svg\">) {\n return (\n <svg\n fill=\"black\"\n height=\"14\"\n stroke=\"white\"\n viewBox=\"0 0 24 14\"\n width=\"26\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path d=\"M19.5 5.5L6.49737 5.51844V2L1 6.9999L6.5 12L6.49737 8.5L19.5 8.5V12L25 6.9999L19.5 2V5.5Z\" />\n </svg>\n );\n}\n\nexport {\n NumberField,\n NumberFieldDecrement,\n NumberFieldGroup,\n NumberFieldIncrement,\n NumberFieldInput,\n NumberFieldScrubArea,\n};\n"],"mappings":";;;;;;;;;AAYA,MAAM,qBAAqB,cAGjB,IAAI;AAEd,MAAM,2BAA2B,IAC/B,4fACA;CACE,UAAU,EAIR,MAAM;EACJ,IAAI;EACJ,SAAS;EACT,IAAI;CACN,EACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CACF;AAEA,MAAM,4BAA4B,IAChC,gOACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI,CAAC,UAAU,wCAAwC;EACvD,SAAS,CAAC,QAAQ,sCAAsC;EACxD,IAAI,CAAC,UAAU,sCAAsC;CACvD,EACF;CACA,iBAAiB,EACf,MAAM,UACR;AACF,CACF;AAEA,MAAM,2BAA2B,IAC/B,8EACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,SAAS;EACT,IAAI;CACN,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BAACA,cAAqB,WAAtB;EACE,WAAW,GAAG,0BAA0B,EAAE,KAAK,CAAC,GAAG,2BAA2B,SAAS;EACvF,aAAU;EACV,GAAI;EAEH,UAAA,YAAY,oBAAC,UAAD,CAAW,CAAA;CACM,CAAA;AAEpC;AAEA,SAAS,iBAAiB,EACxB,WACA,MAAM,UACN,GAAG,SACyF;CAC5F,MAAM,UAAU,WAAW,kBAAkB;CAC7C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,+DAA+D;CAEjF,MAAM,OAAO,YAAY,QAAQ;CAEjC,OACE,oBAACA,cAAqB,OAAtB;EACE,WAAW,GAAG,yBAAyB,EAAE,KAAK,CAAC,GAAG,SAAS;EAC3D,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,qBAAqB,EAC5B,WACA,OACA,GAAG,SAGF;CACD,MAAM,UAAU,WAAW,kBAAkB;CAC7C,IAAI,CAAC,SACH,MAAM,IAAI,MACR,qFACF;CAGF,OACE,qBAACA,cAAqB,WAAtB;EACE,WAAW,GAAG,yBAAyB,SAAS;EAChD,aAAU;EACV,GAAI;EAHN,UAAA,CAKE,oBAAC,OAAD;GAAO,WAAU;GAAmB,SAAS,QAAQ;GAClD,UAAA;EACI,CAAA,GACP,oBAACA,cAAqB,iBAAtB;GAAsC,WAAU;GAC9C,UAAA,oBAAC,gBAAD,CAAiB,CAAA;EACmB,CAAA,CACR;;AAEpC;AAEA,SAAS,eAAe,OAAoC;CAC1D,OACE,oBAAC,OAAD;EACE,MAAK;EACL,QAAO;EACP,QAAO;EACP,SAAQ;EACR,OAAM;EACN,OAAM;EACN,GAAI;EAEJ,UAAA,oBAAC,QAAD,EAAM,GAAE,4FAA6F,CAAA;CAClG,CAAA;AAET"}
|
|
@@ -4,7 +4,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
4
4
|
import { useRender } from "@base-ui/react/use-render";
|
|
5
5
|
//#region src/components/ui/attachment.d.ts
|
|
6
6
|
declare const attachmentVariants: (props?: ({
|
|
7
|
-
size?: "
|
|
7
|
+
size?: "xs" | "sm" | "default" | null | undefined;
|
|
8
8
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
10
|
declare function Attachment({ className, state, size, orientation, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
|
|
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { useRender } from "@base-ui/react/use-render";
|
|
3
3
|
//#region src/components/ui/badge.d.ts
|
|
4
4
|
declare const badgeVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "outline" | "default" | "link" | "ghost" | "destructive" | "secondary" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
8
8
|
//#endregion
|
|
@@ -4,7 +4,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
4
4
|
//#region src/components/ui/bubble.d.ts
|
|
5
5
|
declare function BubbleGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
6
6
|
declare const bubbleVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "outline" | "default" | "ghost" | "destructive" | "secondary" | "muted" | "tinted" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
declare function Bubble({ variant, align, className, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
|
|
10
10
|
align?: "start" | "end";
|
|
@@ -2,8 +2,8 @@ import { Button as Button$1 } from "@base-ui/react/button";
|
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
//#region src/components/ui/button.d.ts
|
|
4
4
|
declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
6
|
-
size?: "
|
|
5
|
+
variant?: "outline" | "default" | "link" | "ghost" | "destructive" | "secondary" | null | undefined;
|
|
6
|
+
size?: "xs" | "sm" | "default" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
|
|
9
9
|
//#endregion
|
|
@@ -8,7 +8,7 @@ declare const inputGroupAddonVariants: (props?: ({
|
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
declare function InputGroupAddon({ className, align, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): React$1.JSX.Element;
|
|
10
10
|
declare const inputGroupButtonVariants: (props?: ({
|
|
11
|
-
size?: "
|
|
11
|
+
size?: "xs" | "sm" | "icon-xs" | "icon-sm" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React$1.ComponentProps<typeof Button>, "size" | "type"> & VariantProps<typeof inputGroupButtonVariants> & {
|
|
14
14
|
type?: "button" | "submit" | "reset";
|
|
@@ -6,12 +6,12 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
6
6
|
declare function ItemGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
7
7
|
declare function ItemSeparator({ className, ...props }: React$1.ComponentProps<typeof Separator>): React$1.JSX.Element;
|
|
8
8
|
declare const itemVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
10
|
-
size?: "
|
|
9
|
+
variant?: "outline" | "default" | "muted" | null | undefined;
|
|
10
|
+
size?: "xs" | "sm" | "default" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
12
|
declare function Item({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
13
13
|
declare const itemMediaVariants: (props?: ({
|
|
14
|
-
variant?: "
|
|
14
|
+
variant?: "default" | "image" | "icon" | null | undefined;
|
|
15
15
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
16
|
declare function ItemMedia({ className, variant, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>): React$1.JSX.Element;
|
|
17
17
|
declare function ItemContent({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
3
3
|
import { useRender } from "@base-ui/react/use-render";
|
|
4
4
|
//#region src/components/ui/marker.d.ts
|
|
5
5
|
declare const markerVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "default" | "separator" | "border" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function Marker({ className, variant, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof markerVariants>): React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>>;
|
|
9
9
|
declare function MarkerIcon({ className, ...props }: React$1.ComponentProps<"span">): React$1.JSX.Element;
|
|
@@ -41,7 +41,7 @@ declare function SidebarGroupContent({ className, ...props }: React$1.ComponentP
|
|
|
41
41
|
declare function SidebarMenu({ className, ...props }: React$1.ComponentProps<"ul">): React$1.JSX.Element;
|
|
42
42
|
declare function SidebarMenuItem({ className, ...props }: React$1.ComponentProps<"li">): React$1.JSX.Element;
|
|
43
43
|
declare const sidebarMenuButtonVariants: (props?: ({
|
|
44
|
-
variant?: "
|
|
44
|
+
variant?: "outline" | "default" | null | undefined;
|
|
45
45
|
size?: "sm" | "default" | "lg" | null | undefined;
|
|
46
46
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
47
47
|
declare function SidebarMenuButton({ render, isActive, variant, size, tooltip, className, ...props }: useRender.ComponentProps<"button"> & React$1.ComponentProps<"button"> & {
|
|
@@ -3,7 +3,7 @@ import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
|
3
3
|
//#region src/components/ui/tabs.d.ts
|
|
4
4
|
declare function Tabs({ className, orientation, ...props }: Tabs$1.Root.Props): import("react").JSX.Element;
|
|
5
5
|
declare const tabsListVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "default" | "line" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function TabsList({ className, variant, ...props }: Tabs$1.List.Props & VariantProps<typeof tabsListVariants>): import("react").JSX.Element;
|
|
9
9
|
declare function TabsTrigger({ className, ...props }: Tabs$1.Tab.Props): import("react").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
3
3
|
//#region src/components/ui/toggle.d.ts
|
|
4
4
|
declare const toggleVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "outline" | "default" | null | undefined;
|
|
6
6
|
size?: "sm" | "default" | "lg" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function Toggle({ className, variant, size, ...props }: Toggle$1.Props & VariantProps<typeof toggleVariants>): import("react").JSX.Element;
|
|
@@ -28,6 +28,6 @@ export interface DismissOptions {
|
|
|
28
28
|
* what it is layered over. `onDismiss` and `ignore` must be stable (wrap in
|
|
29
29
|
* useCallback) so the listeners aren't re-bound every render while open.
|
|
30
30
|
*/
|
|
31
|
-
export declare function useDismiss(open: boolean, onDismiss: () => void, ref: RefObject<HTMLElement | null> | null, { behavior, escape: dismissOnEscape, ignore }?: DismissOptions): void;
|
|
31
|
+
export declare function useDismiss(open: boolean, onDismiss: () => void, ref: RefObject<HTMLElement | SVGElement | null> | null, { behavior, escape: dismissOnEscape, ignore }?: DismissOptions): void;
|
|
32
32
|
//#endregion
|
|
33
33
|
//# sourceMappingURL=use-dismiss.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-dismiss.d.ts","names":[],"sources":["../../src/hooks/use-dismiss.ts"],"mappings":";;;;;;;;;;;YAaY;iBAEK;;EAEf,WAAW;;EAEX;;EAEA,UAAU,QAAQ;;;;;;;;;;;;wBA0DJ,WACd,eACA,uBACA,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"use-dismiss.d.ts","names":[],"sources":["../../src/hooks/use-dismiss.ts"],"mappings":";;;;;;;;;;;YAaY;iBAEK;;EAEf,WAAW;;EAEX;;EAEA,UAAU,QAAQ;;;;;;;;;;;;wBA0DJ,WACd,eACA,uBACA,KAAK,UAAU,cAAc,6BAC3B,UAA2B,QAAQ,iBAAwB,WAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-dismiss.js","names":[],"sources":["../../src/hooks/use-dismiss.ts"],"sourcesContent":["\"use client\";\n\nimport { type RefObject, useEffect } from \"react\";\n\n/**\n * What the dismissing gesture does to the control it landed on.\n *\n * `\"pass-through\"` is the platform norm (native popover light-dismiss): the\n * tap closes the overlay *and* activates whatever was under it. Use\n * `\"consume\"` where the open overlay sits over or beside controls that would\n * be costly to trigger by accident — the dismissal then swallows the\n * activation too, so the gesture only closes.\n */\nexport type DismissBehavior = \"pass-through\" | \"consume\";\n\nexport interface DismissOptions {\n /** Default `\"pass-through\"`. */\n behavior?: DismissBehavior;\n /** Dismiss on Escape as well. Default true. */\n escape?: boolean;\n /** Return true for an outside target that should *not* dismiss. Must be stable. */\n ignore?: (target: Element) => boolean;\n}\n\n/**\n * What every currently open dismiss scope counts as inside itself. A consumed\n * dismissal reads this to tell a stray gesture from one that belongs to an\n * overlay in front of it: overlays have no shared z-order to consult, but the\n * one the gesture landed in has said as much by registering it.\n */\nconst openScopes = new Set<(target: Element) => boolean>();\n\nfunction claimedByAnotherScope(self: (target: Element) => boolean, target: Element) {\n for (const scope of openScopes) {\n if (scope !== self && scope(target)) return true;\n }\n return false;\n}\n\n// preventDefault on pointerdown does not suppress the click that follows, so\n// consuming a gesture means swallowing that click itself. The swallower\n// deliberately outlives the effect that installed it — the dismissal it\n// belongs to has already unmounted or re-rendered by the time the click lands.\n// It releases on that click, or on the next gesture if the pointer is dragged\n// away and no click ever arrives, so it can never eat a later one. A keydown\n// releases it too: a gesture that ends with neither a click nor a cancel would\n// otherwise leave it armed, and the click Enter synthesizes on some focused\n// control is not the one this dismissal was owed.\nfunction consumeActivation(source: Event) {\n const swallow = (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n release();\n };\n const restart = (event: Event) => {\n if (event !== source) release();\n };\n const release = () => {\n window.removeEventListener(\"click\", swallow, true);\n window.removeEventListener(\"pointerdown\", restart, true);\n window.removeEventListener(\"pointercancel\", restart, true);\n window.removeEventListener(\"keydown\", release, true);\n };\n window.addEventListener(\"click\", swallow, true);\n window.addEventListener(\"pointerdown\", restart, true);\n window.addEventListener(\"pointercancel\", restart, true);\n window.addEventListener(\"keydown\", release, true);\n}\n\n/**\n * Close an open overlay on Escape or a pointerdown outside `ref`. Pass `null`\n * for `ref` when what counts as inside isn't one element, and say so with\n * `ignore` instead.\n *\n * The pointerdown listener is capture-phase: a bubble-phase one is blinded by\n * any handler in between that stops propagation, and an overlay cannot know\n * what it is layered over. `onDismiss` and `ignore` must be stable (wrap in\n * useCallback) so the listeners aren't re-bound every render while open.\n */\nexport function useDismiss(\n open: boolean,\n onDismiss: () => void,\n ref: RefObject<HTMLElement | null> | null,\n { behavior = \"pass-through\", escape: dismissOnEscape = true, ignore }: DismissOptions = {},\n) {\n useEffect(() => {\n if (!open) return;\n const inside = (target: Element) =>\n Boolean(ref?.current?.contains(target)) || Boolean(ignore?.(target));\n const onKey = (event: KeyboardEvent) => {\n if (dismissOnEscape && event.key === \"Escape\") onDismiss();\n };\n const onPointer = (event: PointerEvent) => {\n const target = event.target as Element | null;\n if (!target || inside(target)) return;\n // Outside this overlay, but inside one that is also open: the gesture is\n // that overlay's to answer, and swallowing its click from behind would\n // cost the user the control they actually aimed at.\n if (behavior === \"consume\" && !claimedByAnotherScope(inside, target)) {\n consumeActivation(event);\n }\n onDismiss();\n };\n openScopes.add(inside);\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer, true);\n return () => {\n openScopes.delete(inside);\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer, true);\n };\n }, [open, onDismiss, ref, behavior, dismissOnEscape, ignore]);\n}\n"],"mappings":";;;;;;;;;AA8BA,MAAM,6BAAa,IAAI,IAAkC;AAEzD,SAAS,sBAAsB,MAAoC,QAAiB;CAClF,KAAK,MAAM,SAAS,YAClB,IAAI,UAAU,QAAQ,MAAM,MAAM,GAAG,OAAO;CAE9C,OAAO;AACT;AAWA,SAAS,kBAAkB,QAAe;CACxC,MAAM,WAAW,UAAsB;EACrC,MAAM,eAAe;EACrB,MAAM,gBAAgB;EACtB,QAAQ;CACV;CACA,MAAM,WAAW,UAAiB;EAChC,IAAI,UAAU,QAAQ,QAAQ;CAChC;CACA,MAAM,gBAAgB;EACpB,OAAO,oBAAoB,SAAS,SAAS,IAAI;EACjD,OAAO,oBAAoB,eAAe,SAAS,IAAI;EACvD,OAAO,oBAAoB,iBAAiB,SAAS,IAAI;EACzD,OAAO,oBAAoB,WAAW,SAAS,IAAI;CACrD;CACA,OAAO,iBAAiB,SAAS,SAAS,IAAI;CAC9C,OAAO,iBAAiB,eAAe,SAAS,IAAI;CACpD,OAAO,iBAAiB,iBAAiB,SAAS,IAAI;CACtD,OAAO,iBAAiB,WAAW,SAAS,IAAI;AAClD;;;;;;;;;;;AAYA,SAAgB,WACd,MACA,WACA,KACA,EAAE,WAAW,gBAAgB,QAAQ,kBAAkB,MAAM,WAA2B,CAAC,GACzF;CACA,gBAAgB;EACd,IAAI,CAAC,MAAM;EACX,MAAM,UAAU,WACd,QAAQ,KAAK,SAAS,SAAS,MAAM,CAAC,KAAK,QAAQ,SAAS,MAAM,CAAC;EACrE,MAAM,SAAS,UAAyB;GACtC,IAAI,mBAAmB,MAAM,QAAQ,UAAU,UAAU;EAC3D;EACA,MAAM,aAAa,UAAwB;GACzC,MAAM,SAAS,MAAM;GACrB,IAAI,CAAC,UAAU,OAAO,MAAM,GAAG;GAI/B,IAAI,aAAa,aAAa,CAAC,sBAAsB,QAAQ,MAAM,GACjE,kBAAkB,KAAK;GAEzB,UAAU;EACZ;EACA,WAAW,IAAI,MAAM;EACrB,OAAO,iBAAiB,WAAW,KAAK;EACxC,OAAO,iBAAiB,eAAe,WAAW,IAAI;EACtD,aAAa;GACX,WAAW,OAAO,MAAM;GACxB,OAAO,oBAAoB,WAAW,KAAK;GAC3C,OAAO,oBAAoB,eAAe,WAAW,IAAI;EAC3D;CACF,GAAG;EAAC;EAAM;EAAW;EAAK;EAAU;EAAiB;CAAM,CAAC;AAC9D"}
|
|
1
|
+
{"version":3,"file":"use-dismiss.js","names":[],"sources":["../../src/hooks/use-dismiss.ts"],"sourcesContent":["\"use client\";\n\nimport { type RefObject, useEffect } from \"react\";\n\n/**\n * What the dismissing gesture does to the control it landed on.\n *\n * `\"pass-through\"` is the platform norm (native popover light-dismiss): the\n * tap closes the overlay *and* activates whatever was under it. Use\n * `\"consume\"` where the open overlay sits over or beside controls that would\n * be costly to trigger by accident — the dismissal then swallows the\n * activation too, so the gesture only closes.\n */\nexport type DismissBehavior = \"pass-through\" | \"consume\";\n\nexport interface DismissOptions {\n /** Default `\"pass-through\"`. */\n behavior?: DismissBehavior;\n /** Dismiss on Escape as well. Default true. */\n escape?: boolean;\n /** Return true for an outside target that should *not* dismiss. Must be stable. */\n ignore?: (target: Element) => boolean;\n}\n\n/**\n * What every currently open dismiss scope counts as inside itself. A consumed\n * dismissal reads this to tell a stray gesture from one that belongs to an\n * overlay in front of it: overlays have no shared z-order to consult, but the\n * one the gesture landed in has said as much by registering it.\n */\nconst openScopes = new Set<(target: Element) => boolean>();\n\nfunction claimedByAnotherScope(self: (target: Element) => boolean, target: Element) {\n for (const scope of openScopes) {\n if (scope !== self && scope(target)) return true;\n }\n return false;\n}\n\n// preventDefault on pointerdown does not suppress the click that follows, so\n// consuming a gesture means swallowing that click itself. The swallower\n// deliberately outlives the effect that installed it — the dismissal it\n// belongs to has already unmounted or re-rendered by the time the click lands.\n// It releases on that click, or on the next gesture if the pointer is dragged\n// away and no click ever arrives, so it can never eat a later one. A keydown\n// releases it too: a gesture that ends with neither a click nor a cancel would\n// otherwise leave it armed, and the click Enter synthesizes on some focused\n// control is not the one this dismissal was owed.\nfunction consumeActivation(source: Event) {\n const swallow = (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n release();\n };\n const restart = (event: Event) => {\n if (event !== source) release();\n };\n const release = () => {\n window.removeEventListener(\"click\", swallow, true);\n window.removeEventListener(\"pointerdown\", restart, true);\n window.removeEventListener(\"pointercancel\", restart, true);\n window.removeEventListener(\"keydown\", release, true);\n };\n window.addEventListener(\"click\", swallow, true);\n window.addEventListener(\"pointerdown\", restart, true);\n window.addEventListener(\"pointercancel\", restart, true);\n window.addEventListener(\"keydown\", release, true);\n}\n\n/**\n * Close an open overlay on Escape or a pointerdown outside `ref`. Pass `null`\n * for `ref` when what counts as inside isn't one element, and say so with\n * `ignore` instead.\n *\n * The pointerdown listener is capture-phase: a bubble-phase one is blinded by\n * any handler in between that stops propagation, and an overlay cannot know\n * what it is layered over. `onDismiss` and `ignore` must be stable (wrap in\n * useCallback) so the listeners aren't re-bound every render while open.\n */\nexport function useDismiss(\n open: boolean,\n onDismiss: () => void,\n ref: RefObject<HTMLElement | SVGElement | null> | null,\n { behavior = \"pass-through\", escape: dismissOnEscape = true, ignore }: DismissOptions = {},\n) {\n useEffect(() => {\n if (!open) return;\n const inside = (target: Element) =>\n Boolean(ref?.current?.contains(target)) || Boolean(ignore?.(target));\n const onKey = (event: KeyboardEvent) => {\n if (dismissOnEscape && event.key === \"Escape\") onDismiss();\n };\n const onPointer = (event: PointerEvent) => {\n const target = event.target as Element | null;\n if (!target || inside(target)) return;\n // Outside this overlay, but inside one that is also open: the gesture is\n // that overlay's to answer, and swallowing its click from behind would\n // cost the user the control they actually aimed at.\n if (behavior === \"consume\" && !claimedByAnotherScope(inside, target)) {\n consumeActivation(event);\n }\n onDismiss();\n };\n openScopes.add(inside);\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer, true);\n return () => {\n openScopes.delete(inside);\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer, true);\n };\n }, [open, onDismiss, ref, behavior, dismissOnEscape, ignore]);\n}\n"],"mappings":";;;;;;;;;AA8BA,MAAM,6BAAa,IAAI,IAAkC;AAEzD,SAAS,sBAAsB,MAAoC,QAAiB;CAClF,KAAK,MAAM,SAAS,YAClB,IAAI,UAAU,QAAQ,MAAM,MAAM,GAAG,OAAO;CAE9C,OAAO;AACT;AAWA,SAAS,kBAAkB,QAAe;CACxC,MAAM,WAAW,UAAsB;EACrC,MAAM,eAAe;EACrB,MAAM,gBAAgB;EACtB,QAAQ;CACV;CACA,MAAM,WAAW,UAAiB;EAChC,IAAI,UAAU,QAAQ,QAAQ;CAChC;CACA,MAAM,gBAAgB;EACpB,OAAO,oBAAoB,SAAS,SAAS,IAAI;EACjD,OAAO,oBAAoB,eAAe,SAAS,IAAI;EACvD,OAAO,oBAAoB,iBAAiB,SAAS,IAAI;EACzD,OAAO,oBAAoB,WAAW,SAAS,IAAI;CACrD;CACA,OAAO,iBAAiB,SAAS,SAAS,IAAI;CAC9C,OAAO,iBAAiB,eAAe,SAAS,IAAI;CACpD,OAAO,iBAAiB,iBAAiB,SAAS,IAAI;CACtD,OAAO,iBAAiB,WAAW,SAAS,IAAI;AAClD;;;;;;;;;;;AAYA,SAAgB,WACd,MACA,WACA,KACA,EAAE,WAAW,gBAAgB,QAAQ,kBAAkB,MAAM,WAA2B,CAAC,GACzF;CACA,gBAAgB;EACd,IAAI,CAAC,MAAM;EACX,MAAM,UAAU,WACd,QAAQ,KAAK,SAAS,SAAS,MAAM,CAAC,KAAK,QAAQ,SAAS,MAAM,CAAC;EACrE,MAAM,SAAS,UAAyB;GACtC,IAAI,mBAAmB,MAAM,QAAQ,UAAU,UAAU;EAC3D;EACA,MAAM,aAAa,UAAwB;GACzC,MAAM,SAAS,MAAM;GACrB,IAAI,CAAC,UAAU,OAAO,MAAM,GAAG;GAI/B,IAAI,aAAa,aAAa,CAAC,sBAAsB,QAAQ,MAAM,GACjE,kBAAkB,KAAK;GAEzB,UAAU;EACZ;EACA,WAAW,IAAI,MAAM;EACrB,OAAO,iBAAiB,WAAW,KAAK;EACxC,OAAO,iBAAiB,eAAe,WAAW,IAAI;EACtD,aAAa;GACX,WAAW,OAAO,MAAM;GACxB,OAAO,oBAAoB,WAAW,KAAK;GAC3C,OAAO,oBAAoB,eAAe,WAAW,IAAI;EAC3D;CACF,GAAG;EAAC;EAAM;EAAW;EAAK;EAAU;EAAiB;CAAM,CAAC;AAC9D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/lib/command-search.d.ts
|
|
2
|
+
export type SearchableCommand = {
|
|
3
|
+
label: string;
|
|
4
|
+
group?: string;
|
|
5
|
+
keywords?: string[];
|
|
6
|
+
};
|
|
7
|
+
/** Match every query word across fields and put direct name matches first. */
|
|
8
|
+
export declare function searchCommands<T extends SearchableCommand>(items: T[], query: string): T[];
|
|
9
|
+
//#endregion
|
|
10
|
+
//# sourceMappingURL=command-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-search.d.ts","names":[],"sources":["../../src/lib/command-search.ts"],"mappings":";YAAY;EACV;EACA;EACA;;;wBAiCc,eAAe,UAAU,mBAAmB,OAAO,KAAK,gBAAgB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/lib/command-search.ts
|
|
2
|
+
function normalize(value) {
|
|
3
|
+
return value.replace(/([a-z])([A-Z])/g, "$1 $2").normalize("NFKD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
4
|
+
}
|
|
5
|
+
function tokenScore(token, field) {
|
|
6
|
+
const words = field.split(" ");
|
|
7
|
+
if (words.includes(token)) return 100;
|
|
8
|
+
if (words.some((word) => word.startsWith(token))) return 80;
|
|
9
|
+
if (field.includes(token)) return 60;
|
|
10
|
+
if (token.length < 3) return 0;
|
|
11
|
+
for (const word of words) {
|
|
12
|
+
if (word.length - token.length > 2) continue;
|
|
13
|
+
let matched = 0;
|
|
14
|
+
for (const char of word) if (char === token[matched]) matched++;
|
|
15
|
+
if (matched === token.length) return 20;
|
|
16
|
+
}
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
/** Match every query word across fields and put direct name matches first. */
|
|
20
|
+
function searchCommands(items, query) {
|
|
21
|
+
const normalized = normalize(query);
|
|
22
|
+
if (!normalized) return items;
|
|
23
|
+
const tokens = normalized.split(/\s+/);
|
|
24
|
+
return items.map((item) => {
|
|
25
|
+
const label = normalize(item.label);
|
|
26
|
+
const fields = [
|
|
27
|
+
label,
|
|
28
|
+
normalize(item.group ?? ""),
|
|
29
|
+
...(item.keywords ?? []).map(normalize)
|
|
30
|
+
];
|
|
31
|
+
let score = label === normalized ? 1e4 : label.startsWith(normalized) ? 2e3 : 0;
|
|
32
|
+
for (const token of tokens) {
|
|
33
|
+
const best = Math.max(...fields.map((field, index) => {
|
|
34
|
+
const match = tokenScore(token, field);
|
|
35
|
+
return match ? match + (index === 0 ? 40 : 0) : 0;
|
|
36
|
+
}));
|
|
37
|
+
if (!best) return {
|
|
38
|
+
item,
|
|
39
|
+
score: 0
|
|
40
|
+
};
|
|
41
|
+
score += best;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
item,
|
|
45
|
+
score
|
|
46
|
+
};
|
|
47
|
+
}).filter(({ score }) => score > 0).sort((a, b) => b.score - a.score).map(({ item }) => item);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { searchCommands };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=command-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-search.js","names":[],"sources":["../../src/lib/command-search.ts"],"sourcesContent":["export type SearchableCommand = {\n label: string;\n group?: string;\n keywords?: string[];\n};\n\nfunction normalize(value: string) {\n return value\n .replace(/([a-z])([A-Z])/g, \"$1 $2\")\n .normalize(\"NFKD\")\n .replace(/\\p{M}/gu, \"\")\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}]+/gu, \" \")\n .trim();\n}\n\nfunction tokenScore(token: string, field: string) {\n const words = field.split(\" \");\n if (words.includes(token)) return 100;\n if (words.some((word) => word.startsWith(token))) return 80;\n if (field.includes(token)) return 60;\n // Keep short queries precise; fuzzy abbreviations may skip at most two\n // letters within a word, rather than matching across a whole description.\n if (token.length < 3) return 0;\n for (const word of words) {\n if (word.length - token.length > 2) continue;\n let matched = 0;\n for (const char of word) {\n if (char === token[matched]) matched++;\n }\n if (matched === token.length) return 20;\n }\n return 0;\n}\n\n/** Match every query word across fields and put direct name matches first. */\nexport function searchCommands<T extends SearchableCommand>(items: T[], query: string): T[] {\n const normalized = normalize(query);\n if (!normalized) return items;\n const tokens = normalized.split(/\\s+/);\n return items\n .map((item) => {\n const label = normalize(item.label);\n const fields = [label, normalize(item.group ?? \"\"), ...(item.keywords ?? []).map(normalize)];\n let score = label === normalized ? 10000 : label.startsWith(normalized) ? 2000 : 0;\n for (const token of tokens) {\n const best = Math.max(\n ...fields.map((field, index) => {\n const match = tokenScore(token, field);\n return match ? match + (index === 0 ? 40 : 0) : 0;\n }),\n );\n if (!best) return { item, score: 0 };\n score += best;\n }\n return { item, score };\n })\n .filter(({ score }) => score > 0)\n .sort((a,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,SAAS,UAAU,IAAI,KAAK,KAAK;GAClD,CAAC,CACH;GACA,IAAI,CAAC,MAAM,OAAO;IAAE;IAAM,OAAO;GAAE;GACnC,SAAS;EACX;EACA,OAAO;GAAE;GAAM;EAAM;CACvB,CAAC,CAAC,CACD,QAAQ,EAAE,YAAY,QAAQ,CAAC,CAAC,CAChC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CACjC,KAAK,EAAE,WAAW,IAAI;AAC3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumix/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
4
4
|
"description": "Kumix React UI kit: shadcn/ui (Base UI, base-nova) + ReUI components, Tailwind tokens, and hooks. Per-file ESM exports.",
|
|
5
5
|
"author": "Kumix Labs <hai@kumix.io>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@paper-design/shaders-react": "^0.0.80",
|
|
79
79
|
"@shadcn/react": "^0.3.1",
|
|
80
80
|
"@tanstack/react-table": "^9.2.4",
|
|
81
|
-
"@tanstack/react-virtual": "^3.14.
|
|
81
|
+
"@tanstack/react-virtual": "^3.14.13",
|
|
82
82
|
"@types/react": "^19.3.0",
|
|
83
83
|
"class-variance-authority": "^0.7.1",
|
|
84
84
|
"clsx": "^2.1.1",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"embla-carousel-react": "^8.6.0",
|
|
88
88
|
"input-otp": "^1.5.0",
|
|
89
89
|
"lenis": "^1.3.26",
|
|
90
|
-
"lucide-react": "^1.
|
|
91
|
-
"motion": "^13.
|
|
90
|
+
"lucide-react": "^1.46.0",
|
|
91
|
+
"motion": "^13.3.0",
|
|
92
92
|
"next-themes": "^0.4.6",
|
|
93
93
|
"react": "^19.3.0",
|
|
94
94
|
"react-day-picker": "^10.0.1",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"react-resizable-panels": "^4.12.4",
|
|
97
97
|
"recharts": "3.10.1",
|
|
98
98
|
"shiki": "^4.4.3",
|
|
99
|
-
"tailwind-merge": "^3.
|
|
99
|
+
"tailwind-merge": "^3.7.0",
|
|
100
100
|
"tsdown": "^0.23.0",
|
|
101
101
|
"typescript": "6.0.3"
|
|
102
102
|
},
|