@lglab/compose-ui 0.10.0 → 0.11.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.
- package/dist/components/toggle-group.d.ts +5 -3
- package/dist/components/toggle-group.d.ts.map +1 -1
- package/dist/components/toggle.d.ts +4 -2
- package/dist/components/toggle.d.ts.map +1 -1
- package/dist/index.es.js +65 -31
- package/dist/lib/toggle-variants.d.ts +4 -2
- package/dist/lib/toggle-variants.d.ts.map +1 -1
- package/dist/styles/default.css +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { Toggle } from '@base-ui/react/toggle';
|
|
2
2
|
import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group';
|
|
3
|
-
import { ToggleSize } from '../lib/toggle-variants';
|
|
3
|
+
import { ToggleSize, ToggleVariant } from '../lib/toggle-variants';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
type ToggleGroupRootProps = React.ComponentProps<typeof BaseToggleGroup>;
|
|
6
6
|
declare const ToggleGroupRoot: {
|
|
7
|
-
({ className, ...props }: ToggleGroupRootProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
({ className, orientation, ...props }: ToggleGroupRootProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
displayName: string;
|
|
9
9
|
};
|
|
10
10
|
type ToggleGroupItemProps = React.ComponentProps<typeof Toggle> & {
|
|
11
|
+
/** Visual style of the toggle item */
|
|
12
|
+
variant?: ToggleVariant;
|
|
11
13
|
/** Size of the toggle item */
|
|
12
14
|
size?: ToggleSize;
|
|
13
15
|
};
|
|
14
16
|
declare const ToggleGroupItem: {
|
|
15
|
-
({ className, size, ...props }: ToggleGroupItemProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
({ className, variant, size, ...props }: ToggleGroupItemProps): import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
displayName: string;
|
|
17
19
|
};
|
|
18
20
|
export { ToggleGroupRoot, ToggleGroupItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group.d.ts","sourceRoot":"","sources":["../../src/components/toggle-group.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,
|
|
1
|
+
{"version":3,"file":"toggle-group.d.ts","sourceRoot":"","sources":["../../src/components/toggle-group.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC9C,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAA;AAO/B,KAAK,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,CAAA;AAExE,QAAA,MAAM,eAAe;2CAA0C,oBAAoB;;CAkBlF,CAAA;AAQD,KAAK,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IAChE,sCAAsC;IACtC,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED,QAAA,MAAM,eAAe;6CAKlB,oBAAoB;;CAYtB,CAAA;AAQD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAA;AAE3C,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
2
|
-
import { ToggleSize } from '../lib/toggle-variants';
|
|
2
|
+
import { ToggleSize, ToggleVariant } from '../lib/toggle-variants';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
type ToggleProps = React.ComponentProps<typeof BaseToggle> & {
|
|
5
|
+
/** Visual style of the toggle */
|
|
6
|
+
variant?: ToggleVariant;
|
|
5
7
|
/** Size of the toggle */
|
|
6
8
|
size?: ToggleSize;
|
|
7
9
|
};
|
|
8
10
|
declare const Toggle: {
|
|
9
|
-
({ className, size, ...props }: ToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
({ className, variant, size, ...props }: ToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
displayName: string;
|
|
11
13
|
};
|
|
12
14
|
export { Toggle };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/components/toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/components/toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAA;AAO/B,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,GAAG;IAC3D,iCAAiC;IACjC,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,yBAAyB;IACzB,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED,QAAA,MAAM,MAAM;6CAA4C,WAAW;;CAIlE,CAAA;AAQD,OAAO,EAAE,MAAM,EAAE,CAAA;AAEjB,YAAY,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/index.es.js
CHANGED
|
@@ -7,7 +7,7 @@ import { twMerge as _ } from "tailwind-merge";
|
|
|
7
7
|
import { AlertDialog as d } from "@base-ui/react/alert-dialog";
|
|
8
8
|
import { AlertDialog as ya } from "@base-ui/react/alert-dialog";
|
|
9
9
|
import { Avatar as w } from "@base-ui/react/avatar";
|
|
10
|
-
import * as
|
|
10
|
+
import * as N from "react";
|
|
11
11
|
import { ScrollArea as m } from "@base-ui/react/scroll-area";
|
|
12
12
|
import { Switch as A } from "@base-ui/react/switch";
|
|
13
13
|
import { Toggle as T } from "@base-ui/react/toggle";
|
|
@@ -15,7 +15,7 @@ import { Tabs as f } from "@base-ui/react/tabs";
|
|
|
15
15
|
import { Dialog as l } from "@base-ui/react/dialog";
|
|
16
16
|
import { Accordion as b } from "@base-ui/react/accordion";
|
|
17
17
|
import { Meter as y } from "@base-ui/react/meter";
|
|
18
|
-
import { Progress as
|
|
18
|
+
import { Progress as h } from "@base-ui/react/progress";
|
|
19
19
|
import { ToggleGroup as I } from "@base-ui/react/toggle-group";
|
|
20
20
|
const u = n(
|
|
21
21
|
[
|
|
@@ -204,9 +204,9 @@ const Q = ({
|
|
|
204
204
|
className: o,
|
|
205
205
|
children: s
|
|
206
206
|
}) => {
|
|
207
|
-
const i =
|
|
207
|
+
const i = N.Children.toArray(s), c = i.length, g = a !== void 0 ? Math.min(a, c) : c, x = c - g, v = i.slice(0, g), V = (() => {
|
|
208
208
|
const p = i[0];
|
|
209
|
-
return
|
|
209
|
+
return N.isValidElement(p) && p.type === P ? p.props.size ?? "default" : "default";
|
|
210
210
|
})();
|
|
211
211
|
return /* @__PURE__ */ k("ul", { "aria-label": e, className: r("flex -space-x-2", o), children: [
|
|
212
212
|
v.map((p, D) => /* @__PURE__ */ t("li", { children: p }, D)),
|
|
@@ -248,7 +248,7 @@ const Y = ({
|
|
|
248
248
|
m.Scrollbar,
|
|
249
249
|
{
|
|
250
250
|
className: r(
|
|
251
|
-
"flex touch-none select-none p-0.5 transition-colors duration-
|
|
251
|
+
"flex touch-none select-none p-0.5 transition-colors duration-200 ease-out",
|
|
252
252
|
"data-hovering:bg-muted/50",
|
|
253
253
|
a === "vertical" && "h-full w-2.5",
|
|
254
254
|
a === "horizontal" && "h-2.5 w-full flex-col",
|
|
@@ -298,7 +298,7 @@ const te = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
|
298
298
|
className: r(
|
|
299
299
|
"aspect-square h-full rounded-full bg-background",
|
|
300
300
|
"shadow-[0_0_1px_1px,0_1px_1px,1px_2px_4px_-1px] shadow-muted-foreground/20",
|
|
301
|
-
"transition-all duration-
|
|
301
|
+
"transition-all duration-200",
|
|
302
302
|
"data-checked:translate-x-4",
|
|
303
303
|
"dark:shadow-black/25 dark:bg-foreground dark:data-checked:bg-background",
|
|
304
304
|
"data-disabled:opacity-100",
|
|
@@ -310,25 +310,36 @@ const te = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
|
310
310
|
te.displayName = "SwitchThumb";
|
|
311
311
|
const R = n(
|
|
312
312
|
[
|
|
313
|
-
"inline-flex items-center justify-center gap-2 rounded-md
|
|
313
|
+
"inline-flex items-center justify-center gap-2 rounded-md",
|
|
314
|
+
"text-sm font-medium",
|
|
314
315
|
"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
|
|
315
|
-
"
|
|
316
|
-
"transition-all duration-150",
|
|
317
|
-
"data-pressed:border-primary data-pressed:bg-primary data-pressed:text-primary-foreground data-pressed:shadow-sm"
|
|
316
|
+
"select-none transition-colors duration-200"
|
|
318
317
|
],
|
|
319
318
|
{
|
|
320
319
|
variants: {
|
|
320
|
+
variant: {
|
|
321
|
+
default: [
|
|
322
|
+
"border border-border bg-background shadow-xs",
|
|
323
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
324
|
+
"data-pressed:border-primary data-pressed:bg-primary data-pressed:text-primary-foreground data-pressed:shadow-none"
|
|
325
|
+
],
|
|
326
|
+
ghost: ["hover:bg-accent"]
|
|
327
|
+
},
|
|
321
328
|
size: {
|
|
322
|
-
sm: "h-8 min-w-8 px-2 gap-1.5",
|
|
323
|
-
default: "h-9 min-w-9 px-
|
|
324
|
-
lg: "h-10 min-w-10 px-3"
|
|
329
|
+
sm: "h-8 min-w-8 px-2.5 gap-1.5",
|
|
330
|
+
default: "h-9 min-w-9 px-3",
|
|
331
|
+
lg: "h-10 min-w-10 px-3.5",
|
|
332
|
+
icon: "size-9",
|
|
333
|
+
"icon-sm": "size-8",
|
|
334
|
+
"icon-lg": "size-10"
|
|
325
335
|
}
|
|
326
336
|
},
|
|
327
337
|
defaultVariants: {
|
|
338
|
+
variant: "default",
|
|
328
339
|
size: "default"
|
|
329
340
|
}
|
|
330
341
|
}
|
|
331
|
-
), re = ({ className: e,
|
|
342
|
+
), re = ({ className: e, variant: a, size: o, ...s }) => /* @__PURE__ */ t(T, { className: r(R({ variant: a, size: o }), e), ...s });
|
|
332
343
|
re.displayName = "Toggle";
|
|
333
344
|
const oe = ({ className: e, ...a }) => /* @__PURE__ */ t(f.Root, { className: r("flex flex-col", e), ...a });
|
|
334
345
|
oe.displayName = "TabsRoot";
|
|
@@ -460,24 +471,24 @@ const be = n(
|
|
|
460
471
|
}
|
|
461
472
|
);
|
|
462
473
|
ye.displayName = "DialogPopup";
|
|
463
|
-
const
|
|
474
|
+
const he = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
464
475
|
l.Title,
|
|
465
476
|
{
|
|
466
477
|
className: r("text-lg font-semibold leading-none tracking-tight", e),
|
|
467
478
|
...a
|
|
468
479
|
}
|
|
469
480
|
);
|
|
470
|
-
|
|
481
|
+
he.displayName = "DialogTitle";
|
|
471
482
|
const xe = ({ className: e, ...a }) => /* @__PURE__ */ t(l.Description, { className: r("mt-2", e), ...a });
|
|
472
483
|
xe.displayName = "DialogDescription";
|
|
473
|
-
const
|
|
484
|
+
const Ne = ({ className: e, variant: a, size: o, ...s }) => /* @__PURE__ */ t(
|
|
474
485
|
l.Close,
|
|
475
486
|
{
|
|
476
487
|
className: r(u({ variant: a ?? "outline", size: o }), e),
|
|
477
488
|
...s
|
|
478
489
|
}
|
|
479
490
|
);
|
|
480
|
-
|
|
491
|
+
Ne.displayName = "DialogClose";
|
|
481
492
|
const ve = ({ className: e, ...a }) => /* @__PURE__ */ t("div", { className: r("flex flex-col space-y-1 mb-5", e), ...a });
|
|
482
493
|
ve.displayName = "DialogHeader";
|
|
483
494
|
const we = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
@@ -620,8 +631,8 @@ const Le = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
|
620
631
|
);
|
|
621
632
|
Le.displayName = "AccordionPanel";
|
|
622
633
|
const He = ({ className: e, animated: a, value: o, ...s }) => {
|
|
623
|
-
const i = o ?? 0, [c, g] =
|
|
624
|
-
return
|
|
634
|
+
const i = o ?? 0, [c, g] = N.useState(a ? 0 : i);
|
|
635
|
+
return N.useEffect(() => {
|
|
625
636
|
if (a) {
|
|
626
637
|
const x = requestAnimationFrame(() => {
|
|
627
638
|
const v = requestAnimationFrame(() => {
|
|
@@ -673,10 +684,10 @@ const $e = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
|
673
684
|
}
|
|
674
685
|
);
|
|
675
686
|
$e.displayName = "MeterLabel";
|
|
676
|
-
const Je = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
687
|
+
const Je = ({ className: e, ...a }) => /* @__PURE__ */ t(h.Root, { className: r("w-full", e), ...a });
|
|
677
688
|
Je.displayName = "ProgressRoot";
|
|
678
689
|
const Ke = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
679
|
-
|
|
690
|
+
h.Track,
|
|
680
691
|
{
|
|
681
692
|
className: r(
|
|
682
693
|
"relative h-2 w-full overflow-hidden rounded-full bg-primary/20",
|
|
@@ -687,7 +698,7 @@ const Ke = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
|
687
698
|
);
|
|
688
699
|
Ke.displayName = "ProgressTrack";
|
|
689
700
|
const Oe = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
690
|
-
|
|
701
|
+
h.Indicator,
|
|
691
702
|
{
|
|
692
703
|
className: r(
|
|
693
704
|
"h-full rounded-full bg-primary transition-all duration-1000 ease-out-expo",
|
|
@@ -698,7 +709,7 @@ const Oe = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
|
698
709
|
);
|
|
699
710
|
Oe.displayName = "ProgressIndicator";
|
|
700
711
|
const Qe = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
701
|
-
|
|
712
|
+
h.Value,
|
|
702
713
|
{
|
|
703
714
|
className: r("text-sm font-medium text-foreground", e),
|
|
704
715
|
...a
|
|
@@ -706,25 +717,48 @@ const Qe = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
|
706
717
|
);
|
|
707
718
|
Qe.displayName = "ProgressValue";
|
|
708
719
|
const Ue = ({ className: e, ...a }) => /* @__PURE__ */ t(
|
|
709
|
-
|
|
720
|
+
h.Label,
|
|
710
721
|
{
|
|
711
722
|
className: r("text-sm font-medium text-foreground", e),
|
|
712
723
|
...a
|
|
713
724
|
}
|
|
714
725
|
);
|
|
715
726
|
Ue.displayName = "ProgressLabel";
|
|
716
|
-
const We = ({ className: e,
|
|
727
|
+
const We = ({ className: e, orientation: a, ...o }) => /* @__PURE__ */ t(
|
|
717
728
|
I,
|
|
718
729
|
{
|
|
730
|
+
orientation: a,
|
|
719
731
|
className: r(
|
|
720
|
-
"inline-flex
|
|
732
|
+
"inline-flex",
|
|
733
|
+
a === "vertical" && "flex-col",
|
|
734
|
+
// Connected items: collapse borders, round only outer corners
|
|
735
|
+
"*:rounded-none [&>*:not(:first-child)]:-ml-px",
|
|
736
|
+
"[&>*:first-child]:rounded-l-md [&>*:last-child]:rounded-r-md",
|
|
737
|
+
// Vertical orientation adjustments
|
|
738
|
+
a === "vertical" && "[&>*:not(:first-child)]:ml-0 [&>*:not(:first-child)]:-mt-px [&>*:first-child]:rounded-bl-none [&>*:last-child]:rounded-r-none [&>*:first-child]:rounded-t-md [&>*:last-child]:rounded-b-md",
|
|
721
739
|
e
|
|
722
740
|
),
|
|
723
|
-
...
|
|
741
|
+
...o
|
|
724
742
|
}
|
|
725
743
|
);
|
|
726
744
|
We.displayName = "ToggleGroupRoot";
|
|
727
|
-
const Xe = ({
|
|
745
|
+
const Xe = ({
|
|
746
|
+
className: e,
|
|
747
|
+
variant: a,
|
|
748
|
+
size: o,
|
|
749
|
+
...s
|
|
750
|
+
}) => /* @__PURE__ */ t(
|
|
751
|
+
T,
|
|
752
|
+
{
|
|
753
|
+
className: r(
|
|
754
|
+
R({ variant: a, size: o }),
|
|
755
|
+
// Ghost variant in toggle-group: add borders, no background when pressed
|
|
756
|
+
a === "ghost" && "border border-border",
|
|
757
|
+
e
|
|
758
|
+
),
|
|
759
|
+
...s
|
|
760
|
+
}
|
|
761
|
+
);
|
|
728
762
|
Xe.displayName = "ToggleGroupItem";
|
|
729
763
|
export {
|
|
730
764
|
Me as AccordionHeader,
|
|
@@ -748,14 +782,14 @@ export {
|
|
|
748
782
|
Q as AvatarStack,
|
|
749
783
|
F as Button,
|
|
750
784
|
fe as DialogBackdrop,
|
|
751
|
-
|
|
785
|
+
Ne as DialogClose,
|
|
752
786
|
xe as DialogDescription,
|
|
753
787
|
we as DialogFooter,
|
|
754
788
|
ve as DialogHeader,
|
|
755
789
|
ye as DialogPopup,
|
|
756
790
|
pe as DialogPortal,
|
|
757
791
|
me as DialogRoot,
|
|
758
|
-
|
|
792
|
+
he as DialogTitle,
|
|
759
793
|
ge as DialogTrigger,
|
|
760
794
|
Te as DrawerBackdrop,
|
|
761
795
|
Se as DrawerClose,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export type ToggleSize = 'sm' | 'default' | 'lg';
|
|
1
|
+
export type ToggleSize = 'sm' | 'default' | 'lg' | 'icon' | 'icon-sm' | 'icon-lg';
|
|
2
|
+
export type ToggleVariant = 'default' | 'ghost';
|
|
2
3
|
export declare const toggleVariants: (props?: ({
|
|
3
|
-
|
|
4
|
+
variant?: "default" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
|
|
4
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
5
7
|
//# sourceMappingURL=toggle-variants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-variants.d.ts","sourceRoot":"","sources":["../../src/lib/toggle-variants.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"toggle-variants.d.ts","sourceRoot":"","sources":["../../src/lib/toggle-variants.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;AACjF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,CAAA;AAE/C,eAAO,MAAM,cAAc;;;8EA+B1B,CAAA"}
|
package/dist/styles/default.css
CHANGED
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
|
|
79
79
|
@layer base {
|
|
80
80
|
* {
|
|
81
|
-
@apply focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-
|
|
81
|
+
@apply focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:z-1 data-disabled:pointer-events-none data-disabled:opacity-70;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|