@nikala-ui/core 0.10.0 → 0.10.1-nightly.3fd7ba3
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/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "button-group",
|
|
3
|
+
"title": "Button Group",
|
|
4
|
+
"description": "Groups related buttons into a connected horizontal or vertical control.",
|
|
5
|
+
"type": "registry:ui",
|
|
6
|
+
"dependencies": [
|
|
7
|
+
"clsx",
|
|
8
|
+
"tailwind-merge"
|
|
9
|
+
],
|
|
10
|
+
"registryDependencies": [
|
|
11
|
+
"button"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
{
|
|
15
|
+
"path": "ui/button-group.tsx",
|
|
16
|
+
"content": "import { splitProps, type Component, type JSX } from \"solid-js\";\nimport { cn } from \"@/lib/cn\";\n\nexport interface ButtonGroupProps extends JSX.HTMLAttributes<HTMLDivElement> {\n /** Controls whether grouped buttons are arranged in a row or column. */\n orientation?: \"horizontal\" | \"vertical\";\n class?: string;\n}\n\n/**\n * Groups adjacent buttons into a connected control with shared borders and radii.\n *\n * ButtonGroup is intentionally presentational. Use Button for individual actions\n * and compose the group with the same reactive state as the surrounding feature.\n */\nexport const ButtonGroup: Component<ButtonGroupProps> = (props) => {\n const [local, rest] = splitProps(props, [\n \"orientation\",\n \"class\",\n \"children\",\n ]);\n\n const orientation = () => local.orientation ?? \"horizontal\";\n\n return (\n <div\n role=\"group\"\n data-orientation={orientation()}\n class={cn(\n \"isolate inline-flex\",\n orientation() === \"horizontal\"\n ? \"flex-row [&>button:not(:first-child)]:-ml-px [&>button:not(:first-child)]:rounded-l-none [&>button:not(:last-child)]:rounded-r-none\"\n : \"flex-col [&>button:not(:first-child)]:-mt-px [&>button:not(:first-child)]:rounded-t-none [&>button:not(:last-child)]:rounded-b-none\",\n \"[&>button:focus-visible]:z-10\",\n local.class\n )}\n {...rest}\n >\n {local.children}\n </div>\n );\n};\n",
|
|
17
|
+
"type": "registry:ui"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
package/registry/index.json
CHANGED
|
@@ -74,6 +74,19 @@
|
|
|
74
74
|
"tailwind-merge"
|
|
75
75
|
]
|
|
76
76
|
},
|
|
77
|
+
{
|
|
78
|
+
"name": "button-group",
|
|
79
|
+
"title": "Button Group",
|
|
80
|
+
"description": "Groups related buttons into a connected horizontal or vertical control.",
|
|
81
|
+
"type": "registry:ui",
|
|
82
|
+
"dependencies": [
|
|
83
|
+
"clsx",
|
|
84
|
+
"tailwind-merge"
|
|
85
|
+
],
|
|
86
|
+
"registryDependencies": [
|
|
87
|
+
"button"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
77
90
|
{
|
|
78
91
|
"name": "button",
|
|
79
92
|
"title": "Button",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { splitProps, type Component, type JSX } from "solid-js";
|
|
2
|
+
import { cn } from "@/lib/cn";
|
|
3
|
+
|
|
4
|
+
export interface ButtonGroupProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Controls whether grouped buttons are arranged in a row or column. */
|
|
6
|
+
orientation?: "horizontal" | "vertical";
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Groups adjacent buttons into a connected control with shared borders and radii.
|
|
12
|
+
*
|
|
13
|
+
* ButtonGroup is intentionally presentational. Use Button for individual actions
|
|
14
|
+
* and compose the group with the same reactive state as the surrounding feature.
|
|
15
|
+
*/
|
|
16
|
+
export const ButtonGroup: Component<ButtonGroupProps> = (props) => {
|
|
17
|
+
const [local, rest] = splitProps(props, [
|
|
18
|
+
"orientation",
|
|
19
|
+
"class",
|
|
20
|
+
"children",
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
const orientation = () => local.orientation ?? "horizontal";
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
role="group"
|
|
28
|
+
data-orientation={orientation()}
|
|
29
|
+
class={cn(
|
|
30
|
+
"isolate inline-flex",
|
|
31
|
+
orientation() === "horizontal"
|
|
32
|
+
? "flex-row [&>button:not(:first-child)]:-ml-px [&>button:not(:first-child)]:rounded-l-none [&>button:not(:last-child)]:rounded-r-none"
|
|
33
|
+
: "flex-col [&>button:not(:first-child)]:-mt-px [&>button:not(:first-child)]:rounded-t-none [&>button:not(:last-child)]:rounded-b-none",
|
|
34
|
+
"[&>button:focus-visible]:z-10",
|
|
35
|
+
local.class
|
|
36
|
+
)}
|
|
37
|
+
{...rest}
|
|
38
|
+
>
|
|
39
|
+
{local.children}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
package/src/registry/metadata.ts
CHANGED
|
@@ -16,6 +16,12 @@ export const COMPONENT_METADATA: Record<string, ComponentMeta> = {
|
|
|
16
16
|
dependencies: ["clsx", "tailwind-merge", "class-variance-authority"],
|
|
17
17
|
registryDependencies: ["spinner"],
|
|
18
18
|
},
|
|
19
|
+
"button-group": {
|
|
20
|
+
title: "Button Group",
|
|
21
|
+
description: "Groups related buttons into a connected horizontal or vertical control.",
|
|
22
|
+
dependencies: ["clsx", "tailwind-merge"],
|
|
23
|
+
registryDependencies: ["button"],
|
|
24
|
+
},
|
|
19
25
|
input: {
|
|
20
26
|
title: "Input",
|
|
21
27
|
description: "A standard text input field with styling variants.",
|