Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(website): add architecture diagram #3388

Merged
merged 3 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"packages/react": {
"name": "@ark-ui/react",
"version": "5.0.0",
"version": "5.0.1",
"dependencies": {
"@internationalized/date": "3.7.0",
"@zag-js/accordion": "1.3.3",
Expand Down Expand Up @@ -115,7 +115,7 @@
},
"packages/solid": {
"name": "@ark-ui/solid",
"version": "5.0.0",
"version": "5.1.0",
"dependencies": {
"@internationalized/date": "3.7.0",
"@zag-js/accordion": "1.3.3",
Expand Down Expand Up @@ -246,7 +246,7 @@
},
"packages/vue": {
"name": "@ark-ui/vue",
"version": "5.0.2",
"version": "5.1.0",
"dependencies": {
"@internationalized/date": "3.7.0",
"@zag-js/accordion": "1.3.3",
Expand Down
4 changes: 4 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ description: All notable changes will be documented in this file.

## [Unreleased]

### Added

- Added support for clean up function in `ref`.

## [5.0.1] - 2025-03-11

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/tooltip/examples/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Tooltip } from '@ark-ui/react/tooltip'

export const Basic = () => (
<Tooltip.Root>
<Tooltip.Trigger disabled>Hover Me</Tooltip.Trigger>
<Tooltip.Trigger>Hover Me</Tooltip.Trigger>
<Tooltip.Positioner>
<Tooltip.Content>I am a tooltip!</Tooltip.Content>
</Tooltip.Positioner>
Expand Down
29 changes: 20 additions & 9 deletions packages/react/src/utils/compose-refs.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
type PossibleRef<T> = React.Ref<T | null> | undefined
import type { Ref } from 'react'

function setRef<T>(ref: PossibleRef<T>, value: T) {
if (typeof ref === 'function') {
ref(value)
} else if (ref !== null && ref !== undefined) {
;(ref as React.MutableRefObject<T>).current = value
}
}
type PossibleRef<T> = Ref<T | null> | undefined

export function composeRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void {
return (node) => {
const cleanUps: VoidFunction[] = []

for (const ref of refs) {
setRef(ref, node)
if (typeof ref === 'function') {
const cb = ref(node)
if (typeof cb === 'function') {
cleanUps.push(cb)
}
} else if (ref) {
ref.current = node
}
}

if (cleanUps.length) {
return () => {
for (const cleanUp of cleanUps) {
cleanUp()
}
}
}
}
}
2 changes: 2 additions & 0 deletions website/public/static/architecture_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions website/public/static/architecture_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions website/src/components/theme-image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Image, { type ImageProps } from 'next/image'
import { Box } from 'styled-system/jsx'

interface Props extends Omit<ImageProps, 'src' | 'priority' | 'loading'> {
srcLight: string
srcDark: string
}

export const ThemeImage = (props: Props) => {
const { srcLight, srcDark, ...rest } = props

return (
<>
<Box display={{ _light: 'block', _dark: 'none' }}>
<Image {...rest} src={srcLight} />
</Box>
<Box display={{ _light: 'none', _dark: 'block' }}>
<Image {...rest} src={srcDark} />
</Box>
</>
)
}
10 changes: 10 additions & 0 deletions website/src/content/pages/overview/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ The goal of Ark UI is to provide a comprehensive selection of components for imp
accessible UI components across a wide range of JavaScript frameworks. Building a company-wide design system or a
component library for a client has never been more straightforward.

## Architecture

<ThemeImage
srcLight="/static/architecture_light.svg"
srcDark="/static/architecture_dark.svg"
alt="Shows the highlevel architecture"
width="720"
height="588"
/>

## FAQ

<Faq />
2 changes: 2 additions & 0 deletions website/src/mdx-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Quickstart } from './components/quickstart'
import { Story } from './components/story'

import { Step, Steps } from '~/components/ui/stepper'
import { ThemeImage } from './components/theme-image'

const sharedComponents = {
a: Link,
Expand All @@ -31,6 +32,7 @@ const sharedComponents = {
Step,
Steps,
Story,
ThemeImage,
}

const useMDXComponent = (code: string) => {
Expand Down
Loading