@fidely-ui/react
Version:
Fidely UI is a modern, beautifully crafted React design system powered by Ark UI and Panda CSS, delivering accessible and themeable components for building exceptional web apps
268 lines (258 loc) • 10.2 kB
JavaScript
'use client'
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/components/combobox/index.ts
var combobox_exports = {};
__export(combobox_exports, {
Combobox: () => namespace_exports,
ComboboxClearTrigger: () => ComboboxClearTrigger,
ComboboxContent: () => ComboboxContent,
ComboboxContext: () => ComboboxContext,
ComboboxControl: () => ComboboxControl,
ComboboxEmpty: () => ComboboxEmpty,
ComboboxIndicatorGroup: () => ComboboxIndicatorGroup,
ComboboxInput: () => ComboboxInput,
ComboboxItem: () => ComboboxItem,
ComboboxItemContext: () => ComboboxItemContext,
ComboboxItemGroup: () => ComboboxItemGroup,
ComboboxItemGroupLabel: () => ComboboxItemGroupLabel,
ComboboxItemIndicator: () => ComboboxItemIndicator,
ComboboxItemText: () => ComboboxItemText,
ComboboxLabel: () => ComboboxLabel,
ComboboxList: () => ComboboxList,
ComboboxPositioner: () => ComboboxPositioner,
ComboboxRoot: () => ComboboxRoot,
ComboboxRootProvider: () => ComboboxRootProvider,
ComboboxTrigger: () => ComboboxTrigger,
useCombobox: () => import_combobox4.useCombobox,
useComboboxContext: () => import_combobox4.useComboboxContext,
useComboboxItemContext: () => import_combobox4.useComboboxItemContext,
useListCollection: () => import_combobox4.useListCollection
});
module.exports = __toCommonJS(combobox_exports);
// src/components/combobox/combobox.tsx
var import_combobox = require("@ark-ui/react/combobox");
var import_recipes = require("@fidely-ui/styled-system/recipes");
// src/system/make-style-context.tsx
var React = __toESM(require("react"), 1);
var import_jsx = require("@fidely-ui/styled-system/jsx");
var import_css = require("@fidely-ui/styled-system/css");
var import_jsx_runtime = require("react/jsx-runtime");
var canForward = (prop, variantKeys, opts = {}) => opts.forwardProps?.includes(prop) || !variantKeys.includes(prop) && !(0, import_jsx.isCssProperty)(prop);
function makeStyleContext(recipe) {
const Ctx = React.createContext(null);
function withSlotRootProvider(Component) {
const Comp = (props) => {
const [variantProps, rest] = recipe.splitVariantProps(props);
const slots = recipe(variantProps);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ctx.Provider, { value: slots, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...rest }) });
};
Comp.displayName = "FidelyRoot";
return Comp;
}
function withSlotProvider2(Component, slot, opts) {
const Styled = (0, import_jsx.styled)(
Component,
{},
{
shouldForwardProp: (prop, variantKeys) => canForward(prop, variantKeys, opts)
}
);
const Comp = React.forwardRef((props, ref) => {
const [variantProps, rest] = recipe.splitVariantProps(props);
const slots = recipe(variantProps);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ctx.Provider, { value: slots, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
Styled,
{
...rest,
ref,
className: (0, import_css.cx)(slots?.[slot], props.className)
}
) });
});
Comp.displayName = `FidelySlotProvider(${String(slot)})`;
return Comp;
}
function withSlotContext2(Component, slot) {
const Styled = (0, import_jsx.styled)(Component);
const Comp = React.forwardRef((props, ref) => {
const slots = React.useContext(Ctx);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
Styled,
{
...props,
ref,
className: (0, import_css.cx)(slots?.[slot], props.className)
}
);
});
Comp.displayName = `FidelySlotConsumer(${String(slot)})`;
return Comp;
}
return { withSlotRootProvider, withSlotProvider: withSlotProvider2, withSlotContext: withSlotContext2 };
}
// src/components/icons/create-icon.tsx
var React2 = __toESM(require("react"), 1);
var import_factory = require("@ark-ui/react/factory");
var import_jsx_runtime2 = require("react/jsx-runtime");
function createIcon(path) {
return React2.forwardRef(function Icon(props, ref) {
const { size = 20, ...rest } = props;
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
import_factory.ark.svg,
{
ref,
width: size,
height: size,
viewBox: "0 0 24 24",
fill: "currentColor",
xmlns: "http://www.w3.org/2000/svg",
...rest,
children: path
}
);
});
}
// src/components/icons/FiClose.tsx
var import_jsx_runtime3 = require("react/jsx-runtime");
var FiClose = createIcon(
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"path",
{
d: "M18 6 6 18M6 6l12 12",
stroke: "currentColor",
strokeWidth: "2",
fill: "none",
strokeLinecap: "round"
}
)
);
// src/components/icons/FiCaretDownIcon.tsx
var import_jsx_runtime4 = require("react/jsx-runtime");
var FiCaretDownIcon = createIcon(
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
"path",
{
d: "M6 9L12 15L18 9",
stroke: "currentColor",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}
)
);
// src/components/combobox/combobox.tsx
var import_jsx_runtime5 = require("react/jsx-runtime");
var { withSlotProvider, withSlotContext } = makeStyleContext(import_recipes.combobox);
var ComboboxRootProvider = withSlotProvider(import_combobox.Combobox.RootProvider, "root");
var ComboboxRoot = withSlotProvider(
import_combobox.Combobox.Root,
"root"
);
var ComboboxLabel = withSlotContext(import_combobox.Combobox.Label, "label");
var ComboboxControl = withSlotContext(import_combobox.Combobox.Control, "control");
var ComboboxInput = withSlotContext(import_combobox.Combobox.Input, "input");
var ComboboxTrigger = withSlotContext((props) => {
const { idleIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FiCaretDownIcon, { size: 18 }), children, ...rest } = props;
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_combobox.Combobox.Trigger, { ...rest, children: children ?? idleIcon });
}, "trigger");
var ComboboxClearTrigger = withSlotContext((props) => {
const { idleIcon = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FiClose, { size: 18 }), children, ...rest } = props;
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_combobox.Combobox.ClearTrigger, { ...rest, children: children ?? idleIcon });
}, "clearTrigger");
var ComboboxPositioner = withSlotContext(import_combobox.Combobox.Positioner, "positioner");
var ComboboxContent = withSlotContext(import_combobox.Combobox.Content, "content");
var ComboboxItemGroup = withSlotContext(import_combobox.Combobox.ItemGroup, "itemGroup");
var ComboboxItemGroupLabel = withSlotContext(import_combobox.Combobox.ItemGroupLabel, "itemGroupLabel");
var ComboboxItem = withSlotContext(
import_combobox.Combobox.Item,
"item"
);
var ComboboxItemText = withSlotContext(import_combobox.Combobox.ItemText, "itemText");
var ComboboxItemIndicator = withSlotContext(import_combobox.Combobox.ItemIndicator, "itemIndicator");
var ComboboxIndicatorGroup = withSlotContext("div", "indicatorGroup");
var ComboboxEmpty = withSlotContext(import_combobox.Combobox.Empty, "empty");
var ComboboxList = withSlotContext(
import_combobox.Combobox.List,
"list"
);
var ComboboxContext = import_combobox.Combobox.Context;
var ComboboxItemContext = import_combobox.Combobox.ItemContext;
// src/components/combobox/index.ts
var import_combobox4 = require("@ark-ui/react/combobox");
// src/components/combobox/namespace.ts
var namespace_exports = {};
__export(namespace_exports, {
ClearTrigger: () => ComboboxClearTrigger,
Content: () => ComboboxContent,
Context: () => ComboboxContext,
Control: () => ComboboxControl,
Empty: () => ComboboxEmpty,
IndicatorGroup: () => ComboboxIndicatorGroup,
Input: () => ComboboxInput,
Item: () => ComboboxItem,
ItemContext: () => ComboboxItemContext,
ItemGroup: () => ComboboxItemGroup,
ItemGroupLabel: () => ComboboxItemGroupLabel,
ItemIndicator: () => ComboboxItemIndicator,
ItemText: () => ComboboxItemText,
Label: () => ComboboxLabel,
List: () => ComboboxList,
Positioner: () => ComboboxPositioner,
Root: () => ComboboxRoot,
RootProvider: () => ComboboxRootProvider,
Trigger: () => ComboboxTrigger
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Combobox,
ComboboxClearTrigger,
ComboboxContent,
ComboboxContext,
ComboboxControl,
ComboboxEmpty,
ComboboxIndicatorGroup,
ComboboxInput,
ComboboxItem,
ComboboxItemContext,
ComboboxItemGroup,
ComboboxItemGroupLabel,
ComboboxItemIndicator,
ComboboxItemText,
ComboboxLabel,
ComboboxList,
ComboboxPositioner,
ComboboxRoot,
ComboboxRootProvider,
ComboboxTrigger,
useCombobox,
useComboboxContext,
useComboboxItemContext,
useListCollection
});