@camox/ui 0.78.0 → 0.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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/badge.d.ts
|
|
4
4
|
declare const badgeVariants: (props?: ({
|
|
5
|
-
variant?: "default" | "
|
|
5
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
|
|
6
6
|
size?: "default" | "sm" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function Badge({ className, variant, size, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -4,7 +4,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
4
4
|
//#region src/components/bubble.d.ts
|
|
5
5
|
declare function BubbleGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
6
6
|
declare const bubbleVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "muted" | "tinted" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
declare function Bubble({ variant, align, className, ...props }: React.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
|
|
10
10
|
align?: "start" | "end";
|
|
@@ -2,7 +2,7 @@ import { Button as Button$1 } from "@base-ui/react/button";
|
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
//#region src/components/button.d.ts
|
|
4
4
|
declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "default" | "
|
|
5
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
|
|
6
6
|
size?: "default" | "sm" | "xs" | "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;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Slider as Slider$1 } from "@base-ui/react/slider";
|
|
2
|
+
//#region src/components/slider.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A single-thumb slider. `label` names it to assistive technology, and `valueText` reads its value
|
|
5
|
+
* as words, such as a step's name. `marks` draws a tick at each of that many evenly spaced
|
|
6
|
+
* values, for a slider with a few named steps.
|
|
7
|
+
*/
|
|
8
|
+
declare function Slider({ className, label, valueText, marks, ...props }: Slider$1.Root.Props<number> & {
|
|
9
|
+
label: string;
|
|
10
|
+
valueText?: string;
|
|
11
|
+
marks?: number;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Slider };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Slider as Slider$1 } from "@base-ui/react/slider";
|
|
4
|
+
|
|
5
|
+
//#region src/components/slider.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A single-thumb slider. `label` names it to assistive technology, and `valueText` reads its value
|
|
8
|
+
* as words, such as a step's name. `marks` draws a tick at each of that many evenly spaced
|
|
9
|
+
* values, for a slider with a few named steps.
|
|
10
|
+
*/
|
|
11
|
+
function Slider({ className, label, valueText, marks, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Slider$1.Root, {
|
|
13
|
+
"data-slot": "slider",
|
|
14
|
+
thumbAlignment: "edge",
|
|
15
|
+
className: cn("data-disabled:opacity-50", className),
|
|
16
|
+
...props,
|
|
17
|
+
children: /* @__PURE__ */ jsxs(Slider$1.Control, {
|
|
18
|
+
"data-slot": "slider-control",
|
|
19
|
+
className: "relative flex h-5 w-full touch-none items-center select-none data-disabled:cursor-not-allowed",
|
|
20
|
+
children: [/* @__PURE__ */ jsx(Slider$1.Track, {
|
|
21
|
+
"data-slot": "slider-track",
|
|
22
|
+
className: "bg-muted relative h-1.5 w-full grow rounded-full",
|
|
23
|
+
children: marks !== void 0 && marks > 1 && /* @__PURE__ */ jsx("div", {
|
|
24
|
+
className: "pointer-events-none absolute inset-x-2 inset-y-0",
|
|
25
|
+
children: Array.from({ length: marks }, (_, index) => /* @__PURE__ */ jsx("span", {
|
|
26
|
+
"aria-hidden": true,
|
|
27
|
+
className: "bg-muted-foreground/40 absolute top-1/2 size-1 -translate-x-1/2 -translate-y-1/2 rounded-full",
|
|
28
|
+
style: { left: `${index / (marks - 1) * 100}%` }
|
|
29
|
+
}, index))
|
|
30
|
+
})
|
|
31
|
+
}), /* @__PURE__ */ jsx(Slider$1.Thumb, {
|
|
32
|
+
"data-slot": "slider-thumb",
|
|
33
|
+
getAriaLabel: () => label,
|
|
34
|
+
"aria-valuetext": valueText,
|
|
35
|
+
className: "border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border-2 shadow-sm transition-[box-shadow] outline-none hover:ring-4 has-focus-visible:ring-4 data-disabled:pointer-events-none"
|
|
36
|
+
})]
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { Slider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camox/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -119,6 +119,10 @@
|
|
|
119
119
|
"types": "./dist/components/spinner.d.ts",
|
|
120
120
|
"default": "./dist/components/spinner.js"
|
|
121
121
|
},
|
|
122
|
+
"./slider": {
|
|
123
|
+
"types": "./dist/components/slider.d.ts",
|
|
124
|
+
"default": "./dist/components/slider.js"
|
|
125
|
+
},
|
|
122
126
|
"./switch": {
|
|
123
127
|
"types": "./dist/components/switch.d.ts",
|
|
124
128
|
"default": "./dist/components/switch.js"
|