@spark-ui/components
Version:
Spark (Leboncoin design system) components.
223 lines (215 loc) • 6.55 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/divider/index.ts
var divider_exports = {};
__export(divider_exports, {
Divider: () => Divider2
});
module.exports = __toCommonJS(divider_exports);
// src/divider/Divider.tsx
var import_class_variance_authority2 = require("class-variance-authority");
var import_radix_ui = require("radix-ui");
// src/divider/Divider.styles.ts
var import_internal_utils2 = require("@spark-ui/internal-utils");
var import_class_variance_authority = require("class-variance-authority");
// src/divider/variants/intents.tsx
var import_internal_utils = require("@spark-ui/internal-utils");
var intentVariants = [
// current
{
intent: "current",
isEmpty: true,
class: (0, import_internal_utils.tw)(["border-current"])
},
{
intent: "current",
isEmpty: false,
class: (0, import_internal_utils.tw)(["before:border-current after:border-current"])
},
// outline
{
intent: "outline",
isEmpty: true,
class: (0, import_internal_utils.tw)(["border-outline"])
},
{
intent: "outline",
isEmpty: false,
class: (0, import_internal_utils.tw)(["before:border-outline after:border-outline"])
}
];
// src/divider/Divider.styles.ts
var dividerStyles = (0, import_class_variance_authority.cva)(["overflow-hidden group"], {
variants: {
isEmpty: {
true: ["border-solid"],
false: ["inline-flex items-center", "after:border-solid before:border-solid"]
},
orientation: {
vertical: ["w-fit inline-flex"],
horizontal: ["w-full"]
},
writingMode: {
"horizontal-tb": [],
"vertical-lr": []
},
alignment: {
start: [],
end: [],
center: []
},
intent: {
current: [],
outline: []
}
},
defaultVariants: {
orientation: "horizontal",
writingMode: "horizontal-tb",
alignment: "center",
intent: "outline"
},
compoundVariants: [
{
isEmpty: true,
orientation: "horizontal",
class: (0, import_internal_utils2.tw)(["my-lg border-t-sm"])
},
{
isEmpty: true,
orientation: "vertical",
class: (0, import_internal_utils2.tw)(["mx-lg min-h-sz-24 border-l-sm"])
},
{
isEmpty: false,
orientation: "horizontal",
writingMode: "horizontal-tb",
class: (0, import_internal_utils2.tw)(["flex-row my-sm grow-0", "before:border-t-sm", "after:border-t-sm", "*:px-lg"])
},
{
isEmpty: false,
orientation: "vertical",
writingMode: "horizontal-tb",
class: (0, import_internal_utils2.tw)(["flex-col mx-sm", "before:border-l-sm", "after:border-l-sm", "*:py-lg"])
},
{
isEmpty: false,
orientation: "vertical",
writingMode: "vertical-lr",
class: (0, import_internal_utils2.tw)(["flex-col mx-sm", "before:border-l-sm", "after:border-l-sm", "*:px-lg"])
},
{
isEmpty: false,
orientation: "horizontal",
alignment: "end",
class: (0, import_internal_utils2.tw)(["after:w-sz-40 before:grow after:grow-0"])
},
{
isEmpty: false,
orientation: "horizontal",
alignment: "start",
class: (0, import_internal_utils2.tw)(["before:w-sz-40 before:grow-0 after:grow"])
},
{
isEmpty: false,
orientation: "horizontal",
alignment: "center",
class: (0, import_internal_utils2.tw)(["justify-center before:grow after:grow"])
},
{
isEmpty: false,
orientation: "vertical",
alignment: "end",
class: (0, import_internal_utils2.tw)(["after:h-sz-40 before:grow after:grow-0 before:min-h-sz-40"])
},
{
isEmpty: false,
orientation: "vertical",
alignment: "start",
class: (0, import_internal_utils2.tw)(["before:h-sz-40 before:grow-0 after:grow after:min-h-sz-40"])
},
{
isEmpty: false,
orientation: "vertical",
alignment: "center",
class: (0, import_internal_utils2.tw)(["justify-center before:grow after:grow before:min-h-sz-40 after:min-h-sz-40"])
},
...intentVariants
]
});
// src/divider/Divider.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var Divider = ({
asChild,
className,
isDecorative = false,
children,
orientation = "horizontal",
writingMode = "horizontal-tb",
alignment = "center",
intent = "outline",
ref,
...props
}) => {
const isEmpty = asChild ? !children?.props?.children : !children;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_radix_ui.Separator.Root,
{
"data-spark-component": "divider",
asChild,
className: (0, import_class_variance_authority2.cx)(
dividerStyles({ isEmpty, orientation, alignment, intent, writingMode }),
className
),
orientation,
ref,
decorative: isDecorative,
...props,
"data-writing-mode": writingMode,
children
}
);
};
Divider.displayName = "Divider";
// src/divider/DividerContent.tsx
var import_class_variance_authority3 = require("class-variance-authority");
var import_jsx_runtime2 = require("react/jsx-runtime");
var DividerContent = ({ children, ref, className, ...props }) => {
return children ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
"span",
{
ref,
...props,
className: (0, import_class_variance_authority3.cx)("group-data-[writing-mode=vertical-lr]:[writing-mode:vertical-lr]", className),
children
}
) : null;
};
DividerContent.displayName = "Divider.Content";
// src/divider/index.ts
var Divider2 = Object.assign(Divider, {
Content: DividerContent
});
Divider2.displayName = "Divider";
Divider2.Content.displayName = "Divider.Content";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Divider
});
//# sourceMappingURL=index.js.map
;