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

feat(v3): Let there be ark #8393

Merged
merged 40 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e3a5df0
chore: init
segunadebayo Mar 28, 2024
d3fc07e
feat: implement file upload component from ark
segunadebayo Mar 28, 2024
83e57de
perf: replace split props
segunadebayo Mar 28, 2024
16d30af
fix: split props
segunadebayo Mar 28, 2024
a4b15af
fix: tsconfig + eslint parser
segunadebayo Mar 28, 2024
7458a03
chore: prefer empty slot styles
segunadebayo Mar 28, 2024
f3483ec
refactor: tokens and text styles
segunadebayo Mar 28, 2024
08b303b
refactor: replace popover, tooltip and add hovercard
segunadebayo Mar 30, 2024
11361ec
chore: add use client
segunadebayo Mar 30, 2024
d5e197a
chore: export styles
segunadebayo Mar 30, 2024
1a7f029
test: prefer tests from ark
segunadebayo Mar 30, 2024
9bb1a17
refactor: file upload to recipe
segunadebayo Mar 30, 2024
6094f18
refactor: use ark anatomy
segunadebayo Mar 30, 2024
4654439
docs: add changeset
segunadebayo Mar 30, 2024
dd03062
chore: rm framer-motion example
segunadebayo Mar 30, 2024
1d07be0
refactor: env
segunadebayo Mar 30, 2024
904f76d
refactor: dialog and drawer to use ark
segunadebayo Mar 30, 2024
f291131
fix(v3): update Button migration guide (#8397)
isBatak Mar 30, 2024
5dabf58
chore: update box components
segunadebayo Mar 30, 2024
ecae71d
chore: resolve conflict
segunadebayo Mar 30, 2024
a10ade6
refactor: slider and range-slider -> ark
segunadebayo Apr 1, 2024
e75ef2f
refactor: tsconfig and files
segunadebayo May 7, 2024
53e64ee
fix(deps): update dependency framer-motion to v11.0.25 (#8401)
renovate[bot] Apr 6, 2024
082147f
chore: update
segunadebayo May 7, 2024
cc8c4bc
refactor: accordion
segunadebayo May 7, 2024
9bc6b1a
refactor: menu component
segunadebayo May 8, 2024
ba19156
refactor: use pandacss valid prop
segunadebayo May 8, 2024
7efe55b
ci: update actions
segunadebayo May 8, 2024
d8bf891
refactor: test utils
segunadebayo May 8, 2024
20945cf
refactor: vitest -> vite
segunadebayo May 8, 2024
8fa6106
refactor: as child + ark
segunadebayo May 8, 2024
f479e6e
fix: examples and website
segunadebayo May 8, 2024
e77c88f
feat: rm framer-motion
segunadebayo May 8, 2024
81acef5
chore: pin ark versions
segunadebayo May 8, 2024
7d143fa
chore: update popover z-index
segunadebayo May 8, 2024
44e388a
chore(deps): update react monorepo (#8472)
renovate[bot] May 8, 2024
06a6980
fix(deps): update commitlint monorepo (#8441)
renovate[bot] May 8, 2024
3660f9f
Merge remote-tracking branch 'origin' into ark
segunadebayo May 9, 2024
ce2f2f1
chore: update menu stories
segunadebayo May 9, 2024
747f608
chore: update slider example
segunadebayo May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .changeset/many-lamps-provide.md
@@ -0,0 +1,8 @@
---
"@chakra-ui/react": minor
---

- Integrate Ark UI components to reduce maintenance surface.
- Add `FileUpload` component
- Remove `trigger=hover` in favor of `HoverCard`
- Replace `Tooltip`, `Popover` and `HoverCard` with those from Ark UI
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: segunadebayo
patreon: segunadebayo
open_collective: chakra-ui
ko_fi: # Replace with a single Ko-fi username
Expand Down
2 changes: 1 addition & 1 deletion .github/composite-actions/install/action.yml
Expand Up @@ -7,7 +7,7 @@ runs:
- name: Install dependencies
uses: pnpm/action-setup@v2.2.4
with:
version: 8
version: 9

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
5 changes: 0 additions & 5 deletions .github/sync.yml

This file was deleted.

6 changes: 2 additions & 4 deletions .storybook/main.ts
Expand Up @@ -9,13 +9,11 @@ const config: StorybookConfig = {
],
framework: {
name: "@storybook/react-vite",
options: {},
},
features: {
buildStoriesJson: true,
options: { builder: {} },
},
core: {
disableTelemetry: true,
disableProjectJson: true,
},
typescript: {
reactDocgen: false,
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
@@ -1,5 +1,5 @@
import { withThemeByClassName } from "@storybook/addon-themes"
import { Preview, ReactRenderer } from "@storybook/react"
import type { Preview, ReactRenderer } from "@storybook/react"
import React from "react"
import { ChakraProvider, defaultSystem } from "../packages/react/src"

Expand Down
23 changes: 22 additions & 1 deletion MIGRATION.md
Expand Up @@ -83,7 +83,8 @@ Renamed all `container` parts to `root`. Kindly update your theme to reflect
### Removed Components and Packages

- Removed `ControlBox` component
- Removed `@chakra-ui/icons` package. Prefer to use [`lucide-react`](https://lucide.dev/guide/packages/lucide-react) or
- Removed `@chakra-ui/icons` package. Prefer to use
[`lucide-react`](https://lucide.dev/guide/packages/lucide-react) or
`react-icons` instead.

### Root component and types
Expand Down Expand Up @@ -391,6 +392,16 @@ After:
- Removed `containerProps` in favor of rendering the `Dialog.Positioner`
component to better control this element.
- Renamed `ModalOverlay` to `Dialog.Backdrop`
- Renamed `initialFocusRef` to `initialFocusEl` which is now a function that
returns the element to focus on
- Renamed `finalFocusRef` to `finalFocusEl` which is now a function that returns
the element to focus on
- Renamed `returnFocusOnClose` to `restoreFocus`
- Renamed `blockScrollOnMount` to `preventScroll`
- Removed `preserveScrollBarGap` and `allowPinZoom`
- `onOpen` and `onClose` -> `onOpenChange`
- Now requires an explicit `Portal` component to render the dialog outside the
DOM tree

Before:

Expand Down Expand Up @@ -426,6 +437,8 @@ After:

- Same changes as `Dialog` above
- Renamed `DrawerOverlay` to `Drawer.Backdrop`
- Removed `isFullHeight` in favor of setting `height=100dvh` on the content
directly.

### Alert Dialog

Expand Down Expand Up @@ -1125,3 +1138,11 @@ toast({

- Now requires the `Slider.Control` to work properly
- Added new `Slider.ValueText` and `Slider.Label` components

### Environment

- Rename `EnvironmentProvider` to `Environment`
- Rename `useEnvironment` to `useEnvironmentContext`
- Environment is no longer automatically provided by `ChakraProvider`. You must
wrap your app in `Environment` to use it and provide the `getRootNode`
function
1 change: 0 additions & 1 deletion examples/next-app/package.json
Expand Up @@ -15,7 +15,6 @@
"@types/node": "^20.11.30",
"@types/react": "^18.2.72",
"@types/react-dom": "^18.2.22",
"framer-motion": "^11.0.22",
"next": "^14.1.4",
"next-themes": "^0.3.0",
"lucide-react": "^0.363.0",
Expand Down
4 changes: 3 additions & 1 deletion examples/next-app/tsconfig.json
Expand Up @@ -21,7 +21,9 @@
"customConditions": ["source"],
"plugins": [{ "name": "next" }],
"paths": {
"@chakra-ui/react": ["../../packages/react/src"]
"@chakra-ui/react": ["../../packages/react/src"],
"@chakra-ui/hooks": ["../../packages/hooks/src"],
"@chakra-ui/utils": ["../../packages/utils/src"]
}
},
"exclude": ["node_modules"],
Expand Down
1 change: 0 additions & 1 deletion examples/next-pages/package.json
Expand Up @@ -15,7 +15,6 @@
"@types/node": "^20.11.30",
"@types/react": "^18.2.72",
"@types/react-dom": "^18.2.22",
"framer-motion": "^11.0.22",
"next": "^14.1.4",
"next-themes": "^0.3.0",
"lucide-react": "^0.363.0",
Expand Down
4 changes: 3 additions & 1 deletion examples/next-pages/tsconfig.json
Expand Up @@ -20,7 +20,9 @@
"incremental": true,
"customConditions": ["source"],
"paths": {
"@chakra-ui/react": ["../../packages/react/src"]
"@chakra-ui/react": ["../../packages/react/src"],
"@chakra-ui/hooks": ["../../packages/hooks/src"],
"@chakra-ui/utils": ["../../packages/utils/src"]
}
},
"exclude": ["node_modules"],
Expand Down
7 changes: 6 additions & 1 deletion examples/vite-ts/vite.config.ts
@@ -1,10 +1,15 @@
import react from "@vitejs/plugin-react"
import { resolve } from "path"
import { defineConfig } from "vite"

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
conditions: ["source"],
alias: {
"@chakra-ui/utils": resolve("..", "..", "packages/utils/src"),
"@chakra-ui/react": resolve("..", "..", "packages/react/src"),
"@chakra-ui/hooks": resolve("..", "..", "packages/hooks/src"),
},
},
})
80 changes: 41 additions & 39 deletions package.json
Expand Up @@ -13,6 +13,7 @@
"clean:emotion-types": "rimraf node_modules/@emotion/core/types",
"postinstall": "pnpm clean:emotion-types",
"build:tokens": "chakra-cli tokens packages/react/src/preset.ts",
"build:tokens-dev": "cross-env LOCAL=1 chakra-cli tokens packages/react/src/preset.ts",
"build:prop-docs": "pnpm typedocs && pnpm --filter=*props-docs build",
"build": "pnpm --filter=./packages/* build",
"build:fast": "pnpm --filter=./packages/* build:fast",
Expand Down Expand Up @@ -41,10 +42,9 @@
},
"version": "2.0.0",
"dependencies": {
"@babel/core": "^7.24.3",
"@babel/eslint-parser": "^7.24.1",
"@babel/core": "7.24.3",
"@babel/eslint-parser": "7.24.1",
"@chakra-ui/cli": "workspace:*",
"@chakra-ui/test-utils": "workspace:*",
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.1",
"@changesets/get-release-plan": "4.0.0",
Expand All @@ -55,23 +55,25 @@
"@rollup/plugin-alias": "5.1.0",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-replace": "5.0.5",
"@storybook/addon-a11y": "^8.0.4",
"@storybook/addon-essentials": "^8.0.4",
"@storybook/addon-themes": "^8.0.4",
"@storybook/cli": "^8.0.4",
"@storybook/manager-api": "^8.0.4",
"@storybook/react": "^8.0.4",
"@storybook/react-vite": "^8.0.4",
"@storybook/theming": "^8.0.4",
"@testing-library/jest-dom": "^6.4.2",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/edit-json-file": "^1.7.3",
"@storybook/addon-a11y": "8.0.4",
"@storybook/addon-essentials": "8.0.4",
"@storybook/addon-themes": "8.0.4",
"@storybook/cli": "8.0.4",
"@storybook/manager-api": "8.0.4",
"@storybook/react": "8.0.4",
"@storybook/react-vite": "8.0.4",
"@storybook/theming": "8.0.4",
"@testing-library/jest-dom": "6.4.2",
"@testing-library/react": "14.2.2",
"@testing-library/user-event": "14.5.2",
"@trivago/prettier-plugin-sort-imports": "4.3.0",
"@types/edit-json-file": "1.7.3",
"@types/execa": "2.0.0",
"@types/fs-extra": "11.0.4",
"@types/mkdirp": "1.0.2",
"@types/node": "^20.11.30",
"@types/react": "^18.2.72",
"@types/react-dom": "^18.2.22",
"@types/node": "20.11.30",
"@types/react": "18.2.72",
"@types/react-dom": "18.2.22",
"@types/testing-library__jest-dom": "5.14.9",
"@typescript-eslint/eslint-plugin": "7.4.0",
"@typescript-eslint/parser": "7.4.0",
Expand All @@ -89,36 +91,36 @@
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-testing-library": "6.2.0",
"execa": "8.0.1",
"fast-glob": "^3.3.2",
"fast-glob": "3.3.2",
"find-packages": "10.0.4",
"find-up": "^7.0.0",
"find-up": "7.0.0",
"fs-extra": "11.2.0",
"husky": "^9.0.11",
"jsdom": "^24.0.0",
"husky": "9.0.11",
"jsdom": "24.0.0",
"lint-staged": "15.2.2",
"node-fetch": "3.3.2",
"npm-run-all": "^4.1.5",
"outdent": "^0.8.0",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"npm-run-all": "4.1.5",
"outdent": "0.8.0",
"prettier": "3.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"rimraf": "5.0.5",
"rollup": "^4.13.0",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-preserve-directives": "^0.4.0",
"storybook": "^8.0.4",
"tsup": "^8.0.2",
"tsx": "^4.7.1",
"typescript": "^5.4.3",
"vite": "^5.2.6",
"vitest": "^1.4.0",
"vitest-axe": "^0.1.0",
"vitest-matchmedia-mock": "^1.0.4"
"rollup": "4.13.0",
"rollup-plugin-esbuild": "6.1.1",
"rollup-plugin-preserve-directives": "0.4.0",
"storybook": "8.0.4",
"tsup": "8.0.2",
"tsx": "4.7.1",
"typescript": "5.4.3",
"vite": "5.2.6",
"vitest": "1.4.0",
"vitest-axe": "0.1.0",
"vitest-matchmedia-mock": "1.0.4"
},
"pnpm": {
"overrides": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"prism-react-renderer": "2.3.1"
}
},
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Expand Up @@ -44,6 +44,7 @@
"typecheck": " tsc --noEmit"
},
"dependencies": {
"@pandacss/is-valid-prop": "0.39.1",
"@clack/prompts": "0.7.0",
"bundle-n-require": "1.1.1",
"chokidar": "3.6.0",
Expand Down
44 changes: 35 additions & 9 deletions packages/cli/src/generate-prop-types.ts
@@ -1,4 +1,4 @@
import { SystemContext } from "@chakra-ui/react"
import type { SystemContext } from "@chakra-ui/react"
import { pretty } from "./shared.js"

export async function generatePropTypes(sys: SystemContext, strict = false) {
Expand All @@ -8,10 +8,29 @@ export async function generatePropTypes(sys: SystemContext, strict = false) {
`
import type { ConditionalValue, CssProperties } from "../css.types"
import type { Tokens } from "./token.gen"

interface PropertyValueTypes {`,

type AnyString = (string & {})
`,
]

if (strict) {
result.push(`
type WithColorOpacityModifier<T> = T extends string ? \`$\{T}/\${string}\` : T

type ImportantMark = "!" | "!important"
type WhitespaceImportant = \` \${ImportantMark}\`
type Important = ImportantMark | WhitespaceImportant

type WithImportant<T> = T extends string ? \`\${T}\${Important}\` & { __important?: true } : T;
type WithEscapeHatch<T> = T | \`[\${string}]\` | WithColorOpacityModifier<T> | WithImportant<T>
`)
}

result.push(`

interface PropertyValueTypes {
`)

const types = utility.getTypes()

for (const [prop, values] of types.entries()) {
Expand All @@ -20,10 +39,17 @@ export async function generatePropTypes(sys: SystemContext, strict = false) {

result.push("}", "\n")

result.push(`
if (strict) {
result.push(`
// eslint-disable-next-line
type PropOrCondition<Key, Value> = ConditionalValue<Value | (string & {})>
`)
type PropOrCondition<Value> = ConditionalValue<WithEscapeHatch<Value>>
`)
} else {
result.push(`
// eslint-disable-next-line
type PropOrCondition<Value> = ConditionalValue<Value | AnyString>
`)
}

result.push(`
type CssValue<T> = T extends keyof CssProperties ? CssProperties[T] : never
Expand All @@ -43,18 +69,18 @@ export async function generatePropTypes(sys: SystemContext, strict = false) {

result.push(`
type PropertyTypeValue<T extends string> = T extends keyof PropertyTypes
? PropOrCondition<T, PropertyTypes[T] | CssValue<T>>
? PropOrCondition<PropertyTypes[T] | CssValue<T>>
: never;

type CssPropertyValue<T extends string> = T extends keyof CssProperties
? PropOrCondition<T, CssProperties[T]>
? PropOrCondition<CssProperties[T]>
: never;

export type PropertyValue<T extends string> = T extends keyof PropertyTypes
? PropertyTypeValue<T>
: T extends keyof CssProperties
? CssPropertyValue<T>
: PropOrCondition<T, string | number>
: PropOrCondition<string | number>
`)

return pretty(result.join("\n"))
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/generate-system-types.ts
@@ -1,5 +1,5 @@
import type { SystemContext } from "@chakra-ui/react"
import { allCssProperties } from "@chakra-ui/react"
import { allCssProperties } from "@pandacss/is-valid-prop"
import { pretty } from "./shared.js"

export async function generateSystemTypes(sys: SystemContext) {
Expand All @@ -8,9 +8,9 @@ export async function generateSystemTypes(sys: SystemContext) {
)

const result = `
import { ConditionalValue } from "../css.types"
import { PropertyValue } from "./prop-types.gen"
import { Token } from "./token.gen"
import type { ConditionalValue } from "../css.types"
import type { PropertyValue } from "./prop-types.gen"
import type { Token } from "./token.gen"

export type CssVarProperties = {
[key in \`--\${string}\`]?: ConditionalValue<Token | (string & {}) | (number & {})>
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/generate-tokens.ts
@@ -1,4 +1,4 @@
import { SystemContext } from "@chakra-ui/react"
import type { SystemContext } from "@chakra-ui/react"
import { capitalize, pretty, unionType } from "./shared.js"

export async function generateTokens(sys: SystemContext) {
Expand Down