@omer-x/tailwind-ui-kit 1.0.0-alpha.1 → 1.0.0-alpha.10

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.
Files changed (41) hide show
  1. package/dist/components/button/BaseButton.d.ts +12 -0
  2. package/dist/components/button/BaseButton.js +52 -0
  3. package/dist/components/button/PulseButton.d.ts +8 -0
  4. package/dist/components/button/PulseButton.js +41 -0
  5. package/dist/components/button/index.d.ts +3 -0
  6. package/dist/components/button/index.js +4 -0
  7. package/dist/components/elements/JustDiv.d.ts +6 -0
  8. package/dist/components/elements/JustDiv.js +15 -0
  9. package/dist/components/form/BaseForm.d.ts +13 -0
  10. package/dist/components/form/BaseForm.js +53 -0
  11. package/dist/components/form/BaseFormField.d.ts +19 -0
  12. package/dist/components/form/BaseFormField.js +24 -0
  13. package/dist/components/form/BaseInput.d.ts +10 -0
  14. package/dist/components/form/BaseInput.js +32 -0
  15. package/dist/components/form/FieldRoot.d.ts +11 -0
  16. package/dist/components/form/FieldRoot.js +23 -0
  17. package/dist/components/form/FormContext.d.ts +11 -0
  18. package/dist/components/form/FormContext.js +10 -0
  19. package/dist/components/form/ServerSideError.d.ts +12 -0
  20. package/dist/components/form/ServerSideError.js +19 -0
  21. package/dist/components/form/index.d.ts +10 -0
  22. package/dist/components/form/index.js +8 -0
  23. package/dist/components/layout/Container.d.ts +10 -0
  24. package/dist/components/layout/Container.js +11 -0
  25. package/dist/components/layout/index.d.ts +2 -0
  26. package/dist/components/layout/index.js +4 -0
  27. package/dist/components/table/Tdx.d.ts +10 -0
  28. package/dist/components/table/Tdx.js +10 -0
  29. package/dist/components/table/index.d.ts +2 -0
  30. package/dist/components/table/index.js +4 -0
  31. package/dist/hooks/useRipples.d.ts +5 -0
  32. package/dist/hooks/useRipples.js +35 -0
  33. package/dist/utils/index.d.ts +2 -0
  34. package/dist/utils/index.js +4 -0
  35. package/package.json +35 -11
  36. package/dist/components/Button.d.ts +0 -18
  37. package/dist/components/Button.js +0 -37
  38. package/dist/components/LinkButton.d.ts +0 -15
  39. package/dist/components/LinkButton.js +0 -43
  40. package/dist/components/PulseButton.d.ts +0 -11
  41. package/dist/components/PulseButton.js +0 -55
@@ -0,0 +1,12 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+ import { Button } from '@base-ui/react/button';
4
+
5
+ type BaseButtonProps = ComponentProps<typeof Button> & {
6
+ size?: "lg" | "md" | "sm" | "xs";
7
+ pending?: boolean;
8
+ children: ReactNode;
9
+ };
10
+ declare const BaseButton: ({ size, pending, disabled, focusableWhenDisabled, className, children, ...otherProps }: BaseButtonProps) => react.JSX.Element;
11
+
12
+ export { BaseButton as default };
@@ -0,0 +1,52 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { faSpinner } from "@fortawesome/free-solid-svg-icons/faSpinner";
3
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
4
+ import {} from "react";
5
+ import { cn } from "../../utils/cn.js";
6
+ import PulseButton from "./PulseButton.js";
7
+ const BaseButton = ({
8
+ size = "md",
9
+ pending = false,
10
+ disabled,
11
+ focusableWhenDisabled,
12
+ className,
13
+ children,
14
+ ...otherProps
15
+ }) => /* @__PURE__ */ jsxs(
16
+ PulseButton,
17
+ {
18
+ className: cn({
19
+ // Size
20
+ "h-12 px-5 text-base leading-7 gap-3": size === "lg",
21
+ "h-10 px-4 text-sm leading-6 gap-3": size === "md",
22
+ "h-9 px-3 text-sm leading-5 gap-2": size === "sm",
23
+ "h-8 px-2.5 text-xs leading-4 gap-2": size === "xs"
24
+ }, [
25
+ // Base
26
+ "relative",
27
+ "flex items-center justify-center",
28
+ "rounded-md",
29
+ "font-medium",
30
+ "select-none",
31
+ "outline-0",
32
+ "transition-colors",
33
+ // Focus
34
+ "focus-visible:outline-2",
35
+ "focus-visible:outline-offset-2",
36
+ // Cursor
37
+ "cursor-pointer",
38
+ "data-disabled:cursor-default"
39
+ ], className),
40
+ disabled,
41
+ focusableWhenDisabled: pending || focusableWhenDisabled,
42
+ ...otherProps,
43
+ children: [
44
+ pending && /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faSpinner, size: "lg", className: "fa-spin-pulse" }),
45
+ children
46
+ ]
47
+ }
48
+ );
49
+ var BaseButton_default = BaseButton;
50
+ export {
51
+ BaseButton_default as default
52
+ };
@@ -0,0 +1,8 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps } from 'react';
3
+ import { Button } from '@base-ui/react/button';
4
+
5
+ type PulseButtonProps = ComponentProps<typeof Button> & {};
6
+ declare const PulseButton: ({ type, disabled, onClick, children, ...otherProps }: PulseButtonProps) => react.JSX.Element;
7
+
8
+ export { PulseButton as default };
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { jsxs } from "react/jsx-runtime";
3
+ import { Button } from "@base-ui/react/button";
4
+ import {} from "react";
5
+ import { useFormStatus } from "react-dom";
6
+ import { useRipples } from "../../hooks/useRipples.js";
7
+ const PulseButton = ({
8
+ type,
9
+ disabled,
10
+ onClick,
11
+ children,
12
+ ...otherProps
13
+ }) => {
14
+ const { pending } = useFormStatus();
15
+ const [triggerRippleEffect, ripples] = useRipples();
16
+ const submitting = type === "submit" && pending;
17
+ const handleClick = (e) => {
18
+ onClick?.(e);
19
+ if (!e.defaultPrevented) {
20
+ triggerRippleEffect(e);
21
+ }
22
+ };
23
+ return /* @__PURE__ */ jsxs(
24
+ Button,
25
+ {
26
+ ...otherProps,
27
+ type,
28
+ disabled: submitting || disabled,
29
+ onClick: handleClick,
30
+ "data-submitting": submitting ? "" : void 0,
31
+ children: [
32
+ ripples,
33
+ children
34
+ ]
35
+ }
36
+ );
37
+ };
38
+ var PulseButton_default = PulseButton;
39
+ export {
40
+ PulseButton_default as default
41
+ };
@@ -0,0 +1,3 @@
1
+ export { default as BaseButton } from './BaseButton.js';
2
+ import 'react';
3
+ import '@base-ui/react/button';
@@ -0,0 +1,4 @@
1
+ import { default as default2 } from "./BaseButton.js";
2
+ export {
3
+ default2 as BaseButton
4
+ };
@@ -0,0 +1,6 @@
1
+ import * as react from 'react';
2
+ import { useRender } from '@base-ui/react/use-render';
3
+
4
+ declare const JustDiv: ({ render, ...otherProps }: useRender.ComponentProps<"div">) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
5
+
6
+ export { JustDiv as default };
@@ -0,0 +1,15 @@
1
+ import { useRender } from "@base-ui/react/use-render";
2
+ const JustDiv = ({
3
+ render,
4
+ ...otherProps
5
+ }) => {
6
+ return useRender({
7
+ defaultTagName: "div",
8
+ render,
9
+ props: otherProps
10
+ });
11
+ };
12
+ var JustDiv_default = JustDiv;
13
+ export {
14
+ JustDiv_default as default
15
+ };
@@ -0,0 +1,13 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps } from 'react';
3
+ import JustDiv from '../elements/JustDiv.js';
4
+ import '@base-ui/react/use-render';
5
+
6
+ type BaseFormProps = Omit<ComponentProps<"form">, "action"> & {
7
+ action: (initialState: unknown, formData: FormData) => Promise<Record<string, string>>;
8
+ messages?: Partial<Record<string, string>>;
9
+ renderMessages?: ComponentProps<typeof JustDiv>["render"];
10
+ };
11
+ declare const BaseForm: ({ action, messages: messageTranslations, renderMessages, className, children, }: BaseFormProps) => react.JSX.Element;
12
+
13
+ export { BaseForm as default };
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Form } from "@base-ui/react/form";
4
+ import { useActionState, useRef } from "react";
5
+ import JustDiv from "../elements/JustDiv.js";
6
+ import { FormContext } from "./FormContext.js";
7
+ const BaseForm = ({
8
+ action,
9
+ messages: messageTranslations = {},
10
+ renderMessages,
11
+ className,
12
+ children
13
+ }) => {
14
+ const [state, formAction, _loading] = useActionState(action, {});
15
+ const fieldsRef = useRef(/* @__PURE__ */ new Set());
16
+ const getFieldMessage = (fieldName) => {
17
+ if (fieldName in state) {
18
+ return state[fieldName];
19
+ }
20
+ return null;
21
+ };
22
+ const registerField = (fieldName) => {
23
+ fieldsRef.current.add(fieldName);
24
+ };
25
+ const unregisterField = (fieldName) => {
26
+ fieldsRef.current.delete(fieldName);
27
+ };
28
+ const { formMessages, fieldMessages } = Object.keys(state).reduce((bundle, key) => {
29
+ if (fieldsRef.current.has(key)) {
30
+ return { ...bundle, fieldMessages: { ...bundle.fieldMessages, [key]: state[key] } };
31
+ }
32
+ return { ...bundle, formMessages: { ...bundle.formMessages, [key]: state[key] } };
33
+ }, {
34
+ formMessages: {},
35
+ fieldMessages: {}
36
+ });
37
+ return /* @__PURE__ */ jsxs(Form, { action: formAction, className, errors: fieldMessages, children: [
38
+ Object.entries(formMessages).map(([messageKey, message]) => /* @__PURE__ */ jsx(
39
+ JustDiv,
40
+ {
41
+ "data-message-type": messageKey.startsWith("[") ? messageKey.replace(/^\[|\]$/g, "") : "default",
42
+ render: renderMessages,
43
+ children: messageTranslations[message] || message
44
+ },
45
+ messageKey
46
+ )),
47
+ /* @__PURE__ */ jsx(FormContext, { value: { getFieldMessage, messageTranslations, registerField, unregisterField }, children })
48
+ ] });
49
+ };
50
+ var BaseForm_default = BaseForm;
51
+ export {
52
+ BaseForm_default as default
53
+ };
@@ -0,0 +1,19 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, ComponentProps } from 'react';
3
+ import { Field } from '@base-ui/react/field';
4
+ import { getFieldConstraints } from '@omer-x/zod-to-form-constraints';
5
+ import { ZodType } from 'zod';
6
+
7
+ type BaseFormFieldProps = {
8
+ schema: ZodType;
9
+ name: string;
10
+ label?: string;
11
+ messages?: Partial<Record<string, string>>;
12
+ renderInput: (props: ReturnType<typeof getFieldConstraints>) => ReactNode;
13
+ renderLabel?: ComponentProps<typeof Field.Label>["render"];
14
+ renderErrors?: ComponentProps<typeof Field.Error>["render"];
15
+ clientSideErrors?: Partial<Record<keyof ValidityState, string | ((payload: string | number | null) => string)>>;
16
+ };
17
+ declare const BaseFormField: ({ schema, name, label, messages, renderInput, renderLabel, renderErrors, clientSideErrors, }: BaseFormFieldProps) => react.JSX.Element;
18
+
19
+ export { BaseFormField as default };
@@ -0,0 +1,24 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Field } from "@base-ui/react/field";
3
+ import { getErrorMessagePayload, getFieldConstraints } from "@omer-x/zod-to-form-constraints";
4
+ import FieldRoot from "./FieldRoot.js";
5
+ import ServerSideError from "./ServerSideError.js";
6
+ const BaseFormField = ({
7
+ schema,
8
+ name,
9
+ label,
10
+ messages,
11
+ renderInput,
12
+ renderLabel,
13
+ renderErrors,
14
+ clientSideErrors = {}
15
+ }) => /* @__PURE__ */ jsxs(FieldRoot, { name, className: "flex w-full flex-col items-start gap-1", children: [
16
+ typeof label !== "undefined" && /* @__PURE__ */ jsx(Field.Label, { render: renderLabel, children: label }),
17
+ renderInput(getFieldConstraints(schema)),
18
+ Object.entries(clientSideErrors).map(([stateName, message]) => /* @__PURE__ */ jsx(Field.Error, { match: stateName, render: renderErrors, children: typeof message === "string" ? message : message(getErrorMessagePayload(schema, stateName)) }, stateName)),
19
+ /* @__PURE__ */ jsx(ServerSideError, { name, messages, render: renderErrors })
20
+ ] });
21
+ var BaseFormField_default = BaseFormField;
22
+ export {
23
+ BaseFormField_default as default
24
+ };
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps } from 'react';
3
+ import { Input } from '@base-ui/react/input';
4
+
5
+ type BaseInputProps = Omit<ComponentProps<typeof Input>, "size"> & {
6
+ size?: "lg" | "md" | "sm" | "xs";
7
+ };
8
+ declare const BaseInput: ({ size, className, ...otherProps }: BaseInputProps) => react.JSX.Element;
9
+
10
+ export { BaseInput as default };
@@ -0,0 +1,32 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Input } from "@base-ui/react/input";
3
+ import {} from "react";
4
+ import { cn } from "../../utils/cn.js";
5
+ const BaseInput = ({
6
+ size = "md",
7
+ className,
8
+ ...otherProps
9
+ }) => /* @__PURE__ */ jsx(
10
+ Input,
11
+ {
12
+ className: cn({
13
+ // Size
14
+ "h-12 px-5 text-base": size === "lg",
15
+ "h-9 px-3 text-sm": size === "md",
16
+ "h-8 px-2.5 text-sm": size === "sm",
17
+ "h-7 px-2 text-xs": size === "xs"
18
+ }, [
19
+ // Base
20
+ "rounded-md",
21
+ "outline-2",
22
+ "outline-offset-2",
23
+ "outline-transparent",
24
+ "transition-colors"
25
+ ], className),
26
+ ...otherProps
27
+ }
28
+ );
29
+ var BaseInput_default = BaseInput;
30
+ export {
31
+ BaseInput_default as default
32
+ };
@@ -0,0 +1,11 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+
4
+ type FieldRootProps = {
5
+ name: string;
6
+ className?: string;
7
+ children: ReactNode;
8
+ };
9
+ declare const FieldRoot: ({ name, className, children, }: FieldRootProps) => react.JSX.Element;
10
+
11
+ export { FieldRoot as default };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Field } from "@base-ui/react/field";
4
+ import { use, useEffect } from "react";
5
+ import { FormContext } from "./FormContext.js";
6
+ const FieldRoot = ({
7
+ name,
8
+ className,
9
+ children
10
+ }) => {
11
+ const { registerField, unregisterField } = use(FormContext);
12
+ useEffect(() => {
13
+ registerField(name);
14
+ return () => {
15
+ unregisterField(name);
16
+ };
17
+ }, [name]);
18
+ return /* @__PURE__ */ jsx(Field.Root, { name, className, children });
19
+ };
20
+ var FieldRoot_default = FieldRoot;
21
+ export {
22
+ FieldRoot_default as default
23
+ };
@@ -0,0 +1,11 @@
1
+ import * as react from 'react';
2
+
3
+ interface FormContextInterface {
4
+ getFieldMessage: (fieldName: string) => string | null;
5
+ messageTranslations: Partial<Record<string, string>>;
6
+ registerField: (fieldName: string) => void;
7
+ unregisterField: (fieldName: string) => void;
8
+ }
9
+ declare const FormContext: react.Context<FormContextInterface>;
10
+
11
+ export { FormContext };
@@ -0,0 +1,10 @@
1
+ import { createContext } from "react";
2
+ const FormContext = createContext({
3
+ getFieldMessage: () => null,
4
+ messageTranslations: {},
5
+ registerField: () => null,
6
+ unregisterField: () => null
7
+ });
8
+ export {
9
+ FormContext
10
+ };
@@ -0,0 +1,12 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps } from 'react';
3
+ import { Field } from '@base-ui/react/field';
4
+
5
+ type ServerSideErrorProps = {
6
+ name: string;
7
+ messages?: Partial<Record<string, string>>;
8
+ render?: ComponentProps<typeof Field.Error>["render"];
9
+ };
10
+ declare const ServerSideError: ({ name, messages: fieldMessages, render, }: ServerSideErrorProps) => react.JSX.Element | null;
11
+
12
+ export { ServerSideError as default };
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Field } from "@base-ui/react/field";
4
+ import { use } from "react";
5
+ import { FormContext } from "./FormContext.js";
6
+ const ServerSideError = ({
7
+ name,
8
+ messages: fieldMessages = {},
9
+ render
10
+ }) => {
11
+ const { getFieldMessage, messageTranslations: formMessages } = use(FormContext);
12
+ const message = getFieldMessage(name);
13
+ if (!message) return null;
14
+ return /* @__PURE__ */ jsx(Field.Error, { match: true, render, children: fieldMessages[message] || formMessages[message] || message });
15
+ };
16
+ var ServerSideError_default = ServerSideError;
17
+ export {
18
+ ServerSideError_default as default
19
+ };
@@ -0,0 +1,10 @@
1
+ export { default as BaseInput } from './BaseInput.js';
2
+ export { default as BaseForm } from './BaseForm.js';
3
+ export { default as BaseFormField } from './BaseFormField.js';
4
+ import 'react';
5
+ import '@base-ui/react/input';
6
+ import '../elements/JustDiv.js';
7
+ import '@base-ui/react/use-render';
8
+ import '@base-ui/react/field';
9
+ import '@omer-x/zod-to-form-constraints';
10
+ import 'zod';
@@ -0,0 +1,8 @@
1
+ import { default as default2 } from "./BaseInput.js";
2
+ import { default as default3 } from "./BaseForm.js";
3
+ import { default as default4 } from "./BaseFormField.js";
4
+ export {
5
+ default3 as BaseForm,
6
+ default4 as BaseFormField,
7
+ default2 as BaseInput
8
+ };
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ import { ComponentProps, ReactNode } from 'react';
3
+
4
+ type ContainerProps = ComponentProps<"div"> & {
5
+ className?: string;
6
+ children: ReactNode;
7
+ };
8
+ declare const Container: ({ className, children, }: ContainerProps) => react.JSX.Element;
9
+
10
+ export { Container as default };
@@ -0,0 +1,11 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import {} from "react";
3
+ import { cn } from "../../utils/cn.js";
4
+ const Container = ({
5
+ className,
6
+ children
7
+ }) => /* @__PURE__ */ jsx("div", { className: cn("container mx-auto px-3", className), children });
8
+ var Container_default = Container;
9
+ export {
10
+ Container_default as default
11
+ };
@@ -0,0 +1,2 @@
1
+ export { default as Container } from './Container.js';
2
+ import 'react';
@@ -0,0 +1,4 @@
1
+ import { default as default2 } from "./Container.js";
2
+ export {
3
+ default2 as Container
4
+ };
@@ -0,0 +1,10 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+
4
+ type TdxProps = {
5
+ className?: string;
6
+ children?: ReactNode;
7
+ };
8
+ declare const Tdx: ({ className, children, }: TdxProps) => react.JSX.Element;
9
+
10
+ export { Tdx as default };
@@ -0,0 +1,10 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import {} from "react";
3
+ const Tdx = ({
4
+ className,
5
+ children
6
+ }) => /* @__PURE__ */ jsx("td", { className, children: /* @__PURE__ */ jsx("div", { className: "table w-full table-fixed", children: /* @__PURE__ */ jsx("span", { className: "table-cell truncate", children }) }) });
7
+ var Tdx_default = Tdx;
8
+ export {
9
+ Tdx_default as default
10
+ };
@@ -0,0 +1,2 @@
1
+ export { default as Tdx } from './Tdx.js';
2
+ import 'react';
@@ -0,0 +1,4 @@
1
+ import { default as default2 } from "./Tdx.js";
2
+ export {
3
+ default2 as Tdx
4
+ };
@@ -0,0 +1,5 @@
1
+ import * as react from 'react';
2
+
3
+ declare function useRipples(): readonly [(e: React.MouseEvent<Element>) => void, react.JSX.Element];
4
+
5
+ export { useRipples };
@@ -0,0 +1,35 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import styles from "../styles/ripple.module.css";
4
+ import { cn } from "../utils/cn.js";
5
+ function useRipples() {
6
+ const [ripples, setRipples] = useState([]);
7
+ const handleClick = (e) => {
8
+ const rect = e.currentTarget.getBoundingClientRect();
9
+ const size = Math.max(rect.width, rect.height);
10
+ const x = e.clientX - rect.left - size / 2;
11
+ const y = e.clientY - rect.top - size / 2;
12
+ const newRipple = { x, y, size, id: Date.now() };
13
+ setRipples((prev) => [...prev, newRipple]);
14
+ setTimeout(() => {
15
+ setRipples((prev) => prev.filter((r) => r.id !== newRipple.id));
16
+ }, 600);
17
+ };
18
+ const ripplesNode = /* @__PURE__ */ jsx("div", { className: "absolute inset-0 pointer-events-none overflow-hidden rounded-[inherit]", children: ripples.map((ripple) => /* @__PURE__ */ jsx(
19
+ "span",
20
+ {
21
+ className: cn(styles.animation, "absolute rounded-full bg-current opacity-10"),
22
+ style: {
23
+ left: ripple.x,
24
+ top: ripple.y,
25
+ width: ripple.size,
26
+ height: ripple.size
27
+ }
28
+ },
29
+ ripple.id
30
+ )) });
31
+ return [handleClick, ripplesNode];
32
+ }
33
+ export {
34
+ useRipples
35
+ };
@@ -0,0 +1,2 @@
1
+ export { cn } from './cn.js';
2
+ import 'clsx';
@@ -0,0 +1,4 @@
1
+ import { cn } from "./cn.js";
2
+ export {
3
+ cn
4
+ };
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@omer-x/tailwind-ui-kit",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.10",
4
4
  "description": "Tailwind CSS-based React component library for building user interfaces",
5
5
  "keywords": [
6
+ "tailwind",
7
+ "ui-kit",
8
+ "font-awesome",
6
9
  "typescript"
7
10
  ],
8
11
  "repository": {
@@ -24,14 +27,32 @@
24
27
  },
25
28
  "license": "MIT",
26
29
  "type": "module",
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
27
32
  "files": [
28
33
  "dist/"
29
34
  ],
30
35
  "exports": {
36
+ "./layout": {
37
+ "types": "./dist/components/layout/index.d.ts",
38
+ "import": "./dist/components/layout/index.js"
39
+ },
40
+ "./button": {
41
+ "types": "./dist/components/button/index.d.ts",
42
+ "import": "./dist/components/button/index.js"
43
+ },
31
44
  "./dialog": {
32
45
  "types": "./dist/components/dialog/index.d.ts",
33
46
  "import": "./dist/components/dialog/index.js"
34
47
  },
48
+ "./form": {
49
+ "types": "./dist/components/form/index.d.ts",
50
+ "import": "./dist/components/form/index.js"
51
+ },
52
+ "./table": {
53
+ "types": "./dist/components/table/index.d.ts",
54
+ "import": "./dist/components/table/index.js"
55
+ },
35
56
  "./utils": {
36
57
  "types": "./dist/utils/index.d.ts",
37
58
  "import": "./dist/utils/index.js"
@@ -45,8 +66,13 @@
45
66
  "dev": "vite --port 3000",
46
67
  "build": "tsup"
47
68
  },
69
+ "dependencies": {
70
+ "@omer-x/zod-to-form-constraints": "^1.1.2"
71
+ },
48
72
  "peerDependencies": {
49
73
  "@base-ui/react": "^1",
74
+ "@fortawesome/free-brands-svg-icons": "^7",
75
+ "@fortawesome/free-solid-svg-icons": "^7",
50
76
  "@fortawesome/react-fontawesome": "^3",
51
77
  "clsx": "^2",
52
78
  "react": "^19",
@@ -55,23 +81,21 @@
55
81
  "tailwindcss": "^4"
56
82
  },
57
83
  "devDependencies": {
58
- "@fortawesome/free-brands-svg-icons": "^7.2.0",
59
- "@fortawesome/free-solid-svg-icons": "^7.2.0",
60
84
  "@omer-x/eslint-config": "^2.3.2",
61
- "@tailwindcss/vite": "^4.3.0",
62
- "@types/node": "^25.7.0",
63
- "@types/react": "^19.2.14",
85
+ "@tailwindcss/vite": "^4.3.2",
86
+ "@types/node": "^26.1.0",
87
+ "@types/react": "^19.2.17",
64
88
  "@types/react-dom": "^19.2.3",
65
- "@vitejs/plugin-react": "^6.0.1",
66
- "@vitest/coverage-v8": "^4.1.6",
89
+ "@vitejs/plugin-react": "^6.0.3",
90
+ "@vitest/coverage-v8": "^4.1.9",
67
91
  "esbuild-fix-imports-plugin": "^1.0.23",
68
92
  "eslint": "^9.37.0",
69
93
  "eslint-plugin-jsx-a11y": "^6.10.2",
70
94
  "eslint-plugin-react": "^7.37.5",
71
- "semantic-release": "^25.0.3",
95
+ "semantic-release": "^25.0.5",
72
96
  "tsup": "^8.5.1",
73
97
  "typescript": "^5",
74
- "vite": "^8.0.12",
75
- "vitest": "^4.1.6"
98
+ "vite": "^8.1.3",
99
+ "vitest": "^4.1.9"
76
100
  }
77
101
  }
@@ -1,18 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
3
- import { ComponentProps } from 'react';
4
-
5
- type ButtonProps = Omit<ComponentProps<"button">, "children" | "onClick"> & {
6
- color?: "primary" | "secondary" | "success" | "warning" | "danger";
7
- stretched?: boolean;
8
- onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
9
- } & ({
10
- icon: IconProp;
11
- text?: string;
12
- } | {
13
- icon?: IconProp;
14
- text: string;
15
- });
16
- declare const Button: ({ color, icon, text, stretched, onClick, className, ...otherProps }: ButtonProps) => react_jsx_runtime.JSX.Element;
17
-
18
- export { Button as default };
@@ -1,37 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
3
- import { cn } from "../utils/cn.js";
4
- import PulseButton from "./PulseButton.js";
5
- const Button = ({
6
- color = "primary",
7
- icon,
8
- text,
9
- stretched = false,
10
- onClick,
11
- className,
12
- ...otherProps
13
- }) => /* @__PURE__ */ jsxs(
14
- PulseButton,
15
- {
16
- className: cn("relative overflow-hidden inline-flex justify-center items-center transition rounded-lg min-h-9 px-3 py-2 text-sm font-medium text-white focus-visible:outline-2 focus-visible:outline-offset-2 cursor-pointer", {
17
- "bg-blue-500 hover:bg-blue-600 focus-visible:outline-blue-500": color === "primary",
18
- "text-slate-900 bg-slate-400 hover:bg-slate-500 focus-visible:outline-slate-400": color === "secondary",
19
- "bg-green-600 hover:bg-green-700 focus-visible:outline-green-600": color === "success",
20
- "text-slate-900 bg-yellow-500 hover:bg-yellow-600 focus-visible:outline-yellow-500": color === "warning",
21
- "bg-red-600 hover:bg-red-700 focus-visible:outline-red-600": color === "danger",
22
- "gap-2": !stretched,
23
- "gap-3": stretched
24
- }, className),
25
- onClick,
26
- ...otherProps,
27
- children: [
28
- icon && /* @__PURE__ */ jsx(FontAwesomeIcon, { icon, size: "lg" }),
29
- !icon && !text ? /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }) : /* @__PURE__ */ jsx(Fragment, { children: text }),
30
- stretched && icon && /* @__PURE__ */ jsx("div", { className: "w-[var(--fa-width,1.25em)]" })
31
- ]
32
- }
33
- );
34
- var Button_default = Button;
35
- export {
36
- Button_default as default
37
- };
@@ -1,15 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ComponentProps, ReactNode } from 'react';
3
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
4
-
5
- type ButtonProps<LinkProps> = Omit<ComponentProps<"a">, "children" | "href" | "onClick"> & {
6
- color?: "primary" | "secondary" | "success" | "warning" | "danger";
7
- icon?: IconProp;
8
- text?: string;
9
- stretched?: boolean;
10
- as: (props: LinkProps) => ReactNode;
11
- href: string;
12
- };
13
- declare const Button: <LinkProps extends ComponentProps<"a">>({ color, icon, text, stretched, as: Link, href, className, ...otherProps }: ButtonProps<LinkProps>) => react_jsx_runtime.JSX.Element;
14
-
15
- export { Button as default };
@@ -1,43 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
3
- import {} from "react";
4
- import { cn } from "../utils/cn.js";
5
- import PulseButton from "./PulseButton.js";
6
- const Button = ({
7
- color,
8
- icon,
9
- text,
10
- stretched = false,
11
- as: Link,
12
- href,
13
- className,
14
- ...otherProps
15
- }) => (
16
- // @ts-expect-error: shut up typescript!
17
- /* @__PURE__ */ jsxs(
18
- PulseButton,
19
- {
20
- as: Link,
21
- href,
22
- className: cn("relative overflow-hidden inline-flex justify-center items-center transition rounded-lg px-3 py-2 text-sm font-medium text-white focus-visible:outline-2 focus-visible:outline-offset-2 cursor-pointer", {
23
- "bg-blue-500 hover:bg-blue-600 focus-visible:outline-blue-500": color === "primary",
24
- "bg-slate-400 hover:bg-slate-500 focus-visible:outline-slate-400": color === "secondary",
25
- "bg-green-600 hover:bg-green-700 focus-visible:outline-green-600": color === "success",
26
- "bg-yellow-500 hover:bg-yellow-600 focus-visible:outline-yellow-500": color === "warning",
27
- "bg-red-500 hover:bg-red-600 focus-visible:outline-red-500": color === "danger",
28
- "gap-2": !stretched,
29
- "gap-3": stretched
30
- }, className),
31
- ...otherProps,
32
- children: [
33
- icon && /* @__PURE__ */ jsx(FontAwesomeIcon, { icon, size: "lg" }),
34
- !icon && !text ? /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }) : /* @__PURE__ */ jsx(Fragment, { children: text }),
35
- stretched && icon && /* @__PURE__ */ jsx("div", { className: "w-[var(--fa-width,1.25em)]" })
36
- ]
37
- }
38
- )
39
- );
40
- var LinkButton_default = Button;
41
- export {
42
- LinkButton_default as default
43
- };
@@ -1,11 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ElementType, ReactNode, ComponentPropsWithoutRef } from 'react';
3
-
4
- type PulseButtonProps<As extends ElementType> = {
5
- as?: As;
6
- onClick?: (e: React.MouseEvent<Element>) => void;
7
- children: ReactNode;
8
- } & Omit<ComponentPropsWithoutRef<As>, "as" | "onClick" | "children">;
9
- declare const PulseButton: <As extends ElementType = "button">({ as, onClick, children, className, ...otherProps }: PulseButtonProps<As>) => react_jsx_runtime.JSX.Element;
10
-
11
- export { PulseButton as default };
@@ -1,55 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import styles from "../styles/ripple.module.css";
5
- import { cn } from "../utils/cn.js";
6
- const PulseButton = ({
7
- as,
8
- onClick,
9
- children,
10
- className,
11
- ...otherProps
12
- }) => {
13
- const Component = as ?? "button";
14
- const [ripples, setRipples] = useState([]);
15
- const handleClick = (e) => {
16
- onClick?.(e);
17
- const rect = e.currentTarget.getBoundingClientRect();
18
- const size = Math.max(rect.width, rect.height);
19
- const x = e.clientX - rect.left - size / 2;
20
- const y = e.clientY - rect.top - size / 2;
21
- const newRipple = { x, y, size, id: Date.now() };
22
- setRipples((prev) => [...prev, newRipple]);
23
- setTimeout(() => {
24
- setRipples((prev) => prev.filter((r) => r.id !== newRipple.id));
25
- }, 600);
26
- };
27
- return /* @__PURE__ */ jsxs(
28
- Component,
29
- {
30
- onClick: handleClick,
31
- className: cn("relative overflow-hidden", className),
32
- ...otherProps,
33
- children: [
34
- children,
35
- ripples.map((ripple) => /* @__PURE__ */ jsx(
36
- "span",
37
- {
38
- className: cn(styles.animation, "absolute rounded-full bg-white opacity-40"),
39
- style: {
40
- left: ripple.x,
41
- top: ripple.y,
42
- width: ripple.size,
43
- height: ripple.size
44
- }
45
- },
46
- ripple.id
47
- ))
48
- ]
49
- }
50
- );
51
- };
52
- var PulseButton_default = PulseButton;
53
- export {
54
- PulseButton_default as default
55
- };