@appcorp/shadcn 1.0.14 → 1.0.17
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/components/accordion.d.ts +7 -0
- package/components/accordion.js +87 -0
- package/components/field.d.ts +25 -0
- package/components/field.js +153 -0
- package/package.json +3 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
3
|
+
declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.AccordionContent = exports.AccordionTrigger = exports.AccordionItem = exports.Accordion = void 0;
|
|
60
|
+
var React = __importStar(require("react"));
|
|
61
|
+
var AccordionPrimitive = __importStar(require("@radix-ui/react-accordion"));
|
|
62
|
+
var utils_1 = require("../lib/utils");
|
|
63
|
+
var react_icons_1 = require("@radix-ui/react-icons");
|
|
64
|
+
var Accordion = AccordionPrimitive.Root;
|
|
65
|
+
exports.Accordion = Accordion;
|
|
66
|
+
var AccordionItem = React.forwardRef(function (_a, ref) {
|
|
67
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
68
|
+
return (React.createElement(AccordionPrimitive.Item, __assign({ ref: ref, className: (0, utils_1.cn)("border-b", className) }, props)));
|
|
69
|
+
});
|
|
70
|
+
exports.AccordionItem = AccordionItem;
|
|
71
|
+
AccordionItem.displayName = "AccordionItem";
|
|
72
|
+
var AccordionTrigger = React.forwardRef(function (_a, ref) {
|
|
73
|
+
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
74
|
+
return (React.createElement(AccordionPrimitive.Header, { className: "flex" },
|
|
75
|
+
React.createElement(AccordionPrimitive.Trigger, __assign({ ref: ref, className: (0, utils_1.cn)("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180", className) }, props),
|
|
76
|
+
children,
|
|
77
|
+
React.createElement(react_icons_1.ChevronDownIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" }))));
|
|
78
|
+
});
|
|
79
|
+
exports.AccordionTrigger = AccordionTrigger;
|
|
80
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
81
|
+
var AccordionContent = React.forwardRef(function (_a, ref) {
|
|
82
|
+
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
83
|
+
return (React.createElement(AccordionPrimitive.Content, __assign({ ref: ref, className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down" }, props),
|
|
84
|
+
React.createElement("div", { className: (0, utils_1.cn)("pb-4 pt-0", className) }, children)));
|
|
85
|
+
});
|
|
86
|
+
exports.AccordionContent = AccordionContent;
|
|
87
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Label } from "./label";
|
|
4
|
+
declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">): React.JSX.Element;
|
|
5
|
+
declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<"legend"> & {
|
|
6
|
+
variant?: "legend" | "label";
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
declare const fieldVariants: (props?: ({
|
|
10
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
12
|
+
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): React.JSX.Element;
|
|
13
|
+
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): React.JSX.Element;
|
|
15
|
+
declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
16
|
+
declare function FieldDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
17
|
+
declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<"div"> & {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<"div"> & {
|
|
21
|
+
errors?: Array<{
|
|
22
|
+
message?: string;
|
|
23
|
+
} | undefined>;
|
|
24
|
+
}): React.JSX.Element | null;
|
|
25
|
+
export { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle, };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.Field = Field;
|
|
60
|
+
exports.FieldLabel = FieldLabel;
|
|
61
|
+
exports.FieldDescription = FieldDescription;
|
|
62
|
+
exports.FieldError = FieldError;
|
|
63
|
+
exports.FieldGroup = FieldGroup;
|
|
64
|
+
exports.FieldLegend = FieldLegend;
|
|
65
|
+
exports.FieldSeparator = FieldSeparator;
|
|
66
|
+
exports.FieldSet = FieldSet;
|
|
67
|
+
exports.FieldContent = FieldContent;
|
|
68
|
+
exports.FieldTitle = FieldTitle;
|
|
69
|
+
var react_1 = __importStar(require("react"));
|
|
70
|
+
var class_variance_authority_1 = require("class-variance-authority");
|
|
71
|
+
var utils_1 = require("../lib/utils");
|
|
72
|
+
var label_1 = require("./label");
|
|
73
|
+
var separator_1 = require("./separator");
|
|
74
|
+
function FieldSet(_a) {
|
|
75
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
76
|
+
return (react_1.default.createElement("fieldset", __assign({ "data-slot": "field-set", className: (0, utils_1.cn)("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className) }, props)));
|
|
77
|
+
}
|
|
78
|
+
function FieldLegend(_a) {
|
|
79
|
+
var className = _a.className, _b = _a.variant, variant = _b === void 0 ? "legend" : _b, props = __rest(_a, ["className", "variant"]);
|
|
80
|
+
return (react_1.default.createElement("legend", __assign({ "data-slot": "field-legend", "data-variant": variant, className: (0, utils_1.cn)("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className) }, props)));
|
|
81
|
+
}
|
|
82
|
+
function FieldGroup(_a) {
|
|
83
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
84
|
+
return (react_1.default.createElement("div", __assign({ "data-slot": "field-group", className: (0, utils_1.cn)("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className) }, props)));
|
|
85
|
+
}
|
|
86
|
+
var fieldVariants = (0, class_variance_authority_1.cva)("group/field data-[invalid=true]:text-destructive flex w-full gap-3", {
|
|
87
|
+
variants: {
|
|
88
|
+
orientation: {
|
|
89
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
90
|
+
horizontal: [
|
|
91
|
+
"flex-row items-center",
|
|
92
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
93
|
+
"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start",
|
|
94
|
+
],
|
|
95
|
+
responsive: [
|
|
96
|
+
"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto",
|
|
97
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
98
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
defaultVariants: {
|
|
103
|
+
orientation: "vertical",
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
function Field(_a) {
|
|
107
|
+
var className = _a.className, _b = _a.orientation, orientation = _b === void 0 ? "vertical" : _b, props = __rest(_a, ["className", "orientation"]);
|
|
108
|
+
return (react_1.default.createElement("div", __assign({ role: "group", "data-slot": "field", "data-orientation": orientation, className: (0, utils_1.cn)(fieldVariants({ orientation: orientation }), className) }, props)));
|
|
109
|
+
}
|
|
110
|
+
function FieldContent(_a) {
|
|
111
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
112
|
+
return (react_1.default.createElement("div", __assign({ "data-slot": "field-content", className: (0, utils_1.cn)("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className) }, props)));
|
|
113
|
+
}
|
|
114
|
+
function FieldLabel(_a) {
|
|
115
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
116
|
+
return (react_1.default.createElement(label_1.Label, __assign({ "data-slot": "field-label", className: (0, utils_1.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4", "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10", className) }, props)));
|
|
117
|
+
}
|
|
118
|
+
function FieldTitle(_a) {
|
|
119
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
120
|
+
return (react_1.default.createElement("div", __assign({ "data-slot": "field-label", className: (0, utils_1.cn)("flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50", className) }, props)));
|
|
121
|
+
}
|
|
122
|
+
function FieldDescription(_a) {
|
|
123
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
124
|
+
return (react_1.default.createElement("p", __assign({ "data-slot": "field-description", className: (0, utils_1.cn)("text-muted-foreground text-sm font-normal leading-normal group-has-[[data-orientation=horizontal]]/field:text-balance", "nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5", "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4", className) }, props)));
|
|
125
|
+
}
|
|
126
|
+
function FieldSeparator(_a) {
|
|
127
|
+
var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
|
|
128
|
+
return (react_1.default.createElement("div", __assign({ "data-slot": "field-separator", "data-content": !!children, className: (0, utils_1.cn)("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className) }, props),
|
|
129
|
+
react_1.default.createElement(separator_1.Separator, { className: "absolute inset-0 top-1/2" }),
|
|
130
|
+
children && (react_1.default.createElement("span", { className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2", "data-slot": "field-separator-content" }, children))));
|
|
131
|
+
}
|
|
132
|
+
function FieldError(_a) {
|
|
133
|
+
var className = _a.className, children = _a.children, errors = _a.errors, props = __rest(_a, ["className", "children", "errors"]);
|
|
134
|
+
var content = (0, react_1.useMemo)(function () {
|
|
135
|
+
var _a;
|
|
136
|
+
if (children) {
|
|
137
|
+
return children;
|
|
138
|
+
}
|
|
139
|
+
if (!errors) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
if ((errors === null || errors === void 0 ? void 0 : errors.length) === 1 && ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message)) {
|
|
143
|
+
return errors[0].message;
|
|
144
|
+
}
|
|
145
|
+
return (react_1.default.createElement("ul", { className: "ml-4 flex list-disc flex-col gap-1" }, errors.map(function (error, index) {
|
|
146
|
+
return (error === null || error === void 0 ? void 0 : error.message) && react_1.default.createElement("li", { key: index }, error.message);
|
|
147
|
+
})));
|
|
148
|
+
}, [children, errors]);
|
|
149
|
+
if (!content) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
return (react_1.default.createElement("div", __assign({ role: "alert", "data-slot": "field-error", className: (0, utils_1.cn)("text-destructive text-sm font-normal", className) }, props), content));
|
|
153
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/shadcn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build:next": "next build",
|
|
6
6
|
"build:storybook": "storybook build -c .storybook -o .out",
|
|
@@ -37,9 +37,11 @@
|
|
|
37
37
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
38
38
|
"@eslint/eslintrc": "^3.3.1",
|
|
39
39
|
"@eslint/js": "^9.37.0",
|
|
40
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
40
41
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
41
42
|
"@radix-ui/react-context-menu": "^2.2.16",
|
|
42
43
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
44
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
43
45
|
"@radix-ui/react-label": "^2.1.7",
|
|
44
46
|
"@radix-ui/react-popover": "^1.1.15",
|
|
45
47
|
"@radix-ui/react-select": "^2.2.6",
|