@plexui/ui 0.12.0 → 0.13.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/es/components/ButtonGroup/ButtonGroup.js +11 -0
- package/dist/es/components/ButtonGroup/ButtonGroup.js.map +1 -0
- package/dist/es/components/ButtonGroup/ButtonGroup.module.css +60 -0
- package/dist/es/components/ButtonGroup/index.js +2 -0
- package/dist/es/components/ButtonGroup/index.js.map +1 -0
- package/dist/es/styles/variables-components.css +5 -0
- package/dist/types/components/ButtonGroup/ButtonGroup.d.ts +26 -0
- package/dist/types/components/ButtonGroup/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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,60 @@
|
|
|
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 */
|
|
25
|
+
.Root[data-orientation="horizontal"] > *:not(:first-child) {
|
|
26
|
+
border-start-start-radius: 0;
|
|
27
|
+
border-end-start-radius: 0;
|
|
28
|
+
border-inline-start: 0;
|
|
29
|
+
}
|
|
30
|
+
.Root[data-orientation="horizontal"] > *:not(:last-child) {
|
|
31
|
+
border-start-end-radius: 0;
|
|
32
|
+
border-end-end-radius: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Vertical */
|
|
36
|
+
.Root[data-orientation="vertical"] {
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
}
|
|
39
|
+
.Root[data-orientation="vertical"] > *:not(:first-child) {
|
|
40
|
+
border-start-start-radius: 0;
|
|
41
|
+
border-start-end-radius: 0;
|
|
42
|
+
border-block-start: 0;
|
|
43
|
+
}
|
|
44
|
+
.Root[data-orientation="vertical"] > *:not(:last-child) {
|
|
45
|
+
border-end-start-radius: 0;
|
|
46
|
+
border-end-end-radius: 0;
|
|
47
|
+
}
|
|
48
|
+
.Root > input,
|
|
49
|
+
.Root > [data-slot="input-wrapper"] {
|
|
50
|
+
flex: 1 1 auto;
|
|
51
|
+
}/* Separator used between items inside a ButtonGroup */.Separator {
|
|
52
|
+
align-self: stretch;
|
|
53
|
+
margin: 0;
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.Separator[data-orientation="vertical"] {
|
|
58
|
+
height: auto;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -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";
|