@plexui/ui 0.12.0 → 0.13.1

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.
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import clsx from "clsx";
4
+ import {} from "react";
5
+ import { Separator } from "../Separator";
6
+ import s from "./ButtonGroup.module.css";
7
+ const ButtonGroupRoot = ({ orientation = "horizontal", className, ref, ...restProps }) => (_jsx("div", { ref: ref, role: "group", "data-slot": "button-group", "data-orientation": orientation, className: clsx(s.Root, className), ...restProps }));
8
+ const ButtonGroupSeparator = ({ className, orientation, ...restProps }) => (_jsx(Separator, { "data-slot": "button-group-separator", orientation: orientation ?? "vertical", className: clsx(s.Separator, className), ...restProps }));
9
+ export const ButtonGroup = ButtonGroupRoot;
10
+ ButtonGroup.Separator = ButtonGroupSeparator;
11
+ //# sourceMappingURL=ButtonGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonGroup.js","sourceRoot":"","sources":["../../../../src/components/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAsD,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAkBxC,MAAM,eAAe,GAAG,CAAC,EACvB,WAAW,GAAG,YAAY,EAC1B,SAAS,EACT,GAAG,EACH,GAAG,SAAS,EACK,EAAE,EAAE,CAAC,CACtB,cACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,OAAO,eACF,cAAc,sBACN,WAAW,EAC7B,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,KAC9B,SAAS,GACb,CACH,CAAA;AAiBD,MAAM,oBAAoB,GAAG,CAAC,EAC5B,SAAS,EACT,WAAW,EACX,GAAG,SAAS,EACc,EAAE,EAAE,CAAC,CAC/B,KAAC,SAAS,iBACE,wBAAwB,EAClC,WAAW,EAAE,WAAW,IAAI,UAAU,EACtC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,KACnC,SAAS,GACb,CACH,CAAA;AAUD,MAAM,CAAC,MAAM,WAAW,GAAG,eAAuC,CAAA;AAClE,WAAW,CAAC,SAAS,GAAG,oBAAoB,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { type ComponentProps, type HTMLAttributes, type Ref } from \"react\"\nimport { Separator } from \"../Separator\"\nimport s from \"./ButtonGroup.module.css\"\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\"\n\nexport type ButtonGroupProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * Direction of the joined buttons.\n * @default \"horizontal\"\n */\n orientation?: ButtonGroupOrientation\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nconst ButtonGroupRoot = ({\n orientation = \"horizontal\",\n className,\n ref,\n ...restProps\n}: ButtonGroupProps) => (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={clsx(s.Root, className)}\n {...restProps}\n />\n)\n\n/* ------------------------------------------------------------------ */\n/* Separator — thin divider between items */\n/* ------------------------------------------------------------------ */\n\nexport type ButtonGroupSeparatorProps = Omit<\n ComponentProps<typeof Separator>,\n \"orientation\"\n> & {\n /**\n * When omitted, flips to match the surrounding ButtonGroup axis.\n * Pass explicitly to override (rare).\n */\n orientation?: ButtonGroupOrientation\n}\n\nconst ButtonGroupSeparator = ({\n className,\n orientation,\n ...restProps\n}: ButtonGroupSeparatorProps) => (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation ?? \"vertical\"}\n className={clsx(s.Separator, className)}\n {...restProps}\n />\n)\n\n/* ------------------------------------------------------------------ */\n/* Export — compound API */\n/* ------------------------------------------------------------------ */\n\ntype ButtonGroupComponent = typeof ButtonGroupRoot & {\n Separator: typeof ButtonGroupSeparator\n}\n\nexport const ButtonGroup = ButtonGroupRoot as ButtonGroupComponent\nButtonGroup.Separator = ButtonGroupSeparator\n"]}
@@ -0,0 +1,73 @@
1
+ @layer components {.Root {
2
+ display: inline-flex;
3
+ align-items: stretch;
4
+ width: -moz-fit-content;
5
+ width: fit-content;
6
+
7
+ /* Inputs inside a ButtonGroup share the row and flex to fill space */
8
+ }
9
+
10
+ /* Let focused item sit on top of neighbors so the ring isn't clipped */
11
+ .Root > * {
12
+ position: relative;
13
+ }
14
+ .Root > *:focus-visible,
15
+ .Root > *:focus-within {
16
+ z-index: 1;
17
+ }
18
+
19
+ /* Gap only appears between nested groups — joined buttons stay touching */
20
+ .Root:has(> [data-slot="button-group"]) {
21
+ gap: var(--button-group-nested-gap);
22
+ }
23
+
24
+ /* Horizontal — default. Plex Button variant="outline" renders its 1px
25
+ border via an inset box-shadow on its ::before pseudo — stripping the
26
+ left `border-inline-start` does nothing. Instead we (a) overlap items
27
+ by -1px and (b) clip 1px off the leading edge of the ::before of
28
+ every non-first child, so the inset shadow of item N+1 doesn't sit
29
+ next to the inset shadow of item N (which would read as a doubled
30
+ 2px line). Focus ring lives on ::after, so clip-path on ::before
31
+ leaves the focus ring intact. */
32
+ .Root[data-orientation="horizontal"] > *:not(:first-child) {
33
+ border-start-start-radius: 0;
34
+ border-end-start-radius: 0;
35
+ margin-inline-start: -1px;
36
+ }
37
+ .Root[data-orientation="horizontal"] > *:not(:first-child)::before {
38
+ clip-path: inset(0 0 0 1px);
39
+ }
40
+ .Root[data-orientation="horizontal"] > *:not(:last-child) {
41
+ border-start-end-radius: 0;
42
+ border-end-end-radius: 0;
43
+ }
44
+
45
+ /* Vertical — same approach, clip the top 1px of ::before on non-first */
46
+ .Root[data-orientation="vertical"] {
47
+ flex-direction: column;
48
+ }
49
+ .Root[data-orientation="vertical"] > *:not(:first-child) {
50
+ border-start-start-radius: 0;
51
+ border-start-end-radius: 0;
52
+ margin-block-start: -1px;
53
+ }
54
+ .Root[data-orientation="vertical"] > *:not(:first-child)::before {
55
+ clip-path: inset(1px 0 0 0);
56
+ }
57
+ .Root[data-orientation="vertical"] > *:not(:last-child) {
58
+ border-end-start-radius: 0;
59
+ border-end-end-radius: 0;
60
+ }
61
+ .Root > input,
62
+ .Root > [data-slot="input-wrapper"] {
63
+ flex: 1 1 auto;
64
+ }/* Separator used between items inside a ButtonGroup */.Separator {
65
+ align-self: stretch;
66
+ margin: 0;
67
+ flex-shrink: 0;
68
+ }
69
+
70
+ .Separator[data-orientation="vertical"] {
71
+ height: auto;
72
+ }
73
+ }
@@ -0,0 +1,2 @@
1
+ export { ButtonGroup, } from "./ButtonGroup";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ButtonGroup/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAIZ,MAAM,eAAe,CAAA","sourcesContent":["export {\n ButtonGroup,\n type ButtonGroupProps,\n type ButtonGroupOrientation,\n type ButtonGroupSeparatorProps,\n} from \"./ButtonGroup\"\n"]}
@@ -127,6 +127,11 @@
127
127
  --separator-color: var(--color-border);
128
128
  --separator-thickness: 1px;
129
129
 
130
+ /* =============================================
131
+ ButtonGroup
132
+ ============================================= */
133
+ --button-group-nested-gap: calc(var(--spacing) * 2);
134
+
130
135
  /* =============================================
131
136
  Accordion
132
137
  ============================================= */
@@ -0,0 +1,26 @@
1
+ import { type ComponentProps, type HTMLAttributes, type Ref } from "react";
2
+ import { Separator } from "../Separator";
3
+ export type ButtonGroupOrientation = "horizontal" | "vertical";
4
+ export type ButtonGroupProps = HTMLAttributes<HTMLDivElement> & {
5
+ /**
6
+ * Direction of the joined buttons.
7
+ * @default "horizontal"
8
+ */
9
+ orientation?: ButtonGroupOrientation;
10
+ className?: string;
11
+ ref?: Ref<HTMLDivElement>;
12
+ };
13
+ declare const ButtonGroupRoot: ({ orientation, className, ref, ...restProps }: ButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
14
+ export type ButtonGroupSeparatorProps = Omit<ComponentProps<typeof Separator>, "orientation"> & {
15
+ /**
16
+ * When omitted, flips to match the surrounding ButtonGroup axis.
17
+ * Pass explicitly to override (rare).
18
+ */
19
+ orientation?: ButtonGroupOrientation;
20
+ };
21
+ declare const ButtonGroupSeparator: ({ className, orientation, ...restProps }: ButtonGroupSeparatorProps) => import("react/jsx-runtime").JSX.Element;
22
+ type ButtonGroupComponent = typeof ButtonGroupRoot & {
23
+ Separator: typeof ButtonGroupSeparator;
24
+ };
25
+ export declare const ButtonGroup: ButtonGroupComponent;
26
+ export {};
@@ -0,0 +1 @@
1
+ export { ButtonGroup, type ButtonGroupProps, type ButtonGroupOrientation, type ButtonGroupSeparatorProps, } from "./ButtonGroup";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/ui",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "Modern design system for building high-quality applications",
5
5
  "type": "module",
6
6
  "license": "MIT",