diff --git a/package.json b/package.json index 0048941..bfa20c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@inkonchain/ink-kit", - "version": "0.9.1-beta.5", + "version": "0.9.1-beta.16", "description": "", "main": "dist/index.cjs.js", "module": "dist/index.es.js", @@ -19,7 +19,8 @@ "import": "./dist/providers.es.js", "require": "./dist/providers.cjs.js" }, - "./style.css": "./dist/style.css" + "./style.css": "./dist/style.css", + "./tailwind.css": "./dist/tailwind.css" }, "scripts": { "build": "tsc && vite build --mode production", @@ -77,7 +78,7 @@ "@tanstack/react-query": "^5", "react": "^18 || ^19", "react-dom": "^18 || ^19", - "tailwindcss": "^3", + "tailwindcss": "^3 || ^4", "viem": "^2", "wagmi": "^2" }, diff --git a/scripts/import-svgs.mjs b/scripts/import-svgs.mjs index 98553bf..72553c6 100644 --- a/scripts/import-svgs.mjs +++ b/scripts/import-svgs.mjs @@ -22,11 +22,14 @@ async function processSvgsInFolder(folder) { (await fs.readdir(folder, { recursive: true })).map(async (name) => { if (name.includes("=")) { const currentPath = name.split("/").slice(0, -1).join("/"); - const newName = currentPath + "/" + name.split("=")[1]; - if (await fs.access(path.join(folder, newName)).catch(() => false)) { - await fs.unlink(path.join(folder, newName)); + const newName = path.join( + folder, + currentPath + "/" + name.split("=")[1] + ); + if (await fs.access(newName).catch(() => false)) { + await fs.unlink(newName); } - await fs.rename(path.join(folder, name), path.join(folder, newName)); + await fs.rename(path.join(folder, name), newName); } }) ); diff --git a/src/components/Alert/Alert.tsx b/src/components/Alert/Alert.tsx index 191535a..67b080b 100644 --- a/src/components/Alert/Alert.tsx +++ b/src/components/Alert/Alert.tsx @@ -92,3 +92,5 @@ export const Alert: React.FC = ({ ); }; + +Alert.displayName = "Alert"; diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index f3920a3..9810ebc 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -1,4 +1,4 @@ -import React, { PropsWithChildren } from "react"; +import React, { PropsWithChildren, forwardRef } from "react"; import { classNames, variantClassNames } from "../../util/classes"; import { Slot, Slottable } from "../Slot/Slot"; @@ -14,80 +14,88 @@ export interface ButtonProps iconRight?: React.ReactNode; } -export const Button: React.FC = ({ - asChild, - className, - children, - variant = "primary", - size = "md", - rounded = "default", - iconLeft, - iconRight, - ...restProps -}: ButtonProps) => { - const Component = asChild ? Slot : "button"; - const iconClasses = classNames( - "ink:size-3 ink:-my-1", - variant === "wallet" && - classNames( - "ink:*:object-cover ink:*:w-full ink:*:h-full ink:*:rounded-full", - variantClassNames(size, { - md: "ink:size-4", - lg: "ink:size-6", - }) - ) - ); - return ( - - - {(child) => ( - <> - {iconLeft &&
{iconLeft}
} - {child} - {iconRight &&
{iconRight}
} - +export const Button = forwardRef( + function Button( + { + asChild, + className, + children, + variant = "primary", + size = "md", + rounded = "default", + iconLeft, + iconRight, + ...restProps + }, + ref + ) { + const Component = asChild ? Slot : "button"; + const iconClasses = classNames( + "ink:size-3 ink:-my-1", + variant === "wallet" && + classNames( + "ink:*:object-cover ink:*:w-full ink:*:h-full ink:*:rounded-full", + variantClassNames(size, { + md: "ink:size-4", + lg: "ink:size-6", + }) + ) + ); + return ( + - - ); -}; + {...restProps} + ref={ref} + > + + {(child) => ( + <> + {iconLeft &&
{iconLeft}
} + {child} + {iconRight &&
{iconRight}
} + + )} +
+
+ ); + } +); + +Button.displayName = "Button"; diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx index 903b2b7..cb4da8f 100644 --- a/src/components/Card/Card.tsx +++ b/src/components/Card/Card.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { forwardRef } from "react"; import { classNames, variantClassNames } from "../../util/classes"; import { Slot, Slottable } from "../Slot"; import { cva, type VariantProps } from "class-variance-authority"; @@ -61,19 +61,23 @@ ink:overflow-hidden } ); -export const Card: React.FC = ({ - children, - className, - image, - imageLocation, - asChild, - variant, - clickable, - size, -}) => { +export const Card = forwardRef(function Card( + { + children, + className, + image, + imageLocation, + asChild, + variant, + clickable, + size, + }, + ref +) { const Component = asChild ? Slot : "div"; return ( = ({ ); -}; +}); + +Card.displayName = "Card"; diff --git a/src/components/Card/Content/CallToAction.tsx b/src/components/Card/Content/CallToAction.tsx index 7ab7a0c..5197d74 100644 --- a/src/components/Card/Content/CallToAction.tsx +++ b/src/components/Card/Content/CallToAction.tsx @@ -21,3 +21,5 @@ export const CallToAction: React.FC = ({ ); }; + +CallToAction.displayName = "CallToAction"; diff --git a/src/components/Card/Content/CardInfo.tsx b/src/components/Card/Content/CardInfo.tsx index 0088379..f7e7794 100644 --- a/src/components/Card/Content/CardInfo.tsx +++ b/src/components/Card/Content/CardInfo.tsx @@ -35,3 +35,5 @@ export const CardInfo = ({ ); }; + +CardInfo.displayName = "CardInfo"; diff --git a/src/components/Card/Content/CardInfos.tsx b/src/components/Card/Content/CardInfos.tsx index 140b4eb..3df1e29 100644 --- a/src/components/Card/Content/CardInfos.tsx +++ b/src/components/Card/Content/CardInfos.tsx @@ -18,3 +18,5 @@ export const CardInfos = ({ children, className }: CardInfosProps) => { ); }; + +CardInfos.displayName = "CardInfos"; diff --git a/src/components/Card/Content/Image.tsx b/src/components/Card/Content/Image.tsx index 3a01e0f..5d18139 100644 --- a/src/components/Card/Content/Image.tsx +++ b/src/components/Card/Content/Image.tsx @@ -53,3 +53,5 @@ export const Image: React.FC = ({ ); }; + +Image.displayName = "Image"; diff --git a/src/components/Card/Content/LargeLink.tsx b/src/components/Card/Content/LargeLink.tsx index 8e67213..058b630 100644 --- a/src/components/Card/Content/LargeLink.tsx +++ b/src/components/Card/Content/LargeLink.tsx @@ -47,3 +47,5 @@ export const LargeLink = ({ ); }; + +LargeLink.displayName = "LargeLink"; diff --git a/src/components/Card/Content/LargeLinks.tsx b/src/components/Card/Content/LargeLinks.tsx index ffc9582..42dab63 100644 --- a/src/components/Card/Content/LargeLinks.tsx +++ b/src/components/Card/Content/LargeLinks.tsx @@ -18,3 +18,5 @@ export const LargeLinks = ({ children, className }: LargeLinksProps) => { ); }; + +LargeLinks.displayName = "LargeLinks"; diff --git a/src/components/Card/Content/Link.tsx b/src/components/Card/Content/Link.tsx index 7f05ce9..b5f8d9f 100644 --- a/src/components/Card/Content/Link.tsx +++ b/src/components/Card/Content/Link.tsx @@ -37,3 +37,5 @@ export const Link = ({ ); }; + +Link.displayName = "Link"; diff --git a/src/components/Card/Content/Tagline.tsx b/src/components/Card/Content/Tagline.tsx index c736ec7..e7af6a4 100644 --- a/src/components/Card/Content/Tagline.tsx +++ b/src/components/Card/Content/Tagline.tsx @@ -28,3 +28,5 @@ export const Tagline: React.FC = ({ ); }; + +Tagline.displayName = "Tagline"; diff --git a/src/components/Card/Content/Tiny.tsx b/src/components/Card/Content/Tiny.tsx index 311d055..72c67c4 100644 --- a/src/components/Card/Content/Tiny.tsx +++ b/src/components/Card/Content/Tiny.tsx @@ -32,3 +32,5 @@ export const Tiny = ({ ); }; + +Tiny.displayName = "Tiny"; diff --git a/src/components/Card/Content/TitleAndDescription.tsx b/src/components/Card/Content/TitleAndDescription.tsx index 3251138..1c451d5 100644 --- a/src/components/Card/Content/TitleAndDescription.tsx +++ b/src/components/Card/Content/TitleAndDescription.tsx @@ -26,7 +26,7 @@ export const TitleAndDescription = ({ {title} {description && ( -

{description} -

+ )} ); }; + +TitleAndDescription.displayName = "TitleAndDescription"; diff --git a/src/components/Card/Content/index.ts b/src/components/Card/Content/index.ts index 728727c..4b0812f 100644 --- a/src/components/Card/Content/index.ts +++ b/src/components/Card/Content/index.ts @@ -1,6 +1,6 @@ export * from "./CallToAction"; -export * from "./CardInfos"; export * from "./CardInfo"; +export * from "./CardInfos"; export * from "./Image"; export * from "./LargeLink"; export * from "./LargeLinks"; diff --git a/src/components/Card/index.ts b/src/components/Card/index.ts index 72a9b89..9378ab2 100644 --- a/src/components/Card/index.ts +++ b/src/components/Card/index.ts @@ -1,2 +1,2 @@ -export * as CardContent from "./Content"; export * from "./Card"; +export * as CardContent from "./Content"; diff --git a/src/components/Checkbox/Checkbox.stories.tsx b/src/components/Checkbox/Checkbox.stories.tsx index 371e846..1ed1119 100644 --- a/src/components/Checkbox/Checkbox.stories.tsx +++ b/src/components/Checkbox/Checkbox.stories.tsx @@ -120,7 +120,7 @@ export const NestingWithIndeterminateState: Story = { }, }; -/** If you want to use the Checkbox without it's own managed state, don't set `onChange` and simply pass `checked={value}`. */ +/** If you want to use the Checkbox without it's own managed state, set checked={undefined} and onChange={undefined}, and add `data-checked={value}` to the parent item. */ export const ManagedByAParentItem: Story = { argTypes: { onChange: { diff --git a/src/components/Checkbox/Checkbox.tsx b/src/components/Checkbox/Checkbox.tsx index 1df6fc0..7fcad5a 100644 --- a/src/components/Checkbox/Checkbox.tsx +++ b/src/components/Checkbox/Checkbox.tsx @@ -2,7 +2,8 @@ import { Checkbox as HeadlessCheckbox } from "@headlessui/react"; import { classNames } from "../../util/classes"; import { InkIcon } from "../.."; -export interface CheckboxProps { +export interface CheckboxProps + extends Omit, "onChange"> { checked?: boolean; indeterminate?: boolean; onChange?: (enabled: boolean) => void; @@ -12,6 +13,8 @@ export const Checkbox: React.FC = ({ checked, indeterminate, onChange, + className, + ...props }) => { const Component = onChange ? HeadlessCheckbox : "span"; return ( @@ -36,10 +39,12 @@ export const Checkbox: React.FC = ({ "ink:text-button-primary ink:data-checked:text-text-on-primary ink:data-indeterminate:text-text-on-primary", "ink:group-data-checked:text-text-on-primary ink:group-data-indeterminate:text-text-on-primary", "ink:group-data-selected:text-text-on-primary", - "ink:cursor-pointer" + "ink:cursor-pointer", + className )} data-checked={checked ? "true" : undefined} data-indeterminate={indeterminate ? "true" : undefined} + {...props} >
= ({ ); }; + +FieldLabel.displayName = "FieldLabel"; diff --git a/src/components/Input/Input.tsx b/src/components/Input/Input.tsx index 77c48c3..3258894 100644 --- a/src/components/Input/Input.tsx +++ b/src/components/Input/Input.tsx @@ -33,3 +33,5 @@ export const Input = forwardRef( ); } ); + +Input.displayName = "Input"; diff --git a/src/components/ListItem/ListItem.tsx b/src/components/ListItem/ListItem.tsx index 24a6aad..3fb4635 100644 --- a/src/components/ListItem/ListItem.tsx +++ b/src/components/ListItem/ListItem.tsx @@ -73,3 +73,5 @@ export const ListItem: React.FC = ({ ); }; + +ListItem.displayName = "ListItem"; diff --git a/src/components/Listbox/Listbox.tsx b/src/components/Listbox/Listbox.tsx index 2b5ccdc..c32911d 100644 --- a/src/components/Listbox/Listbox.tsx +++ b/src/components/Listbox/Listbox.tsx @@ -20,3 +20,5 @@ export const Listbox = ({ ); }; + +Listbox.displayName = "Listbox"; diff --git a/src/components/Listbox/ListboxOption.tsx b/src/components/Listbox/ListboxOption.tsx index e594371..6b06345 100644 --- a/src/components/Listbox/ListboxOption.tsx +++ b/src/components/Listbox/ListboxOption.tsx @@ -36,3 +36,5 @@ export const ListboxOption = ({ ); }; + +ListboxOption.displayName = "ListboxOption"; diff --git a/src/components/Listbox/ListboxOptions.tsx b/src/components/Listbox/ListboxOptions.tsx index bb5ba87..79a0fdb 100644 --- a/src/components/Listbox/ListboxOptions.tsx +++ b/src/components/Listbox/ListboxOptions.tsx @@ -20,3 +20,5 @@ export const ListboxOptions = ({ ); }; + +ListboxOptions.displayName = "ListboxOptions"; diff --git a/src/components/Listbox/index.ts b/src/components/Listbox/index.ts index f6568fa..c8ad441 100644 --- a/src/components/Listbox/index.ts +++ b/src/components/Listbox/index.ts @@ -1,4 +1,4 @@ export * from "./Listbox"; export * from "./ListboxButton"; -export * from "./ListboxOptions"; export * from "./ListboxOption"; +export * from "./ListboxOptions"; diff --git a/src/components/Modal/Modal.tsx b/src/components/Modal/Modal.tsx index 1a9d4c3..3092309 100644 --- a/src/components/Modal/Modal.tsx +++ b/src/components/Modal/Modal.tsx @@ -57,7 +57,7 @@ export const Modal = ({ onClose={() => handleClose()} transition className="ink:relative ink:font-default ink:text-text-default" - style={{ zIndex: 5 + modalIndex }} + style={{ zIndex: 15 + modalIndex }} > {hasBackdrop && ( ({ ); }; + +Modal.displayName = "Modal"; diff --git a/src/components/Modal/ModalContext.tsx b/src/components/Modal/ModalContext.tsx index 6b06a49..d0ca3d2 100644 --- a/src/components/Modal/ModalContext.tsx +++ b/src/components/Modal/ModalContext.tsx @@ -73,3 +73,5 @@ export const ModalProvider = ({ children }: { children: React.ReactNode }) => { ); }; + +ModalProvider.displayName = "ModalProvider"; diff --git a/src/components/Modal/index.ts b/src/components/Modal/index.ts index 730b8bd..adef1ed 100644 --- a/src/components/Modal/index.ts +++ b/src/components/Modal/index.ts @@ -1,3 +1,3 @@ -export * from "./ModalContext"; -export * from "./Modal"; export * as ModalLayout from "./Layouts"; +export * from "./Modal"; +export * from "./ModalContext"; diff --git a/src/components/Panel/Panel.tsx b/src/components/Panel/Panel.tsx index 897f7eb..47648c9 100644 --- a/src/components/Panel/Panel.tsx +++ b/src/components/Panel/Panel.tsx @@ -21,3 +21,5 @@ export const Panel: React.FC = ({ children, className }) => {
); }; + +Panel.displayName = "Panel"; diff --git a/src/components/Popover/Popover.tsx b/src/components/Popover/Popover.tsx index 2a0cdbd..beda8cf 100644 --- a/src/components/Popover/Popover.tsx +++ b/src/components/Popover/Popover.tsx @@ -15,3 +15,5 @@ export const Popover = ({ children, className }: PopoverProps) => { ); }; + +Popover.displayName = "Popover"; diff --git a/src/components/Popover/PopoverButton.tsx b/src/components/Popover/PopoverButton.tsx index 0321c01..600ce6e 100644 --- a/src/components/Popover/PopoverButton.tsx +++ b/src/components/Popover/PopoverButton.tsx @@ -28,3 +28,5 @@ export const PopoverButton: React.FC = ({ /> ); }; + +PopoverButton.displayName = "PopoverButton"; diff --git a/src/components/Popover/PopoverPanel.tsx b/src/components/Popover/PopoverPanel.tsx index 04a9a3b..24c045e 100644 --- a/src/components/Popover/PopoverPanel.tsx +++ b/src/components/Popover/PopoverPanel.tsx @@ -27,3 +27,5 @@ export const PopoverPanel: React.FC = ({ ); }; + +PopoverPanel.displayName = "PopoverPanel"; diff --git a/src/components/Radio/Radio.tsx b/src/components/Radio/Radio.tsx index 0b0282d..fa1127c 100644 --- a/src/components/Radio/Radio.tsx +++ b/src/components/Radio/Radio.tsx @@ -26,3 +26,5 @@ export const Radio: React.FC = ({ value, asChild }) => { ); }; + +Radio.displayName = "Radio"; diff --git a/src/components/Radio/RadioGroup.tsx b/src/components/Radio/RadioGroup.tsx index 3b3ce85..02a92ab 100644 --- a/src/components/Radio/RadioGroup.tsx +++ b/src/components/Radio/RadioGroup.tsx @@ -21,3 +21,5 @@ export const RadioGroup: React.FC = ({ ); }; + +RadioGroup.displayName = "RadioGroup"; diff --git a/src/components/Radio/RadioLabel.tsx b/src/components/Radio/RadioLabel.tsx index c6ba2cf..652015e 100644 --- a/src/components/Radio/RadioLabel.tsx +++ b/src/components/Radio/RadioLabel.tsx @@ -5,3 +5,5 @@ export interface RadioLabelProps extends FieldLabelProps {} export const RadioLabel: React.FC = (props) => { return ; }; + +RadioLabel.displayName = "RadioLabel"; diff --git a/src/components/SegmentedControl/SegmentedControl.tsx b/src/components/SegmentedControl/SegmentedControl.tsx index 7eabce0..d9bc87c 100644 --- a/src/components/SegmentedControl/SegmentedControl.tsx +++ b/src/components/SegmentedControl/SegmentedControl.tsx @@ -131,3 +131,5 @@ export const SegmentedControl = ({ ); }; + +SegmentedControl.displayName = "SegmentedControl"; diff --git a/src/components/Tag/Tag.tsx b/src/components/Tag/Tag.tsx index 06543ab..7b94f6c 100644 --- a/src/components/Tag/Tag.tsx +++ b/src/components/Tag/Tag.tsx @@ -46,30 +46,31 @@ export interface TagProps icon?: React.ReactNode; } -export const Tag = React.forwardRef( - ({ className, variant, selected, icon, children, ...props }, ref) => { - return ( -
- {icon && ( -
- {icon} -
- )} - {children} -
- ); - } -); +export const Tag = React.forwardRef(function Tag( + { className, variant, selected, icon, children, ...props }, + ref +) { + return ( +
+ {icon && ( +
+ {icon} +
+ )} + {children} +
+ ); +}); Tag.displayName = "Tag"; diff --git a/src/components/Toggle/Toggle.tsx b/src/components/Toggle/Toggle.tsx index 1561792..343131f 100644 --- a/src/components/Toggle/Toggle.tsx +++ b/src/components/Toggle/Toggle.tsx @@ -40,3 +40,5 @@ export const Toggle: React.FC = ({ checked, onChange }) => { ); }; + +Toggle.displayName = "Toggle"; diff --git a/src/components/Typography/Typography.tsx b/src/components/Typography/Typography.tsx index 0d722e3..21dcfbb 100644 --- a/src/components/Typography/Typography.tsx +++ b/src/components/Typography/Typography.tsx @@ -68,3 +68,5 @@ export const Typography: React.FC = ({ ); }; + +Typography.displayName = "Typography"; diff --git a/src/components/Wallet/ConnectWallet.tsx b/src/components/Wallet/ConnectWallet.tsx index 74c0a7a..28955a9 100644 --- a/src/components/Wallet/ConnectWallet.tsx +++ b/src/components/Wallet/ConnectWallet.tsx @@ -167,3 +167,5 @@ const ConnectedWalletSection = ({ ); }; + +ConnectWallet.displayName = "ConnectWallet"; diff --git a/src/components/index.ts b/src/components/index.ts index 26a8a43..9f4617e 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -3,8 +3,8 @@ export * from "./Button"; export * from "./Card"; export * from "./Checkbox"; export * from "./Input"; -export * from "./ListItem"; export * from "./Listbox"; +export * from "./ListItem"; export * from "./Modal"; export * from "./Popover"; export * from "./SegmentedControl"; diff --git a/src/icons/ArrowDiagonal.svg b/src/icons/ArrowDiagonal.svg new file mode 100644 index 0000000..6774377 --- /dev/null +++ b/src/icons/ArrowDiagonal.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/Calendar.svg b/src/icons/Calendar.svg new file mode 100644 index 0000000..dc89986 --- /dev/null +++ b/src/icons/Calendar.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/Filter.svg b/src/icons/Filter.svg new file mode 100644 index 0000000..58afb76 --- /dev/null +++ b/src/icons/Filter.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/Location.svg b/src/icons/Location.svg new file mode 100644 index 0000000..e1f0641 --- /dev/null +++ b/src/icons/Location.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/PlusSmall.svg b/src/icons/PlusSmall.svg new file mode 100644 index 0000000..0ad1095 --- /dev/null +++ b/src/icons/PlusSmall.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/Power.svg b/src/icons/Power.svg new file mode 100644 index 0000000..2ecf9a4 --- /dev/null +++ b/src/icons/Power.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/index.ts b/src/icons/index.ts index 4d8c3bd..8b9d41e 100644 --- a/src/icons/index.ts +++ b/src/icons/index.ts @@ -4,7 +4,9 @@ export { default as Apps } from "./Apps.svg?react"; export { default as Arrow } from "./Arrow.svg?react"; +export { default as ArrowDiagonal } from "./ArrowDiagonal.svg?react"; export { default as Bridge } from "./Bridge.svg?react"; +export { default as Calendar } from "./Calendar.svg?react"; export { default as Check } from "./Check.svg?react"; export { default as CheckBadge } from "./CheckBadge.svg?react"; export { default as CheckFill } from "./CheckFill.svg?react"; @@ -17,24 +19,28 @@ export { default as Deposit } from "./Deposit.svg?react"; export { default as Disconnect } from "./Disconnect.svg?react"; export { default as Dots } from "./Dots.svg?react"; export { default as Error } from "./Error.svg?react"; +export { default as Filter } from "./Filter.svg?react"; export { default as History } from "./History.svg?react"; export { default as Home } from "./Home.svg?react"; export { default as Info } from "./Info.svg?react"; export { default as InkLogo } from "./InkLogo.svg?react"; export { default as Loading } from "./Loading.svg?react"; +export { default as Location } from "./Location.svg?react"; +export * as Logo from "./Logo/index.ts"; export { default as Mail } from "./Mail.svg?react"; export { default as Menu } from "./Menu.svg?react"; export { default as Minus } from "./Minus.svg?react"; export { default as Moon } from "./Moon.svg?react"; +export * as Page from "./Page/index.ts"; export { default as Panel } from "./Panel.svg?react"; export { default as Plus } from "./Plus.svg?react"; +export { default as PlusSmall } from "./PlusSmall.svg?react"; +export { default as Power } from "./Power.svg?react"; export { default as Profile } from "./Profile.svg?react"; export { default as Search } from "./Search.svg?react"; export { default as Settings } from "./Settings.svg?react"; +export * as Social from "./Social/index.ts"; export { default as Sun } from "./Sun.svg?react"; export { default as Swap } from "./Swap.svg?react"; export { default as Users } from "./Users.svg?react"; export { default as Wallet } from "./Wallet.svg?react"; -export * as Logo from "./Logo/index.ts"; -export * as Page from "./Page/index.ts"; -export * as Social from "./Social/index.ts"; diff --git a/src/index.ts b/src/index.ts index a521ede..786cd7a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ import "./tailwind.css"; + export * from "./components"; -export * from "./layout"; export * from "./hooks"; export * as InkIcon from "./icons"; +export * from "./layout"; diff --git a/src/layout/ForStories/ExampleLayoutLinks.tsx b/src/layout/ForStories/ExampleLayoutLinks.tsx index 246923a..a24bd82 100644 --- a/src/layout/ForStories/ExampleLayoutLinks.tsx +++ b/src/layout/ForStories/ExampleLayoutLinks.tsx @@ -5,13 +5,14 @@ export const EXAMPLE_LINKS: InkLayoutLink[] = [ { children: "Home", href: "#home", - icon: , + leftIcon: , target: "_self", + active: true, }, { children: "Settings", href: "#settings", - icon: , + leftIcon: , target: "_self", }, ]; diff --git a/src/layout/ForStories/ExampleSideNav.tsx b/src/layout/ForStories/ExampleSideNav.tsx index cf0f1bc..1920abb 100644 --- a/src/layout/ForStories/ExampleSideNav.tsx +++ b/src/layout/ForStories/ExampleSideNav.tsx @@ -1,4 +1,4 @@ -import { InkLayoutSideNav } from "../InkLayout"; +import { InkLayoutSideNav } from "../InkLayout/InkLayoutSideNav"; import { EXAMPLE_LINKS } from "./ExampleLayoutLinks"; export const ExampleSideNav = () => { diff --git a/src/layout/ForStories/ExampleTopNav.tsx b/src/layout/ForStories/ExampleTopNav.tsx index 350609d..9afe6ff 100644 --- a/src/layout/ForStories/ExampleTopNav.tsx +++ b/src/layout/ForStories/ExampleTopNav.tsx @@ -1,4 +1,4 @@ -import { SegmentedControl } from "../../components"; +import { SegmentedControl } from "../../components/SegmentedControl"; export const ExampleTopNav = () => { return ( diff --git a/src/layout/InkLayout/InkLayout.stories.tsx b/src/layout/InkLayout/InkLayout.stories.tsx index 838f116..4001531 100644 --- a/src/layout/InkLayout/InkLayout.stories.tsx +++ b/src/layout/InkLayout/InkLayout.stories.tsx @@ -52,14 +52,15 @@ export const SideNavWithCustomButtons: Story = { { children: Home, href: "#home", - icon: , + leftIcon: , target: "_self", asChild: true, + active: true, }, { children: Settings, href: "#settings", - icon: , + leftIcon: , target: "_self", asChild: true, }, diff --git a/src/layout/InkLayout/InkLayout.tsx b/src/layout/InkLayout/InkLayout.tsx index 68322fa..b61e2b5 100644 --- a/src/layout/InkLayout/InkLayout.tsx +++ b/src/layout/InkLayout/InkLayout.tsx @@ -121,3 +121,5 @@ const InkLayoutContent = ({ ); }; + +InkLayout.displayName = "InkLayout"; diff --git a/src/layout/InkLayout/InkLayoutContext.tsx b/src/layout/InkLayout/InkLayoutContext.tsx index 50c38cf..0344998 100644 --- a/src/layout/InkLayout/InkLayoutContext.tsx +++ b/src/layout/InkLayout/InkLayoutContext.tsx @@ -31,3 +31,5 @@ export const InkLayoutProvider = ({ ); }; + +InkLayoutProvider.displayName = "InkLayoutProvider"; diff --git a/src/layout/InkLayout/InkLayoutSideNav.tsx b/src/layout/InkLayout/InkLayoutSideNav.tsx index 5df086e..23cb9fe 100644 --- a/src/layout/InkLayout/InkLayoutSideNav.tsx +++ b/src/layout/InkLayout/InkLayoutSideNav.tsx @@ -13,8 +13,8 @@ export const InkLayoutSideNav: React.FC = ({ return ( ); }; + +InkLayoutSideNav.displayName = "InkLayoutSideNav"; diff --git a/src/layout/InkLayout/InkNavLink.tsx b/src/layout/InkLayout/InkNavLink.tsx index 40b12d9..2cc3587 100644 --- a/src/layout/InkLayout/InkNavLink.tsx +++ b/src/layout/InkLayout/InkNavLink.tsx @@ -1,39 +1,58 @@ import React from "react"; -import { classNames } from "../../util/classes"; +import { classNames, variantClassNames } from "../../util/classes"; import { Slot, Slottable } from "../../components/Slot"; export interface InkLayoutLink extends React.ComponentPropsWithoutRef<"a"> { children: React.ReactNode; onClick?: React.MouseEventHandler; href?: string; - icon?: React.ReactNode; + leftIcon?: React.ReactNode; + rightIcon?: React.ReactNode; target?: StringWithAutocomplete<"_blank" | "_self">; asChild?: boolean; active?: boolean; } -export interface InkNavLinkProps extends InkLayoutLink {} +export interface InkNavLinkProps extends InkLayoutLink { + variant?: "default" | "mobile"; +} export const InkNavLink: React.FC = ({ href, - icon, + leftIcon, + rightIcon, children, className = "", asChild, onClick, active, + variant = "default", ...props }) => { const Component = asChild ? Slot : "a"; + const iconClasses = classNames( + variantClassNames(variant, { + default: "ink:size-3 ink:p-0.5", + mobile: "ink:size-3", + }) + ); + return ( = ({ {(child) => ( <> - {icon &&
{icon}
} - {child} + {leftIcon &&
{leftIcon}
} +
+ {child} + {rightIcon &&
{rightIcon}
} +
)}
); }; + +InkNavLink.displayName = "InkNavLink"; diff --git a/src/layout/InkLayout/MobileNav/InkLayoutMobileNav.tsx b/src/layout/InkLayout/MobileNav/InkLayoutMobileNav.tsx index bbf44d7..3793e24 100644 --- a/src/layout/InkLayout/MobileNav/InkLayoutMobileNav.tsx +++ b/src/layout/InkLayout/MobileNav/InkLayoutMobileNav.tsx @@ -1,5 +1,6 @@ import React from "react"; import { InkLayoutLink, InkNavLink } from "../InkNavLink"; +import { InkIcon } from "../../.."; export interface InkLayoutMobileNavProps { links: InkLayoutLink[]; @@ -16,7 +17,21 @@ export const InkLayoutMobileNav: React.FC = ({ ); }; + +InkLayoutMobileNav.displayName = "InkLayoutMobileNav"; diff --git a/src/layout/InkLayout/index.ts b/src/layout/InkLayout/index.ts index 38e1484..638b64d 100644 --- a/src/layout/InkLayout/index.ts +++ b/src/layout/InkLayout/index.ts @@ -1,5 +1,5 @@ export * from "./InkLayout"; +export { useInkLayoutContext } from "./InkLayoutContext"; export * from "./InkLayoutSideNav"; export * from "./InkNavLink"; export * from "./MobileNav"; -export { useInkLayoutContext } from "./InkLayoutContext"; diff --git a/src/layout/InkParts/InkHeader.tsx b/src/layout/InkParts/InkHeader.tsx index 7608d80..8ec3f3b 100644 --- a/src/layout/InkParts/InkHeader.tsx +++ b/src/layout/InkParts/InkHeader.tsx @@ -24,3 +24,5 @@ export const InkHeader: React.FC = ({ ); }; + +InkHeader.displayName = "InkHeader"; diff --git a/src/layout/InkParts/InkPageLayout.tsx b/src/layout/InkParts/InkPageLayout.tsx index 8ed4877..241ce76 100644 --- a/src/layout/InkParts/InkPageLayout.tsx +++ b/src/layout/InkParts/InkPageLayout.tsx @@ -25,3 +25,5 @@ export const InkPageLayout: React.FC = ({ ); }; + +InkPageLayout.displayName = "InkPageLayout"; diff --git a/src/layout/InkParts/InkPanel.tsx b/src/layout/InkParts/InkPanel.tsx index 35252bb..dd3bafd 100644 --- a/src/layout/InkParts/InkPanel.tsx +++ b/src/layout/InkParts/InkPanel.tsx @@ -39,3 +39,5 @@ export const InkPanel = forwardRef( ); } ); + +InkPanel.displayName = "InkPanel";