@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
151 lines (144 loc) • 5.89 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/pin-input/index.ts
var pin_input_exports = {};
__export(pin_input_exports, {
PinInput: () => namespace_exports,
PinInputContext: () => PinInputContext,
PinInputControl: () => PinInputControl,
PinInputHiddenInput: () => PinInputHiddenInput,
PinInputInput: () => PinInputInput,
PinInputLabel: () => PinInputLabel,
PinInputRoot: () => PinInputRoot,
PinInputRootProvider: () => PinInputRootProvider,
usePinInput: () => import_pin_input4.usePinInput,
usePinInputContext: () => import_pin_input4.usePinInputContext
});
module.exports = __toCommonJS(pin_input_exports);
// src/components/pin-input/pin-input.tsx
var import_pin_input = require("@ark-ui/react/pin-input");
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/pin-input/pin-input.tsx
var { withSlotProvider, withSlotContext } = makeStyleContext(import_recipes.pinInput);
var PinInputRootProvider = withSlotProvider(import_pin_input.PinInput.RootProvider, "root");
var PinInputRoot = withSlotProvider(
import_pin_input.PinInput.Root,
"root",
{ forwardProps: ["mask"] }
);
var PinInputLabel = withSlotContext(import_pin_input.PinInput.Label, "label");
var PinInputControl = withSlotContext(import_pin_input.PinInput.Control, "control");
var PinInputInput = withSlotContext(import_pin_input.PinInput.Input, "input");
var PinInputHiddenInput = import_pin_input.PinInput.HiddenInput;
var PinInputContext = import_pin_input.PinInput.Context;
// src/components/pin-input/namespace.ts
var namespace_exports = {};
__export(namespace_exports, {
Context: () => PinInputContext,
Control: () => PinInputControl,
HiddenInput: () => PinInputHiddenInput,
Input: () => PinInputInput,
Label: () => PinInputLabel,
Root: () => PinInputRoot,
RootProvider: () => PinInputRootProvider
});
// src/components/pin-input/index.ts
var import_pin_input4 = require("@ark-ui/react/pin-input");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
PinInput,
PinInputContext,
PinInputControl,
PinInputHiddenInput,
PinInputInput,
PinInputLabel,
PinInputRoot,
PinInputRootProvider,
usePinInput,
usePinInputContext
});