Compare commits

...

520 Commits

Author SHA1 Message Date
github-actions[bot] 2f87b8d644 ci(changesets): version packages (#1924)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-11-08 11:29:59 -03:00
Junior Garcia 6ecdc278ab fix(system): extend variants fuction adapted (#1927) 2023-11-08 11:15:10 -03:00
Junior Garcia 9189b3fbf2 fix(textarea): styles issues and start/end content props added (#1923)
* fix(textarea): styles issues and start/end content props added

* chore(textarea): multiple rows prop renamed
2023-11-08 10:33:00 -03:00
github-actions[bot] 1149345cae ci(changesets): version packages (#1916)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-11-07 10:35:29 -03:00
Junior Garcia 135cc21e6f fix(menu): add hideSelectedIcon prop to menu and listbox (#1915)
sections
2023-11-07 10:16:02 -03:00
Junior Garcia 7f6218b978 fix(select): multiline styles (#1914) 2023-11-07 10:06:35 -03:00
github-actions[bot] 0eb9f1e3fe ci(changesets): version packages (#1903)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-11-06 17:12:38 -03:00
Junior Garcia 11ef4365da refactor(theme): update input and select component styles (#1905) 2023-11-06 17:00:38 -03:00
Junior Garcia 85a820eeff fix(autocomplete): endContent prop (#1902) 2023-11-06 16:25:00 -03:00
Junior Garcia 6a6d426b10 fix(input): label position and styles (#1901)
* fix(input): label position and styles

* fix(textarea): invalid state
2023-11-06 15:45:05 -03:00
github-actions[bot] a3cbb5997b ci(changesets): version packages (#1878)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-11-06 08:39:24 -03:00
Junior Garcia a5cc42bf80 refactor(docs): routing and add folder routes (#1892)
* refactor(docs): routing and add folder routes

* chore(docs): permanent redirect enabled
2023-11-06 08:22:03 -03:00
Junior Garcia e728a8967b fix(theme): update input and select styling and add data attribute for (#1891)
value
2023-11-06 08:20:02 -03:00
Junior Garcia acba2cf8f5 Fix/input select helper position (#1884)
* fix(input): fix input and select component styles

* chore(root): changeset
2023-11-05 20:00:48 -03:00
Junior Garcia 049db57bb2 fix(docs): fix typo in routing guide link 2023-11-05 18:47:49 -03:00
Dawson 5296d9b84d Typo fix (#1882) 2023-11-05 18:45:24 -03:00
Simon He 1619a35cf9 docs(pagination): fix dotsJump type 2023-11-05 12:20:47 -03:00
Simon He 8106629dab docs(radio-group): fix typo 2023-11-05 12:19:44 -03:00
Junior Garcia d55f52cc35 Merge pull request #1877 from nextui-org/fix/changeset-peer-deps-config 2023-11-05 10:57:39 -03:00
Junior Garcia 78198c32be Merge branch 'main' of github.com:nextui-org/nextui into fix/changeset-peer-deps-config 2023-11-05 10:44:00 -03:00
Junior Garcia 71807e8831 chore(theme): changeset 2023-11-05 10:43:37 -03:00
Junior Garcia 9af6174dcf refactor(theme): refactor theme plugin to improve performance and
readability
2023-11-05 10:43:37 -03:00
Junior Garcia 1a129db6fe chore: merge branch main 2023-11-05 10:30:55 -03:00
Junior Garcia 44ed1056e7 chore(root): changeset added 2023-11-05 10:24:48 -03:00
Junior Garcia db0e26a003 ci(changesets): version packages 2023-11-05 10:02:18 -03:00
Junior Garcia 38af48faf5 fix(core): update peer dependencies for several packages 2023-11-05 09:53:57 -03:00
Junior Garcia 5b60840751 chore(root): main conflicts merge fixed 2023-11-05 09:28:58 -03:00
Junior Garcia 4c56839db0 fix(root): changeset message 2023-11-05 09:27:56 -03:00
Junior Garcia ef61a3fe09 Revert "fix(root): peer dependecies update only when out of range"
This reverts commit bc4927c901.
2023-11-05 09:25:52 -03:00
Junior Garcia bc4927c901 fix(root): peer dependecies update only when out of range 2023-11-05 09:23:28 -03:00
Junior Garcia 4191feab2a fix(docs): update hoverOpacity in layout theme 2023-11-05 09:03:39 -03:00
Junior Garcia fe8647bd1d fix(docs): router import added to the routing next.js app docs 2023-11-05 08:59:16 -03:00
Junior Garcia 23992572ea fix(select): add button component and update select component 2023-11-05 08:52:33 -03:00
Junior Garcia e7a4711d9b ci(changesets): version packages 2023-11-04 16:44:59 -03:00
Junior Garcia e84158db62 chore: changeset 2023-11-04 16:38:57 -03:00
Junior Garcia f59e8f6bac fix(select): without label and input helperWrapper relative 2023-11-04 16:38:57 -03:00
Junior Garcia 73dfb7fc93 feat(docs): add package manager selection and usehooks-ts
dependency
2023-11-04 10:17:00 -03:00
Junior Garcia df9f6f5f58 ci(changesets): version packages 2023-11-03 19:38:47 -03:00
Junior Garcia 1fd5049f5a fix(select): multiline label (#1865) 2023-11-03 19:28:23 -03:00
Junior Garcia a386e1cadd chore(blog): card body padding change added 2023-11-03 17:08:03 -03:00
Junior Garcia 3172a803e3 feat(docs): blog post announcement added to mobile resolutions 2023-11-03 16:55:43 -03:00
Junior Garcia dfc8bdc7af chore(docs): v2.2.0 post date fixed, search meta updated 2023-11-03 16:48:25 -03:00
Junior Garcia 67ce4beb28 Feat/v2 blog (#1858)
* feat: Slider Component (#1686)

* feat(slider): initial structure

* chore(slider): readme improved

* fix: fixed border color of slider track

* docs: added range story

* feat: added rtl support to slider

* feat: improved value label formatting

* feat: refactor styling and add colors support to slider

* chore: improved thumb color

* docs: improved slider stories

* chore(slider): default color changed by foreground

* Update packages/core/theme/src/components/slider.ts

Co-authored-by: Jakob Guddas <github@jguddas.de>

* feat: added fillOffset prop

* Update packages/components/slider/src/use-slider.ts

* fix(slider): animation

* Update packages/components/slider/src/use-slider.ts

* Update packages/core/theme/src/components/slider.ts

* feat: slider steps

* refactor: renamed variables

* feat: improved slider step styling

* fix: hide infinite steps

* fix: fixed step transparency issue

* fix: fixed thumb focus issue

* Update packages/components/slider/src/use-slider.ts

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* feat(slider): vertical orientation added, start & end content, bug fixes

* chore(slider): tests added

* fix(docs): scrollbar added to the sidebar (#1743)

* feat(slider): marks added

* chore(slider): example ts-doc changed

* feat(slider): vertical marks support

* feat(core): slider tooltip support added, popover modified (#1746)

* Feat/slider custom styles (#1751)

* feat(slider): custom styles story added

* fix(slider): custom styles on different sizes

* Fix/slider tooltip android position (#1753)

* feat(slider): custom styles story added

* fix(slider): tooltip update position dependecies added

* fix(popover): arrow placements improved

* feat(slider): docs started, custom thumb and custom output stories added

* feat(slider): render function added to custom render the slider parts

* feat(slider): docs in progress, new properties and examples added

* fix(slider): some issues fixed, output renamed to value, documentation improved

* feat(slider): docs done

* chore: changeset

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Client side routing (#1764)

* feat(slider): initial structure

* chore(slider): readme improved

* fix: fixed border color of slider track

* docs: added range story

* feat: added rtl support to slider

* feat: improved value label formatting

* feat: refactor styling and add colors support to slider

* chore: improved thumb color

* docs: improved slider stories

* chore(slider): default color changed by foreground

* Update packages/core/theme/src/components/slider.ts

Co-authored-by: Jakob Guddas <github@jguddas.de>

* feat: added fillOffset prop

* Update packages/components/slider/src/use-slider.ts

* fix(slider): animation

* Update packages/components/slider/src/use-slider.ts

* Update packages/core/theme/src/components/slider.ts

* feat: slider steps

* refactor: renamed variables

* feat: improved slider step styling

* fix: hide infinite steps

* fix: fixed step transparency issue

* fix: fixed thumb focus issue

* Update packages/components/slider/src/use-slider.ts

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* feat(slider): vertical orientation added, start & end content, bug fixes

* chore(slider): tests added

* feat(slider): marks added

* chore(slider): example ts-doc changed

* feat(slider): vertical marks support

* feat(core): slider tooltip support added, popover modified (#1746)

* Feat/slider custom styles (#1751)

* feat(slider): custom styles story added

* fix(slider): custom styles on different sizes

* Fix/slider tooltip android position (#1753)

* feat(slider): custom styles story added

* fix(slider): tooltip update position dependecies added

* fix(popover): arrow placements improved

* feat(slider): docs started, custom thumb and custom output stories added

* feat(slider): render function added to custom render the slider parts

* feat(slider): docs in progress, new properties and examples added

* fix(slider): some issues fixed, output renamed to value, documentation improved

* feat(slider): docs done

* chore: changeset

* chore: react aria packages upgraded

* feat(system): router provider added

* feat: client side routing support added to items components

* chore(docs): routing docs started

* chore: changeset

* feat(docs): client side routing documented

* feat(pagination): client router support added to pagination

* fix(link): csr added

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>

* feat: added RTL support to accordion component (#1725)

* feat: added RTL support to accordion component

* Create healthy-cobras-crash.md

* feat: added RTL support to avatar and avatar group component (#1727)

* feat: added RTL support to avatar and avatar group components

* Create tender-penguins-love.md

* Update tender-penguins-love.md

* feat: added RTL support to button group component (#1726)

* feat: added RTL support to button component

* feat: added RTL support to button component

* Create orange-bobcats-kneel.md

* Update button.ts

* refactor(root): styles refactor (#1688)

* refactor(root): styles refactor

* chore(tabs): remove needless type extends

* fix(tabs): typecheck

* Breadcrumbs component (#1794)

* feat(components): breadcrumbs initial structure

* feat(breadcrumbs): tests and examples added

* feat(docs): breadcrumbs documentation done

* feat(docs): breadcrumbs docs done

* chore(breadcrumbs): readme changed

* fix(slider): Place last dragged slider handle over the other handle (#1778)

* Set `data-focused` in handle

* Style focused handle on top

* Add tests

* fix(core): tests and build

* fix(button): show only spinner if button isLoading & isIconOnly (#1800)

* fix(button): show only spinner if button isLoading & isIconOnly

* chore: add changeset

* fix(button): remove repeating code

* Fix blur/opaque Popover (#1812)

* fix(popover): double underlay click

* chore: use ref instead of a state

* Feat/controlled scroll shadow (#1819)

* feat(scroll-shadow): logic improved, controlled support added

* feat(scroll-shadow): controlled visibility

* fix(scroll-shadow): visibility tests

* Autocomplete component (Single Selection) (#1797)

* feat(autocomplete): initial structure

* feat(core): use press custom hook implemented, autocomplete improved, input and select animations fixed

* chore(button): add console.log on press

* feat(core): select & input label position, autocomplete improvements, listbox and menu empty state

* chore: tailwind-variants upgraded

* chore: autocomplete stories in progress

* fix: input and select label placement

* fix(autocomplete): popover trigger

* chore(root): react-aria pkgs and framer-motion upgraded

* fix(input,select): outside label scale removed

* feat(autocomplete): more stories and use cases supported

* fix(core): custom items support on collection-based comps, menu generic items support added

* chore(core): tailwind-variants upgraded, custom tv function adapted

* chore(docs): select on-change controlled e.g. changed, sandpack theme fixed

* chore(autocomplete): docs started, tests added

* chore: in progress

* feat(menu): top and end content added, autocomplete docs improved

* feat(docs): autocomplete documentation almost done

* fix(input): outside styles

* feat(docs): autocomplete async filtering added

* chore(docs): autocomplete highlighted lines added

* feat(docs): autocomplete a11y and slots added

* feat(docs): autocomplete a11y and slots added

* feat(docs): autocomplete docs done

* fix(root): peer dependencies (#1848)

* Fix/small issues (#1851)

* fix(input): visible outline

* fix(button): button group radius prop

* chore(navbar): menu item active status added

* fix(docs): pagination missing keys custom items

* fix(core): extendVariants support added to collection-based components

* fix(theme): card body padding

* chore(theme): transition added to menu/listbox items

* fix(input): textarea styles fixed, new prop added

* chore(input): textarea height animated

* feat(button): hover opacity added

* chore(textarea): hide scroll when the limit hasn't been reached

* chore(docs): updated badge added to textarea

* feat(docs): blog v2.2.0 image and entry added

* fix(avatar): ring primary color

* chore(docs): tabs added again, autocomplete iframes removed

* chore: v2 blog post

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>
Co-authored-by: Maurici Abad Gutierrez <hello@mauriciabad.com>
Co-authored-by: Ivan Kucher <dev.kucher@gmail.com>
2023-11-03 12:35:36 -03:00
github-actions[bot] 5a4a60be65 ci(changesets): version packages (#1860)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-11-03 12:21:01 -03:00
Junior Garcia 25e86fb417 chore(changeset): updated 2023-11-03 12:08:29 -03:00
Junior Garcia a95bd6558d chore(core): system pkg theme dependecy moved to peer 2023-11-03 12:07:12 -03:00
Junior Garcia 080718e265 fix(root): changeset 2023-11-03 11:31:30 -03:00
Junior Garcia 8217639fd4 chore(root): v2.2.0 changeset 2023-11-03 11:17:44 -03:00
Junior Garcia 7abd68941a v2.2.0 🕹️ (#1777)
* feat: Slider Component (#1686)

* feat(slider): initial structure

* chore(slider): readme improved

* fix: fixed border color of slider track

* docs: added range story

* feat: added rtl support to slider

* feat: improved value label formatting

* feat: refactor styling and add colors support to slider

* chore: improved thumb color

* docs: improved slider stories

* chore(slider): default color changed by foreground

* Update packages/core/theme/src/components/slider.ts

Co-authored-by: Jakob Guddas <github@jguddas.de>

* feat: added fillOffset prop

* Update packages/components/slider/src/use-slider.ts

* fix(slider): animation

* Update packages/components/slider/src/use-slider.ts

* Update packages/core/theme/src/components/slider.ts

* feat: slider steps

* refactor: renamed variables

* feat: improved slider step styling

* fix: hide infinite steps

* fix: fixed step transparency issue

* fix: fixed thumb focus issue

* Update packages/components/slider/src/use-slider.ts

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* feat(slider): vertical orientation added, start & end content, bug fixes

* chore(slider): tests added

* fix(docs): scrollbar added to the sidebar (#1743)

* feat(slider): marks added

* chore(slider): example ts-doc changed

* feat(slider): vertical marks support

* feat(core): slider tooltip support added, popover modified (#1746)

* Feat/slider custom styles (#1751)

* feat(slider): custom styles story added

* fix(slider): custom styles on different sizes

* Fix/slider tooltip android position (#1753)

* feat(slider): custom styles story added

* fix(slider): tooltip update position dependecies added

* fix(popover): arrow placements improved

* feat(slider): docs started, custom thumb and custom output stories added

* feat(slider): render function added to custom render the slider parts

* feat(slider): docs in progress, new properties and examples added

* fix(slider): some issues fixed, output renamed to value, documentation improved

* feat(slider): docs done

* chore: changeset

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Client side routing (#1764)

* feat(slider): initial structure

* chore(slider): readme improved

* fix: fixed border color of slider track

* docs: added range story

* feat: added rtl support to slider

* feat: improved value label formatting

* feat: refactor styling and add colors support to slider

* chore: improved thumb color

* docs: improved slider stories

* chore(slider): default color changed by foreground

* Update packages/core/theme/src/components/slider.ts

Co-authored-by: Jakob Guddas <github@jguddas.de>

* feat: added fillOffset prop

* Update packages/components/slider/src/use-slider.ts

* fix(slider): animation

* Update packages/components/slider/src/use-slider.ts

* Update packages/core/theme/src/components/slider.ts

* feat: slider steps

* refactor: renamed variables

* feat: improved slider step styling

* fix: hide infinite steps

* fix: fixed step transparency issue

* fix: fixed thumb focus issue

* Update packages/components/slider/src/use-slider.ts

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* feat(slider): vertical orientation added, start & end content, bug fixes

* chore(slider): tests added

* feat(slider): marks added

* chore(slider): example ts-doc changed

* feat(slider): vertical marks support

* feat(core): slider tooltip support added, popover modified (#1746)

* Feat/slider custom styles (#1751)

* feat(slider): custom styles story added

* fix(slider): custom styles on different sizes

* Fix/slider tooltip android position (#1753)

* feat(slider): custom styles story added

* fix(slider): tooltip update position dependecies added

* fix(popover): arrow placements improved

* feat(slider): docs started, custom thumb and custom output stories added

* feat(slider): render function added to custom render the slider parts

* feat(slider): docs in progress, new properties and examples added

* fix(slider): some issues fixed, output renamed to value, documentation improved

* feat(slider): docs done

* chore: changeset

* chore: react aria packages upgraded

* feat(system): router provider added

* feat: client side routing support added to items components

* chore(docs): routing docs started

* chore: changeset

* feat(docs): client side routing documented

* feat(pagination): client router support added to pagination

* fix(link): csr added

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>

* feat: added RTL support to accordion component (#1725)

* feat: added RTL support to accordion component

* Create healthy-cobras-crash.md

* feat: added RTL support to avatar and avatar group component (#1727)

* feat: added RTL support to avatar and avatar group components

* Create tender-penguins-love.md

* Update tender-penguins-love.md

* feat: added RTL support to button group component (#1726)

* feat: added RTL support to button component

* feat: added RTL support to button component

* Create orange-bobcats-kneel.md

* Update button.ts

* refactor(root): styles refactor (#1688)

* refactor(root): styles refactor

* chore(tabs): remove needless type extends

* fix(tabs): typecheck

* Breadcrumbs component (#1794)

* feat(components): breadcrumbs initial structure

* feat(breadcrumbs): tests and examples added

* feat(docs): breadcrumbs documentation done

* feat(docs): breadcrumbs docs done

* chore(breadcrumbs): readme changed

* fix(slider): Place last dragged slider handle over the other handle (#1778)

* Set `data-focused` in handle

* Style focused handle on top

* Add tests

* fix(core): tests and build

* fix(button): show only spinner if button isLoading & isIconOnly (#1800)

* fix(button): show only spinner if button isLoading & isIconOnly

* chore: add changeset

* fix(button): remove repeating code

* Fix blur/opaque Popover (#1812)

* fix(popover): double underlay click

* chore: use ref instead of a state

* Feat/controlled scroll shadow (#1819)

* feat(scroll-shadow): logic improved, controlled support added

* feat(scroll-shadow): controlled visibility

* fix(scroll-shadow): visibility tests

* Autocomplete component (Single Selection) (#1797)

* feat(autocomplete): initial structure

* feat(core): use press custom hook implemented, autocomplete improved, input and select animations fixed

* chore(button): add console.log on press

* feat(core): select & input label position, autocomplete improvements, listbox and menu empty state

* chore: tailwind-variants upgraded

* chore: autocomplete stories in progress

* fix: input and select label placement

* fix(autocomplete): popover trigger

* chore(root): react-aria pkgs and framer-motion upgraded

* fix(input,select): outside label scale removed

* feat(autocomplete): more stories and use cases supported

* fix(core): custom items support on collection-based comps, menu generic items support added

* chore(core): tailwind-variants upgraded, custom tv function adapted

* chore(docs): select on-change controlled e.g. changed, sandpack theme fixed

* chore(autocomplete): docs started, tests added

* chore: in progress

* feat(menu): top and end content added, autocomplete docs improved

* feat(docs): autocomplete documentation almost done

* fix(input): outside styles

* feat(docs): autocomplete async filtering added

* chore(docs): autocomplete highlighted lines added

* feat(docs): autocomplete a11y and slots added

* feat(docs): autocomplete a11y and slots added

* feat(docs): autocomplete docs done

* fix(root): peer dependencies (#1848)

* Fix/small issues (#1851)

* fix(input): visible outline

* fix(button): button group radius prop

* chore(navbar): menu item active status added

* fix(docs): pagination missing keys custom items

* fix(core): extendVariants support added to collection-based components

* fix(theme): card body padding

* chore(theme): transition added to menu/listbox items

* fix(input): textarea styles fixed, new prop added

* chore(input): textarea height animated

* feat(button): hover opacity added

* chore(textarea): hide scroll when the limit hasn't been reached

* chore(docs): updated badge added to textarea

* feat(docs): blog v2.2.0 image and entry added

* fix(avatar): ring primary color

* chore(docs): tabs added again, autocomplete iframes removed

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>
Co-authored-by: Maurici Abad Gutierrez <hello@mauriciabad.com>
Co-authored-by: Ivan Kucher <dev.kucher@gmail.com>
2023-11-03 11:05:16 -03:00
Danny Nemer c3f762563b docs: Fix typos in frameworks/nextjs.mdx (#1849) 2023-11-02 11:02:39 -03:00
Sandro Huber 8d2192183b Fix typo in table component doc (#1850) 2023-11-02 11:01:27 -03:00
Ajith 8b86f83802 Fix typo (#1835)
t he => the
2023-10-30 10:35:53 -03:00
Soohyun, Chae f38059aa44 Update tabs.mdx (#1781) 2023-10-21 13:01:27 +00:00
navedqb 311ceb0c3a Added missing imports to navbar (#1771) 2023-10-16 18:34:41 +00:00
Jakob Guddas 50a9bf54d4 fix: pagination issues second try (#1584)
* fix: pagination issues second try

* Create red-hairs-thank.md
2023-10-16 13:42:27 +00:00
KyungJi Kim 99d4d296d7 docs: fix storybook link in ComponentLinks (#1757) 2023-10-09 23:07:26 -03:00
Jakob Guddas 9245384ac3 docs: accessible toggle button in examples (#1749) 2023-10-07 11:54:16 +00:00
Junior Garcia 5af4b10114 fix(docs): scrollbar added to the sidebar (#1743) 2023-10-05 19:45:37 +00:00
Junior Garcia 8de357cfac fix(docs): sandpack hook react addition validation fixed (#1740) 2023-10-05 15:17:27 +00:00
Junior Garcia 655599982d fix(card): stories 2023-10-05 12:01:02 -03:00
POPO He 3aac9bac26 fix: resolved border collapse issue #1626 when border variants are mixed in button group (#1637)
* fix(button-group): radius not work

* fix(button): not show the correct borders

* fix(changeset): button issue

* fix(changeset): fix typo

* fix(changeset): tweak changeset message

* fix(button-groups): add miss undefined radius

* fix: make changeset clearly

* test(button-group): add variant button

* refactor: button-group variant handling in button-group.stories.tsx

* test: update button variant to 'bordered'

* refactor: rename isIsolate to isIsolated

* Revert "fix(button-group): radius not work"

This reverts commit 6233690d8acd96664c48d4f721c481bcb4095be4.

* fix: remove isIsolate because using a negative value for the margin will always cover the neighbor

* fix(changeset): remove radius part for another PR

* test: add multiple variant buttons on storybook

* fix: remove unused attribute

* feat: use adjacent selector to remove doubles border

* test: make variantButtons theme consistency

* refactor: use collapseAdjacentVariantBorders to wrap an adjacent selector

* Added RTL support.

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>
2023-10-04 19:54:15 +00:00
markyong 95c8fdaa2e fix(select): add placeholder dep for renderSelectedItem (#1682) 2023-10-04 14:54:15 +00:00
Junior Garcia c0706acbca Fix/1609 (#1736)
* feat: storybook upgraded

* fix(skeleton): loading state

* chore(skeleton): changeset
2023-10-04 14:49:18 +00:00
Junior Garcia 9d4c7ed9cf fix(ripple): clear ripples on animation complete (#1681) 2023-09-23 13:18:13 +00:00
Sung Ye In 9ebaae083d fix: add peer dependencies (#1651)
* fix: add peer dependencies

* fix: update pnpm lock
2023-09-23 13:02:06 +00:00
Ansh Mourya c9c5564c58 fix: #1648 (#1655) 2023-09-23 09:36:55 -03:00
Bobby Chan d79808dbe1 fix(radio): correct the style of radio in invalid and selected states (#1668)
* fix(radio): correct the style of radio in invalid and selected states

* Update hot-otters-laugh.md
2023-09-22 13:59:11 +00:00
cosine 5a9b78d234 fix doc: Fixed some errors in the Listbox Component documentation. (#1665)
* fix doc: export IconWrapper and ItemCounter

* fix doc: fix WatcherIcons -> WatcherIcon at everywhere
2023-09-22 13:57:25 +00:00
Chewy 9f4bdf352d docs: add missing semicolon (#1663) 2023-09-20 17:38:14 +00:00
Junior Garcia d62feb08dc chore(docs): next.js upgraded 2023-09-20 01:45:07 -03:00
lijianan 62d307117a docs: fix code Sizes demo overflow (#1644) 2023-09-17 15:00:08 +00:00
Jakob Guddas 01a27293eb docs: updated isInvalid documentation (#1646)
* Update input.mdx

* Update textarea.mdx

* Update select.mdx
2023-09-17 14:54:38 +00:00
github-actions[bot] a53e274d5b ci(changesets): version packages (#1615)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-09-16 21:25:10 +00:00
Junior Garcia 425a034bca fix(packages): validation state deprecated, isInvalid prop adjusted (#1631) 2023-09-16 21:16:32 +00:00
lijianan a5a1ea5ade fix(docs): button custom implement (#1643) 2023-09-16 21:12:14 +00:00
Junior Garcia f6531c5f60 fix(core): extend variants function, destructuring order changed (#1642)
* fix(core): extend variants function, destructuring order changed

* chore(core): changeset added
2023-09-16 21:06:16 +00:00
Junior Garcia 37d5f12162 fix(docs): button custom implementation (#1641) 2023-09-16 20:28:52 +00:00
lijianan dd97fc3c4f fix: fix eslint warning (#1640) 2023-09-16 20:23:26 +00:00
lijianan ceddd0d1d9 refactor: optimize the time of ripple destroy (#1635)
* refactor: optimize the time of ripple destroy

* Update packages/components/button/src/use-button.ts

Co-authored-by: Jakob Guddas <github@jguddas.de>

* fix: fix

* Update packages/components/button/src/button.tsx

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Update packages/components/card/src/card.tsx

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Update packages/components/button/src/button.tsx

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Update packages/components/card/src/card.tsx

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Update packages/components/card/src/use-card.ts

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Update packages/components/card/src/use-card.ts

Co-authored-by: Jakob Guddas <github@jguddas.de>

* fix: fix

* chore: revert

* Create fresh-cameras-provide.md

* Update packages/components/button/src/button.tsx

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* Update packages/components/button/src/button.tsx

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* Update packages/components/button/src/use-button.ts

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* Update packages/components/card/src/card.tsx

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* Update packages/components/card/src/card.tsx

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* fix: fix

* feat: add getUniqueID

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-09-16 20:11:04 +00:00
Junior Garcia bb8ed58749 fix(accordion): selectedKeys added to the values memo function (#1639) 2023-09-16 20:01:39 +00:00
markyong bbbdcbdfdf chore(root): update contributing.md note (#1638) 2023-09-16 19:17:59 +00:00
Junior Garcia bc424948c7 fix(accordion): accordion is no longer preventing spacebar (#1630) 2023-09-15 20:42:02 +00:00
Junior Garcia cdc30db14c fix(utils): filterDomProps fixed (#1629) 2023-09-14 22:49:58 -03:00
Junior Garcia 3aa86423aa Fix/1625 (#1628)
* fix(listbox): item classNames prop, listbox wrapper export

* chore(listbox): changesets
2023-09-15 00:53:26 +00:00
Junior Garcia 59ed34b3de fix(docs): table use case example fixed, sandpack tabs padding added (#1627) 2023-09-15 00:30:17 +00:00
Chong Ruei He f58fc9bb69 fix(docs): add scrollbehavior ts support (#1618) 2023-09-14 20:13:07 +00:00
Junior Garcia 9a478b6c1f chore(docs): hero events 2023-09-13 09:16:48 -03:00
Junior Garcia 7fd0327657 chore(docs): va events added 2023-09-13 08:39:58 -03:00
Bobby Chan 05c966e8a4 fix(card): corrected footerStyles in card footer (#1611) 2023-09-12 13:20:09 -03:00
Nahuel Alejandro Cabrera 5b014b76ff Update explanation in layout.mdx (#1601) 2023-09-12 13:19:10 -03:00
Koen Verheyen cf32b5ae8b Update standalone.ts (#1614) 2023-09-12 13:18:47 -03:00
github-actions[bot] 4452ed66c0 ci(changesets): version packages (#1599)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-09-10 20:32:13 +00:00
Junior Garcia b1b30b7976 chore(root): fix changesets deploy (#1600) 2023-09-10 20:20:19 +00:00
github-actions[bot] 97ef2d7250 ci(changesets): version packages (#1565)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-09-10 19:58:22 +00:00
Junior Garcia 8b39989090 chore(root): changesets 2023-09-10 16:46:31 -03:00
Chongyi Zheng 8363a3ecfc fix: avoid src in import path (#1596)
* fix: avoid `src` in import path

* fix: export `RippleType`
2023-09-10 19:42:55 +00:00
Jakob Guddas 5c30e04811 fix: set nowrap in chip (#1590)
* fix: set nowrap in chip

* Create early-garlics-deliver.md
2023-09-10 19:16:06 +00:00
Adrian 8606fbe0b9 fix(links): corrected typo in accordion link (#1594) 2023-09-10 01:10:46 +00:00
Junior Garcia 1612532eee chore: react-aria packages upgraded (#1589) 2023-09-09 13:50:21 +00:00
Junior Garcia a3be419cb3 Fix/1561 (#1563)
* fix(select): bottom space

* chore(select): changeset
2023-09-03 13:19:17 +00:00
github-actions[bot] 72a7f71377 ci(changesets): version packages (#1559)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-09-02 21:38:53 +00:00
Junior Garcia 7c8341035d fix(pagination): changeset (#1558) 2023-09-02 21:28:41 +00:00
github-actions[bot] 6ca0ce309a ci(changesets): version packages (#1557)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-09-02 21:20:10 +00:00
Junior Garcia acc2ff3913 Merge branch 'main' of github.com:nextui-org/nextui 2023-09-02 18:07:05 -03:00
Junior Garcia 4db10a47e9 chore: changeset pagination revert 2023-09-02 18:06:51 -03:00
Junior Garcia a9c4fab011 chore: pagination changes changeset removed (#1556) 2023-09-02 20:53:55 +00:00
Junior Garcia d61428d9e6 Revert "ci(changesets): version packages (#1550)" (#1555)
This reverts commit 43906f639e.
2023-09-02 20:52:36 +00:00
Junior Garcia 455b788924 fix(docs): missing pagination docs added 2023-09-02 17:48:31 -03:00
Junior Garcia 79cfdbd8ff Revert "fix: resolved cursor issues in pagination (#1222)" (#1554)
This reverts commit 28477447d3.
2023-09-02 20:46:01 +00:00
Junior Garcia 7d294e3a04 Revert "fix: fixed pagination scale animation (#1552)" (#1553)
This reverts commit 8fcc8b3767.
2023-09-02 20:45:49 +00:00
github-actions[bot] 43906f639e ci(changesets): version packages (#1550)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-09-02 20:40:07 +00:00
Jakob Guddas 8fcc8b3767 fix: fixed pagination scale animation (#1552) 2023-09-02 15:45:27 -03:00
Jakob Guddas 28477447d3 fix: resolved cursor issues in pagination (#1222)
* fix: resolved cursor issues in pagination

* chore: added comment

* kick: trigger ci

* Create eighty-knives-heal.md
2023-09-02 18:01:38 +00:00
Junior Garcia fc3c6b9431 chore(root): tailwind variants upgraded (#1551)
* chore(root): tailwind variants upgraded

* fix(theme): prettier
2023-09-02 17:46:36 +00:00
Junior Garcia 59fda3772f fix(navbar-menu): dismiss buttons removed to fix the scroll (#1549) 2023-09-02 15:41:38 +00:00
Troye d8d2b87cb8 fix(docs): table async pagination (#1491)
* fix(docs): change to swr

* chore(table): change to swr

* fix(table): keep the pagination when switching pages

* chore(repo): pnpm lockfile updated
2023-09-02 12:56:39 +00:00
github-actions[bot] 64571e468c ci(changesets): version packages (#1514)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-09-01 21:09:05 +00:00
Junior Garcia faf26acd23 fix(snippet): invalid props (#1546) 2023-09-01 20:52:16 +00:00
Junior Garcia cac56faf29 chore(docs): hero tooltip arrow removed (#1547) 2023-09-01 20:45:41 +00:00
Junior Garcia 09fe1d3141 Fix/1531 (#1545)
* fix(tabs): title prop was being passed to html element

* chore(tabs): changeset
2023-09-01 20:44:46 +00:00
Junior Garcia a9e324b351 fix(listbox): dynamic items types (#1544) 2023-09-01 20:42:20 +00:00
Junior Garcia 043b8420cf Fix/1492 (#1543)
* fix(select): select & input styles fixed

* chore(input): extra data attr added to input wrapper
2023-09-01 20:42:15 +00:00
Junior Garcia 57909accde Fix/1298 (#1542)
* fix(modal): focus trap added

* chore(navbar): changeset added
2023-09-01 20:42:08 +00:00
Vansh Shah 7a17256268 Solved error in Listbox Component (#1530) 2023-08-31 14:06:13 -03:00
MisterHims bf2bc265ee feat: adding some adjustements on listbox and dropdown doc pages (#1520)
* fix: some typo and renamed use infinite scroll call on async section of select docpage

* fix(listbox-docpage): note doublon from the with icons section

* fix(switch-docpage): add a missing whitespace

* fix(dropdown-docpage): remove note doublon

* fix(dropdown-docpage): adding DropdownSection dependencu into the with-section code

* fix(dropdown-docpage): do not need Button component on custom-trigger section code

* fix(dropdown-docpage): fixed typo missing letter on dropdown-item list

* fix(dropdown-section): add missing comma
2023-08-29 18:05:55 +00:00
MisterHims cf6bf749a1 feat: adding some ajustements on listbox and dropdown doc pages (#1518) 2023-08-29 13:20:51 -03:00
Tianen Pang 641bf0885b feat(system): extend props for nextui provider (#1513) 2023-08-28 13:00:24 -03:00
MisterHims 40b42001f9 fix: some typo and renamed use infinite scroll call on async section of select docpage (#1509) 2023-08-27 19:30:49 -03:00
github-actions[bot] 789a7209a2 ci(changesets): version packages (#1500)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-26 14:57:11 +00:00
Junior Garcia 021aa16d96 chore(docs): inter font applied to tailwind config 2023-08-26 11:30:06 -03:00
Junior Garcia eb8a1fcc01 chore(docs): font family chnaged to inter 2023-08-26 11:24:28 -03:00
Junior Garcia 9b42a2fca1 fix(docs): select typo 2023-08-26 11:15:15 -03:00
Junior Garcia 5702287e56 fix(popover): arrow color (#1501) 2023-08-26 14:13:04 +00:00
Jakob Guddas 290cce15be fix: show focus ring when table row is focused in read mode (#1303)
* fix: show focus ring when table row is focused in read mode

* Create witty-trees-buy.md
2023-08-26 13:41:35 +00:00
github-actions[bot] 27bde30839 ci(changesets): version packages (#1499)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-26 13:39:00 +00:00
Junior Garcia 6be3bc3516 fix(docs): textarea readonly typo 2023-08-26 10:30:13 -03:00
T/once e4113b05ce fix(navbar): unable to Close NavbarMenu (#1496)
* add mode wait to AnimatePresence

* add changeset
2023-08-26 13:29:27 +00:00
Junior Garcia a3a95e7196 Merge branch 'main' of github.com:nextui-org/nextui 2023-08-26 10:27:22 -03:00
Junior Garcia 8731159702 fix(docs): font family 2023-08-26 10:27:08 -03:00
Hyuuh b6adb2ae8c docs(components): 📝 change to the new rsc link (#1493)
The new docs for Next.js RSC has been moved to a new section.
2023-08-25 17:29:00 +00:00
github-actions[bot] cd2d9b70a9 ci(changesets): version packages (#1477)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-23 03:26:47 +00:00
Junior Garcia a371e1a5fa Fix/tooltip arrow position (#1474)
* feat(blog): rss auto-discovery added

* fix(blog): feed.xml author name

* fix(tooltip): arrow position

* chore(tooltip): changeset
2023-08-23 03:11:15 +00:00
github-actions[bot] 5cdc4d1d87 ci(changesets): version packages (#1475)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-23 03:11:05 +00:00
Junior Garcia 22c6e070dd Fix/1469 (#1476)
* feat(blog): rss auto-discovery added

* fix(blog): feed.xml author name

* fix(docs): sandpack files filter
2023-08-23 03:10:41 +00:00
Junior Garcia 0714192838 Merge branch 'main' of github.com:nextui-org/nextui 2023-08-23 00:02:41 -03:00
Junior Garcia ae9f300d45 Fix/1468 (#1472)
* feat(blog): rss auto-discovery added

* fix(blog): feed.xml author name

* fix(select): size prop

* chore(root): changeset
2023-08-23 02:59:03 +00:00
Junior Garcia a16dac04c8 Merge branch 'main' of github.com:nextui-org/nextui 2023-08-22 23:49:47 -03:00
Junior Garcia 94db001961 Chore/docs improvemements (#1473)
* feat(blog): rss auto-discovery added

* fix(blog): feed.xml author name

* chore(docs): pnpm script modified
2023-08-23 02:46:37 +00:00
Junior Garcia d77cf7658b Feat/add rss auto discovery (#1471)
* feat(blog): rss auto-discovery added

* fix(blog): feed.xml author name
2023-08-23 02:43:58 +00:00
Junior Garcia 46c47f7e6e fix(blog): feed.xml author name 2023-08-22 12:37:26 -03:00
Junior Garcia 35b9741663 feat(blog): rss auto-discovery added 2023-08-22 12:34:35 -03:00
github-actions[bot] 2b82ba86eb ci(changesets): version packages (#1465)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-21 22:15:21 +00:00
Junior Garcia 904f538779 Chore/update react aria packages (#1463)
* fix(dropdown): popover and dropdown fixes

* fix(popover): arrow animation, shouldCloseOnInteractOutside function usage fixed

* chore(root): changeset

* chore(root): react-aria utils pkg updated

* fix(root): changesets

* fix(root): changeset
2023-08-21 22:06:36 +00:00
nirmalkumar 609e9f4c11 fix -( Image-Tag issue in Cover-image.ts ) (#1462) 2023-08-21 21:16:33 +00:00
github-actions[bot] e3dabac9f5 ci(changesets): version packages (#1461) 2023-08-21 12:28:39 -03:00
Junior Garcia 4e94c11528 fix(dropdown): popover and dropdown fixes (#1458) 2023-08-21 12:07:28 -03:00
João Vitor a17b6c7502 docs(tooltip): decrease zIndex so it doesn't overlap other elements (#1454)
* fix(navbar): z-index issue on desktop

* Revert "fix(navbar): z-index issue on desktop"

This reverts commit 227b79e5c6493084ee31a62fd5b13079c8a4a2e4.

* docs(tooltip): decrease the zIndex
2023-08-21 14:29:03 +00:00
github-actions[bot] bd72301b01 ci(changesets): version packages (#1456)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-21 13:40:21 +00:00
Junior Garcia cc839cdd1f Fix/select label closes the popover (#1455)
* fix(select): label pointer events removed

* chore(select): changeset
2023-08-21 13:29:49 +00:00
Yannik Hewlik c9e5c2ef7f docs: correct default value for popover radius (#1451)
* Update popover.mdx

* Update apps/docs/content/docs/components/popover.mdx

Co-authored-by: Jakob Guddas <github@jguddas.de>

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>
2023-08-21 13:22:50 +00:00
Junior Garcia e8f5264cf8 fix(blog): v2.1.0 date 2023-08-21 10:11:10 -03:00
Junior Garcia df7f773f3d fix(blog): async typo 2023-08-21 09:49:59 -03:00
github-actions[bot] af925d56d1 ci(changesets): version packages (#1453)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-21 12:41:43 +00:00
Junior Garcia baec55029d Feat/select component (#1313)
* chore(root): menu and select components in progress

* chore(root): merged with main

* feat(menu): stories created

* feat(dropdown): menu migrated to menu component

* feat(select): base implementation in progress

* feat(select): listbox implemented

* feat(select): scroll overflow and auto scroll added

* feat(select): colors & variants improved, inside placement complete, outside pending

* feat(scroll-shadow): new component in progress

* feat(select): scroll shadow integrated

* fix(select): popover implementation, more scroll shadow stories added

* feat(listbox): custom styles example added to stories

* chore(listbox): overflow hidden removed

* feat(select): variants and styles completed

* chore(select): description story added

* feat(select): more stories added

* fix(select): dynamic collections inference, styles improved, more stories added

* fix(select): auto scroll to selected item, scroll padding added

* chore(select): scroll behavior changed to nearest

* feat(select): custom item story added

* fix(select): autoscroll fixed

* feat(select): multi select support added

* feat(select): more examples added, clean-package modified to remove dev packages

* chore(modal): useImperativeHandle removed

* feat(select): render value story improved

* feat(docs): listbox & scroll shadow docs done

* feat(docs): select documentation in progress

* fix: select aria label (#1425)

* feat(docs): more examples added

* feat(docs): select multiple added, storybook favicon changed

* fix: added value to aria label of select (#1431)

* feat(select): more examples added, storybook favicon changed

* fix(popover): dialog role removed

* feat(select): api added, async loading exampled added

* fix: fixed list box on click not working with sr click (#1439)

* feat(select): async items loading support added and documented

* feat(root): input styles updated to be as the select ones

* chore(root): listbox and scroll shadow readme updated

* feat(select): ts examples added, banner updated

* fix(popover): voiceover closes when focusing an item fixed

* chore(select): focus scope removed

* fix(popover): free solo popover added to use without a trigger

* feat(select): blog post added

* chore(docs): search meta generated, multi controlled onchange example fixed

* chore(root): changeset added

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>
2023-08-21 12:28:01 +00:00
Gaurav Pandey ea2868e58e updated doc handling hydration mismatch error (#1449)
Co-authored-by: btsb78 <gaurav.pandey@kratikal.com>
2023-08-20 20:42:01 +00:00
Junior Garcia 691f380dff fix(docs): client directive added to next app examples on dark mode page 2023-08-20 11:45:23 -03:00
Junior Garcia ac8afec964 fix(modal): docs issues 2023-08-19 18:33:51 -03:00
Loïc GREFFIER 5fe5521a7c fix(docs): replaced ghost by dot in chip variants (#1436) 2023-08-18 20:49:36 -03:00
github-actions[bot] 15403bc67e ci(changesets): version packages (#1435) 2023-08-18 18:16:55 -03:00
Junior Garcia c186f37c98 fix(accordion): hide indicator prop in accordion item (#1433) 2023-08-18 20:59:49 +00:00
github-actions[bot] 1bc2a50e2c ci(changesets): version packages (#1434)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-18 20:57:44 +00:00
Junior Garcia 453f792a7a fix(link): warning onClick removed (#1432) 2023-08-18 20:50:13 +00:00
Junior Garcia 3f6fd48eee fix(docs): modal mail icon imports (#1421) 2023-08-17 12:48:06 +00:00
github-actions[bot] d7c6c79f38 ci(changesets): version packages (#1414)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-15 20:35:07 -03:00
Junior Garcia f068552774 refactor(tooltip): style prop merged with the passed one (#1413) 2023-08-15 20:28:23 -03:00
Cesar Leonardo Insuasty Moreno 6d7372ede1 fix: Import CardFooter in the card component doc (#1412) 2023-08-15 18:52:16 -03:00
github-actions[bot] 1487219a1c ci(changesets): version packages (#1411)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-15 18:30:06 -03:00
Junior Garcia 6e7e834c2d fix(popover): allow pass custom z-index (#1410) 2023-08-15 18:22:08 -03:00
Victor Bejas 80a8f7e94c fix/add import CardFooter at Card component composition (#1408) 2023-08-15 16:19:39 -03:00
github-actions[bot] fae7467b64 ci(changesets): version packages (#1407)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-15 14:41:45 -03:00
Tommaso De Rossi 4e7789c1f6 fix(input): don't always use controlled mode (#1406)
* fix(input): don't always use controlled mode

* fix(input): don't pass value to useTextField

* test(input): added test for mutating input via ref

* chore(input): changelog
2023-08-15 14:24:55 -03:00
Junior Garcia 6694b934e6 fix(docs): accordion item isOpen prop removed 2023-08-14 10:06:07 -03:00
github-actions[bot] 4d341081e3 ci(changesets): version packages (#1393)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-13 22:07:15 -03:00
github-actions[bot] df562449fb ci(changesets): version packages (#1392)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-13 21:50:12 -03:00
Junior Garcia 4063362699 fix(popover): use layout effect on the server warning 2023-08-13 21:42:57 -03:00
Junior Garcia 94d65df533 fix(root): filter dom props function fixed, slot prop added (#1391)
* fix(root): filter dom props function fixed, slot prop added

* chore(root): changeset added
2023-08-13 21:41:42 -03:00
Junior Garcia 8f66c6b564 fix(docs): individual installation highlights 2023-08-13 15:32:22 -03:00
Junior Garcia 4a19a3c906 Merge branch 'main' of github.com:nextui-org/nextui 2023-08-13 15:25:03 -03:00
Junior Garcia 0be398ade9 fix(docs): individual components styles 2023-08-13 15:24:48 -03:00
github-actions[bot] 50d23e5378 ci(changesets): version packages (#1385)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-13 00:03:39 -03:00
Junior Garcia d0341020e6 fix(docs): navbar with search input example (#1384) 2023-08-12 23:53:22 -03:00
github-actions[bot] 4170ecdc76 ci(changesets): version packages (#1383)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-12 23:33:09 -03:00
Junior Garcia e2b0076b53 chore(root): version field moved to bug report template 2023-08-12 23:27:55 -03:00
Junior Garcia e2b0497b07 fix(root): checkbox and radio onChange event types fixed (#1381) 2023-08-12 23:26:07 -03:00
Junior Garcia df3b309542 Merge branch 'main' of github.com:nextui-org/nextui 2023-08-12 22:56:11 -03:00
Junior Garcia 6c35a502fe chore(root): feature request template updated, version added 2023-08-12 22:55:37 -03:00
github-actions[bot] a629f8c088 ci(changesets): version packages (#1378)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-12 11:40:59 -03:00
Junior Garcia fd4e01dcfa fix(dropdown): spread key warning (#1377) 2023-08-12 11:33:13 -03:00
github-actions[bot] e9c08abd55 ci(changesets): version packages (#1374)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-11 21:10:32 -03:00
Junior Garcia 3e263aa882 fix(table): layout property (#1372) 2023-08-11 20:58:57 -03:00
Junior Garcia 9add9aba97 chore(docs): current version added to navbar dropdown (#1373) 2023-08-11 20:48:00 -03:00
Tudor Comparan 0311ae43f1 individual instalation, tailwind setup, require correct nextui package (#1371) 2023-08-11 16:07:23 -03:00
github-actions[bot] 79c5fb9a94 ci(changesets): version packages (#1370)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-11 15:02:25 -03:00
Junior Garcia abe1ba58de Fix/input undefined value (#1369)
* fix(input): undefined value uncontrolled

* fix(input): undefined value uncontrolled
2023-08-11 14:54:29 -03:00
Jakob Guddas e6c3747153 chore: added custom title for release PRs (#1368) 2023-08-11 14:12:11 -03:00
github-actions[bot] d15b16ecab ci(changesets): version packages (#1366)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-11 12:20:17 -03:00
Junior Garcia fe03c42fa1 fix(tooltip): filter dom props function fixed (#1365)
* fix(tooltip): filter dom props function fixed

* fix(root): react types pkg updated
2023-08-11 12:06:47 -03:00
navedqb 25a918d146 Fixed incorrect import in card component (#1364) 2023-08-11 09:04:17 -03:00
github-actions[bot] 87918ac5b4 ci(changesets): version packages (#1360)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-10 23:47:40 -03:00
Junior Garcia a30cec4810 chore(root): react-aria packages upgraded (#1359) 2023-08-10 23:25:24 -03:00
github-actions[bot] 1b0653c97a ci(changesets): version packages (#1353)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-10 17:35:26 -03:00
Junior Garcia 710395f3a2 Refactor/remove needless exports system (#1350)
* fix(root): filter dom props func, accordion keep content mounted, navbaropen menu callbacks

* refactor(system): needeless exports removed

* refactor(system): needeless exports removed
2023-08-10 17:27:53 -03:00
github-actions[bot] e7e58e854a ci(changesets): version packages (#1352)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-10 17:19:51 -03:00
Junior Garcia d13a14facc Fix/events and props issues (#1351)
* fix(root): filter dom props func, accordion keep content mounted, navbaropen menu callbacks

* fix(docs): examples keys
2023-08-10 17:10:53 -03:00
Junior Garcia cef7235c4b fix(docs): compound variants typo 2023-08-10 08:54:38 -03:00
Junior Garcia fcff1a1d36 Merge branch 'main' of github.com:nextui-org/nextui 2023-08-09 23:39:57 -03:00
Junior Garcia c7ba9e1508 fix(docs): customize theme button example, color added 2023-08-09 23:39:44 -03:00
github-actions[bot] 1d8dc4b9d8 ci(changesets): version packages (#1339)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-09 21:51:25 -03:00
github-actions[bot] ea5e0fb096 ci(changesets): version packages (#1338)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-09 21:42:53 -03:00
Junior Garcia 26f64d043d fix(storybook): padding 2023-08-09 21:40:54 -03:00
Jakob Guddas a078c3dcd2 chore: storybook improvements (#1335) 2023-08-09 21:36:54 -03:00
Jakob Guddas 5a50390e3f fix: moved sr only modal close buttons to not show unnecessary scroll bar (#1333)
* fix: moved sr only modal close buttons to not show unnecessary scroll bar

* Create sour-lizards-allow.md
2023-08-09 21:36:14 -03:00
Tianen Pang 894d85d059 docs(table): use case example (#1326) 2023-08-08 14:43:40 -03:00
github-actions[bot] 0ef41d27e7 ci(changesets): version packages (#1324)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-08 12:28:30 -03:00
Tianen Pang 4200164712 fix(input): duplicate triggering of input events (#1323)
* feat(utils): support for omit-names

* fix(input): exclude duplicate event props

* fix(input): exclude duplicate event fn only

* test(input): event fn call count

* chore(changeset): changeset added
2023-08-08 12:19:08 -03:00
Tianen Pang 6d4c6980d5 fix(docs): typo in the loading more data section (#1319) 2023-08-08 09:10:10 -03:00
github-actions[bot] f3f36a7146 ci(changesets): version packages (#1316)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-08 01:04:01 -03:00
Junior Garcia 8de209bff7 feat(root): new changeset 2023-08-08 00:56:56 -03:00
Junior Garcia e9d01be74d chore(root): eslint and prettier ignore updated 2023-08-08 00:45:14 -03:00
Junior Garcia 66ac2e67ae feat(root): new changeset 2023-08-08 00:44:58 -03:00
Junior Garcia 7ed88f39c1 chore(pagination): fix prettier 2023-08-08 00:41:58 -03:00
vaynevayne 32d18bfd41 Update pagination-item.tsx (#1315) 2023-08-08 00:41:09 -03:00
vaynevayne a1b32c1ceb Update use-pagination.ts (#1314) 2023-08-08 00:39:01 -03:00
Junior Garcia 9e683b32ba Merge branch 'main' of github.com:nextui-org/nextui 2023-08-08 00:12:35 -03:00
Junior Garcia b7c947805d feat(storybook): logo adapted to light/dark theme, favicon added 2023-08-08 00:12:21 -03:00
github-actions[bot] a76fdfa774 ci(changesets): version packages (#1310)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-07 23:40:34 -03:00
Junior Garcia ac605eb71f Fix/1307 input on value change (#1309)
* fix(input): inner event handler implemented

* chore(root): changeset added
2023-08-07 23:31:16 -03:00
Junior Garcia 5b343b6181 chore(root): storybook static files removed 2023-08-06 15:56:24 -03:00
Junior Garcia 05562dcf90 feat(root): storybook v7 2023-08-06 15:41:25 -03:00
github-actions[bot] 0a60388258 ci(changesets): version packages (#1302)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-06 15:23:26 -03:00
Junior Garcia d794225cb7 Pr/1224 (#1301)
* chore: storybook migration

* chore: storybook migration

* chore: storybook migration

* fix: moved options in arg types out of control

* fix: fixed type issues

* fix: renamed sb:start script to start

* chore: migrate csf 2 to csf 3

* fix: removed storybook build from root build script

* chore: kick

* chore(root): pnpm lock updated

* chore(root): new changeset

---------

Co-authored-by: Jakob Guddas <github@jguddas.de>
2023-08-06 15:04:26 -03:00
Junior Garcia ec2ed200f5 fix(docs): navbar imports 2023-08-06 14:53:19 -03:00
Junior Garcia 2f7703ec8e fix(docs): navbar imports 2023-08-06 14:53:12 -03:00
Junior Garcia 25cbe1146f chore(root): qa action parallelized again 2023-08-06 12:06:57 -03:00
Junior Garcia 3db9b6248e chore(root): qa action parallelized again 2023-08-06 11:59:43 -03:00
github-actions[bot] b1b5eda15b ci(changesets): version packages (#1293)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-06 00:02:27 -03:00
Junior Garcia e3e13a095f chore(root): new changeset 2023-08-05 23:49:42 -03:00
Junior Garcia 86f921d098 Feat/server components (#1291)
* feat(root): rsc components added, packages modified, filter dom props function adapted

* fix(root): eslint/prettier issues

* feat(root): exports changed to named, new pkg for system rsc compatible functions
2023-08-05 23:35:28 -03:00
Junior Garcia eefda8d6e2 feat(root): RSC components added, packages modified, filter dom props function adapted (#1289)
* feat(root): rsc components added, packages modified, filter dom props function adapted

* fix(root): eslint/prettier issues
2023-08-05 18:53:34 -03:00
Junior Garcia 2e4ce7bcee chore(root): all qa processes joined into a single one 2023-08-05 18:40:08 -03:00
Junior Garcia 5a4c4f498d chore(root): build step added to tests QA 2023-08-05 18:34:17 -03:00
Junior Garcia ec30a9adbd refactor(root): sotybook build folder added to repo 2023-08-05 11:14:27 -03:00
Junior Garcia a6954c4156 Merge branch 'main' of github.com:nextui-org/nextui 2023-08-05 11:13:53 -03:00
Junior Garcia b887a2f503 refactor(root): sotybook build folder added to repo 2023-08-05 11:13:37 -03:00
github-actions[bot] edc2bc741e ci(changesets): version packages (#1284)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-05 10:54:54 -03:00
Tianen Pang a1a02dc0db fix(tooltip): behavior of tooltip trigger with delay (#1278)
* fix(tooltip): use trigger-props instead of custom on-pointer events

* chore(changeset): add tooltip changeset
2023-08-05 10:46:01 -03:00
github-actions[bot] cd1dc8b469 ci(changesets): version packages (#1277)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-04 23:31:33 -03:00
Junior Garcia 459ac5ed45 chore: new changeset w/o minor version on theme 2 2023-08-04 23:20:00 -03:00
Junior Garcia 9c4bb22e87 chore: new changeset w/o minor version on theme 2023-08-04 23:03:21 -03:00
Junior Garcia 7fa5459381 feat(root): new changeset 2023-08-04 22:45:21 -03:00
Junior Garcia b77b8fa9d7 fix(modal): content placement changed on mobile when outside scroll (#1275) 2023-08-04 22:37:01 -03:00
Junior Garcia c6c4a4d6a1 fix(dropdown): item keys taken out from the itemProps (#1274) 2023-08-04 22:35:49 -03:00
Junior Garcia e96b1dbab0 fix(docs): radio & checkbox custom styles (#1273) 2023-08-04 22:34:37 -03:00
Junior Garcia 1b55d27645 fix(docs): remove autoFocus on webkit (#1272) 2023-08-04 22:33:41 -03:00
Junior Garcia bdc246a8a4 fix(table): ts use-case example, page state added (#1271) 2023-08-04 22:32:53 -03:00
Tianen Pang 5064bfe4e4 fix(docs): navbar examples (#1269)
* fix(navbar): use button tag and correctly pass props with child

* chore(navbar): sync example and code snippet
2023-08-04 14:41:54 -03:00
brick.ninja 36ddbff557 fix: typo navbar.tsx (#1264) 2023-08-03 18:13:55 -03:00
Junior Garcia 043b42c895 chore(docs): ea perc increased 2023-08-03 09:54:44 -03:00
Junior Garcia c8330b8106 Merge branch 'main' of github.com:nextui-org/nextui 2023-08-03 09:52:30 -03:00
Junior Garcia 7f20346423 chore(docs): ea perc increased 2023-08-03 09:51:01 -03:00
Ikko Eltociear Ashimine 85b3fd7269 fix(docs): typo in dropdown.mdx (#1255)
TThe -> The
2023-08-03 09:45:55 -03:00
Junior Garcia 649204ceac fix(root): qa action 2023-08-03 09:45:40 -03:00
Junior Garcia c7a1376872 fix(docs): poster added to blog videos, play/pause button added 2023-08-02 23:50:38 -03:00
Junior Garcia 3323592211 fix(blog): s3 url replaced by cloudfront 2023-08-02 22:57:16 -03:00
Junior Garcia fb570a372d feat(root): qa github action added 2023-08-02 22:33:37 -03:00
Junior Garcia 184d3a9c49 fix(root): changelog commands removed 2023-08-01 22:51:16 -03:00
github-actions[bot] 849eff5715 ci(changesets): version packages (#1234)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-08-01 18:10:12 -03:00
Junior Garcia b400f3ee6d chore(input): readme changed 2023-08-01 17:54:44 -03:00
Junior Garcia dedede0be0 feat(root): new release pipeline 2023-08-01 17:38:47 -03:00
Junior Garcia e96a23c8a3 Merge branch 'main' of github.com:nextui-org/nextui 2023-08-01 17:25:40 -03:00
Kwesi Ansah 7efd6c97e4 fix: fixes tab submitting form on click (#1233) 2023-08-01 17:25:20 -03:00
Junior Garcia 43e5e4fb26 chore(docs): announcement chip alpha border 2023-08-01 17:09:32 -03:00
Tianen Pang 39da69cf81 fix(docs): custom variants link (#1232) 2023-08-01 15:39:29 -03:00
Junior Garcia 8743a6c6b6 fix(blog): typo 2023-08-01 11:49:31 -03:00
Junior Garcia c635c951d6 fix(blog): typo 2023-08-01 11:44:18 -03:00
Junior Garcia cb05342a4a fix(docs): v1 redirect 2023-08-01 11:33:22 -03:00
Junior Garcia 59ef7bc6b6 feat(blog): rss added 2023-08-01 11:16:50 -03:00
Junior Garcia cfd19415ea fix(docs): v2 blog toc 2023-08-01 10:54:50 -03:00
Junior Garcia 39ca892b4e chore(root): changeset changelogs enabled 2023-07-31 23:40:30 -03:00
Junior Garcia fc2dad8b39 chore(docs): navbar announcement chip border color changed
Tagged Release / Tagged Release (push) Has been cancelled
2023-07-31 23:22:25 -03:00
Junior Garcia d9bbd2e45f feat(docs): next.js updated, sitemap generation added 2023-07-31 23:16:28 -03:00
Junior Garcia 75bc039b4b feat(root): storybook updated, custom variants docs format fixed 2023-07-31 22:58:55 -03:00
Junior Garcia e79bd0fa4c chore(docs): storybook links updated to v2 2023-07-31 22:50:46 -03:00
Junior Garcia 65c5af4f63 chore(core): ci/cd badge removed 2023-07-31 22:46:53 -03:00
Junior Garcia f58c8a7d99 feat(docs): missing resources added 2023-07-31 22:45:39 -03:00
Junior Garcia 9da06aaa50 chore(docs): remove dev-v2 tag from main package 2023-07-31 22:27:45 -03:00
Junior Garcia 508f11e968 chore(docs): v1 link added to navbar 2023-07-31 22:26:31 -03:00
Junior Garcia 2812f61f4f refactor(docs): nextui v2 blog date changed 2023-07-31 22:18:23 -03:00
Junior Garcia 0ee0e95678 fix(docs): invalid redirect 2023-07-31 22:14:28 -03:00
Junior Garcia e940ec06ac feat(root): v2 published 2023-07-31 22:10:19 -03:00
Junior Garcia 1976c62105 feat(docs): new snapshot, release blog in progress 2023-07-30 18:20:18 -03:00
Junior Garcia aedda9d0de chore(root): merge feat/v2 2023-07-29 12:23:24 -03:00
Junior Garcia 38afbba681 chore(docs): custom variants examples improved 2023-07-29 10:28:35 -03:00
Junior Garcia cd941e64c1 Fix/props suggestions (#1225)
* refactor(core): new forwardRef types created, stories modified, important changes implemented

* feat(docs): custom variants api added, components ref fixed

* fix(components): omit ref removed
2023-07-28 18:00:18 -03:00
Junior Garcia eec0ab7584 fix(core): new snapshot, system pkg build fixed 2023-07-27 22:42:25 -03:00
Junior Garcia a415a6f0f7 feat(docs): extendVariants slots support 2023-07-25 16:37:26 -03:00
Cam Cam 0008709813 [Feat/v2] - fix(Chip): style issue (#1214)
* Update chip.ts

fix(Chip): fixed chip style issue one char with close button

* Update use-chip.ts

fix(Chip): added isCloseable variant
2023-07-24 14:57:33 -03:00
Junior Garcia 8248f0c36f feat(root): new snapshot 2023-07-23 18:23:58 -03:00
Jakob Guddas 78556ab9ba fix: fixed switch small pressed state animation (#1210) 2023-07-23 18:18:26 -03:00
Jakob Guddas 02fd961a71 fix: update accordion on child change (#1211) 2023-07-23 18:17:33 -03:00
Jakob Guddas b054bfa3b6 fix: added missing helper text wrapper to textarea (#1216) 2023-07-23 18:15:29 -03:00
Junior Garcia 597ff59e51 chore(docs): update sponsors, search meta and button group example 2023-07-23 18:07:18 -03:00
Jakob Guddas 3e5af52ae1 docs: improved group-use-case example (#1217) 2023-07-23 18:06:33 -03:00
Junior Garcia 698b2a9e25 fix(docs): sandpack depedencies injection fixed 2023-07-23 18:03:35 -03:00
Junior Garcia b7477e008d fix(docs): cv button styles link 2023-07-23 17:31:24 -03:00
Junior Garcia caf6166d49 feat(docs): custom variants doc updated 2023-07-23 17:29:33 -03:00
Junior Garcia 61e07fbdde feat(docs): custom variants doc updated 2023-07-23 17:28:50 -03:00
Junior Garcia 96f55f10b8 feat(root): extendStyles renamed to extendVariants, compound and default variants support added 2023-07-23 16:28:35 -03:00
Junior Garcia 161cd23658 feat(root): extendStyles function created for component without slots 2023-07-22 19:24:42 -03:00
Junior Garcia 49e3009d7d feat(root): extendStyles function in progress 2023-07-21 17:27:04 -03:00
Junior Garcia 3094c3d226 chore(docs): wip custom variants 2023-07-19 09:25:47 -03:00
Junior Garcia 6cd84fed80 feat(docs): custom variants doc added 2023-07-18 23:17:57 -03:00
Junior Garcia b1a9bb2664 feat(docs): customization part done. new snapshot 2023-07-18 18:37:01 -03:00
Junior Garcia 6796ccb76f feat(docs): override styles in progress 2023-07-17 22:50:55 -03:00
Jakob Guddas ad45bf5619 feat: improved animations (#1206) 2023-07-17 20:32:41 -03:00
Jakob Guddas 9f2e1249d5 fix: increased hitbox of radio and checkbox (#1205) 2023-07-17 20:32:22 -03:00
Junior Garcia 12b5f0ed33 feat(docs): customization docs added 2023-07-17 20:24:00 -03:00
Jakob Guddas 2b1841e362 fix(stories): fixed password field story issues (#1201) 2023-07-17 17:59:12 -03:00
Junior Garcia 9bd88dec48 feat(docs): theme docs in progress 2023-07-16 16:42:33 -03:00
Jakob Guddas f0123e6be6 fix: changed checkbox group label to be span (#1204) 2023-07-16 12:17:16 -03:00
Jakob Guddas 70a5853cd8 fix: added alt fallback to avatar component (#1203) 2023-07-16 11:40:58 -03:00
Jakob Guddas ffd1c4d535 fix: fixed navbar link problems in docs (#1199)
* fix: fixed navbar link problems in docs

* fix: fixed navbar link problems in docs
2023-07-16 11:36:40 -03:00
Junior Garcia d745cd114f fix(docs): table use case example 2023-07-15 12:43:36 -03:00
Junior Garcia d1252d7c50 chore: new snapshot 2023-07-15 12:21:09 -03:00
Junior Garcia 3277ef2b0a feat(docs): new snapshot, sandpack fixes, table fixes 2023-07-15 12:02:17 -03:00
Jakob Guddas ea2ab14d43 fix: pagination focus is now maintained after page switching (#1194) 2023-07-15 10:49:08 -03:00
Jakob Guddas 4f096a8096 fix: added min gap to navbar (#1195) 2023-07-15 10:48:55 -03:00
Jakob Guddas 01e764813d fix: added aria hide outside to popover (#1198)
* fix: added aria hide outside and prevent scroll to popover

* chore: readded react-remove-scroll
2023-07-15 10:48:21 -03:00
Junior Garcia 76ef3a9b7d chore(docs): search meta updated 2023-07-14 23:13:32 -03:00
Junior Garcia 5f35439503 chore(docs): view behavior changed on code demo 2023-07-14 23:06:47 -03:00
Junior Garcia 598af42e2c fix(table): styles issues 2023-07-14 23:03:21 -03:00
Junior Garcia 3a1868baf5 feat(docs): table custom styles example added, api added 2023-07-14 22:39:48 -03:00
Junior Garcia 72d7158034 fix(root): table sandpacks, input label placeholder 2023-07-14 00:31:44 -03:00
Junior Garcia 504eb1dc47 feat(docs): more table examples added 2023-07-13 21:09:53 -03:00
Junior Garcia 1ff1c7b111 feat(docs): table docs in progress 2023-07-12 21:52:32 -03:00
Junior Garcia 779f54f726 feat(docs): navbar api added 2023-07-11 23:51:26 -03:00
Junior Garcia a822eddc11 feat(navbar): controlled example added, data atrrs addded 2023-07-11 19:57:57 -03:00
Junior Garcia 9cae2d2625 fix(progress): max vand mix values fixed 2023-07-11 19:07:06 -03:00
Jakob Guddas fee73b4f77 fix: pagination dots changes now on focus visible to arrows (#1191) 2023-07-11 18:38:24 -03:00
Jakob Guddas 4049eae3c6 fix: progress bar with more than 100% is now full and has proper label (#1190) 2023-07-11 18:37:35 -03:00
Junior Garcia 874bbe87e7 feat(navbar): docs improved, new release published 2023-07-11 18:16:15 -03:00
Junior Garcia 950eabacfd chore: confitional add analytics 2023-07-10 23:43:56 -03:00
Junior Garcia 6fe0a81cd2 chore(docs): analytics added again 2023-07-10 19:15:09 -03:00
Junior Garcia 8810699b14 chore(root): tv upgraded 2023-07-10 19:03:38 -03:00
Junior Garcia 7e29dddea3 fix(root): tailwind variants updated to fix the perf issues 2023-07-09 21:54:32 -03:00
Junior Garcia 63cf041067 fix(input): on value change 2023-07-09 11:52:19 -03:00
Junior Garcia b4b75444e7 Merge branch 'feat/v2' of github.com:nextui-org/nextui into feat/v2 2023-07-09 11:34:18 -03:00
Junior Garcia 4ec33a4c78 fix(root): input, textarea and accordion perf issues 2023-07-09 11:33:57 -03:00
Jakob Guddas 5acfb2e7a9 fix: fixed modal button press issue (#1186) 2023-07-09 09:00:45 -03:00
Junior Garcia b64e97c94f fix(root): tabs perf issues, accordion overflow 2023-07-08 23:26:08 -03:00
Junior Garcia f4224c9c46 feat(root): new snap 2023-07-08 16:35:03 -03:00
Junior Garcia 75dfb5461d fix(docs): modal position note 2023-07-08 12:38:47 -03:00
Junior Garcia 1251cc9a9b chore(modal): new snapshot 2023-07-08 12:34:54 -03:00
Junior Garcia 4c52d1d1cf chore(modal): mobile transitions improved 2023-07-08 12:14:00 -03:00
Junior Garcia fdc513cefe chore(modal): mobile improvements 2023-07-08 12:12:35 -03:00
Junior Garcia 09f30f93aa feat(modal): mobile transition changed 2023-07-08 11:44:17 -03:00
Junior Garcia 6ccbabe788 chore(accordion): collapse animation changed againe 2023-07-07 21:29:37 -03:00
Junior Garcia d752438a26 chore(accordion): remove unused code 2023-07-07 21:01:13 -03:00
Junior Garcia 653e7d2031 fix(root): radio and checkbox state memoized, accordion transition changed 2023-07-07 20:53:10 -03:00
Junior Garcia 2750189f66 feat(accordion): transition improved 2023-07-06 21:37:29 -03:00
Junior Garcia 29f0d9a937 feat(root): accordion animation improved, units introduced, button spacing migrated to units 2023-07-06 20:28:09 -03:00
Junior Garcia 5b5756bb33 feat(root): new ripple pkg created 2023-07-06 00:08:39 -03:00
Junior Garcia 10ac6ced32 feat(root): animations management improved 2023-07-04 21:54:13 -03:00
Junior Garcia 3b0584ee83 chore(popover): spring transitions changed 2023-07-04 00:53:07 -03:00
Junior Garcia 4567cf525d feat(docs): navbar docs fixed, popover and dropdown animations improved 2023-07-03 22:57:49 -03:00
Ryo Hirama 77d56aae0c fix: warning keys accordion (#1179) 2023-07-03 15:53:23 -03:00
Junior Garcia 81c45e6336 chore(docs): lockfile updated 2023-07-02 20:19:31 -03:00
Junior Garcia 00dcf6cbc8 feat(docs): next-mdx-remote replaced by contentlayer 2023-07-02 20:17:55 -03:00
Junior Garcia eab6dec219 fix(plugin): lodash dependencies 2023-07-02 14:58:26 -03:00
Junior Garcia ca7309c6eb feat(root): needless useId removed since react-aria now supports react 18 2023-07-02 12:37:44 -03:00
Junior Garcia 316010e210 fix(dropdown): styles fixed 2023-07-02 00:48:24 -03:00
Junior Garcia d11a3a8607 chore(root): boundary color removed, dropdown styles changed 2023-07-02 00:36:39 -03:00
Junior Garcia 15b585c51a feat(root): react aria packages upgraded, SSRProvider removed since is no longer needed 2023-07-02 00:20:08 -03:00
Junior Garcia 234f217a1c fix(docs): card examples 2023-07-01 23:31:37 -03:00
Junior Garcia 0267bf7c2f feat(storybook): updated 2023-07-01 20:06:10 -03:00
Junior Garcia 114c3f5a6b feat(root): layout configuration added to the tailwind plugin, components were adapted 2023-07-01 20:03:52 -03:00
Junior Garcia ce9abed071 feat(docs): navbar in progress 2023-06-25 20:36:09 -03:00
Junior Garcia c24efed184 chore(docs): search meta updated 2023-06-25 12:20:03 -03:00
Junior Garcia 6b88866307 feat(docs): dropdown done 2023-06-25 12:01:59 -03:00
Junior Garcia 436fd99b09 feat(docs): dropdown styles and API changed, custom styles examples improved 2023-06-25 00:54:07 -03:00
Junior Garcia 44722b6430 chore(root): dropdown items improved on mobile, colros small changes 2023-06-24 18:58:00 -03:00
Junior Garcia cbced8df45 feat(docs): dropdown docs in progress, some styles changes 2023-06-24 00:39:05 -03:00
Junior Garcia 99993cd332 feat(root): semantic colors improved, dropdown search meta updated 2023-06-23 20:43:49 -03:00
Junior Garcia f5db202b13 feat(docs): dropdown docs almost done 2023-06-23 19:57:30 -03:00
Junior Garcia 1658afc756 feat(docs): dropdown in progress 2023-06-22 23:42:03 -03:00
Junior Garcia f26cfbe9fb feat(root): new snapshot version 2023-06-22 17:39:17 -03:00
TRAN Duc Khanh 1fd3ad5805 fix: fix image loading status (#1175) 2023-06-22 17:12:46 -03:00
Junior Garcia 6ebdcac4fc feat(root): new snapshot 2023-06-21 23:26:03 -03:00
Junior Garcia 19d0766487 fix(pagination): merge conflicts 2023-06-21 23:17:34 -03:00
Junior Garcia d906885857 fix(pagination): touch and select none added 2023-06-21 23:16:54 -03:00
Jakob Guddas 74e7c378a1 fix: fixed pagination problems (#1174)
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
2023-06-21 23:16:26 -03:00
Junior Garcia 21c7934aba feat(root): pagination and tabs improvements, cmdk recent searches fixed 2023-06-21 22:57:07 -03:00
Ryo Matsukawa 73ce35a1b9 feat(tabs): improve tab accessibility (#1172) 2023-06-21 22:54:39 -03:00
Jakob Guddas 4c61bff868 feat: added locale select to storybook toolbar (#1173) 2023-06-21 22:53:07 -03:00
Junior Garcia 7c3df1b0d9 feat(root): new snapshot 2023-06-20 20:19:29 -03:00
Jakob Guddas ced7e6093a feat: added locale prop to NextUIProvider (#1145)
* feat: added locale prop to NextUIProvider

* fix: added missing locale prop in storybook config

* chore: resolved PR comments
2023-06-20 20:08:49 -03:00
Junior Garcia 4ce707d55f fix(pagination): item tap highlight transparent 2023-06-20 17:06:14 -03:00
Junior Garcia e128447be6 chore(docs): tabs custom styles example rollback 2023-06-20 16:55:46 -03:00
Junior Garcia f6e4aa8adf feat(root): utilities, update effect hook added, tabs improvements 2023-06-20 16:47:35 -03:00
Junior Garcia f4c9f21959 Merge branch 'feat/v2' of github.com:nextui-org/nextui into feat/v2 2023-06-20 16:43:12 -03:00
Junior Garcia 230213853e feat(root): tab highlight transparent and scrollbar hide utilities added, tabs improvements 2023-06-20 16:43:00 -03:00
Jakob Guddas 47053f6875 fix: fixed bordered button styling issues inside group (#1169) 2023-06-20 16:41:29 -03:00
Junior Garcia b56a89d0be feat(paignation): automatic scroll added, styles improved 2023-06-20 12:48:35 -03:00
Junior Garcia a27ca56c08 feat(docs): pagination improved 2023-06-20 11:32:53 -03:00
Junior Garcia fdecb49117 feat(root): pagination docs done, colors a11y improved 2023-06-19 21:48:03 -03:00
Jakob Guddas 63a2f2d4b3 test: added contrast test for semantic colors (#1167) 2023-06-19 16:17:18 -03:00
Junior Garcia 3f77004403 feat(docs): pagination in progress 2023-06-19 16:13:35 -03:00
Junior Garcia a5055bc81c feat(root): new snapshot 2023-06-19 10:54:27 -03:00
camcam 9fadc43657 [feat/v2] allow custom prefix in baseStyles (#1152)
* allow custom prefix

* update corePlugin

* Update classes.ts
2023-06-19 10:48:36 -03:00
Junior Garcia dcd8e0b8a9 feat(root): modal improved, flat colors changed 2023-06-19 10:28:50 -03:00
Junior Garcia 0d16f7d78a fix(docs): build 2023-06-18 23:05:05 -03:00
Junior Garcia bb0fa71e69 feat(docs): search match imporoved, recents search added, navbar items clicable section increased 2023-06-18 22:41:02 -03:00
Junior Garcia a30ba4bc95 fix(docs): a11y section button color 2023-06-18 17:10:37 -03:00
Junior Garcia 06bae4ffaf chore(docs): esc key on cmdk removed from mobile 2023-06-18 15:54:38 -03:00
Junior Garcia a3979a88a8 feat(docs): table header background changed 2023-06-18 15:40:36 -03:00
Junior Garcia cfaf732d27 fix(docs): main content z-index 2023-06-18 15:27:18 -03:00
Junior Garcia 98f0f2357d fix(docs): cmk modal max width 2023-06-18 15:15:37 -03:00
Junior Garcia 129b30f956 feat(docs): search cmdk implemented 2023-06-18 15:06:43 -03:00
Junior Garcia 71741a115a feat(docs): modal docs done 2023-06-17 11:27:01 -03:00
Junior Garcia 4e29da6196 feat(docs): modal custom styles highlighted lines added 2023-06-16 23:25:26 -03:00
Junior Garcia 5da8ea5d0b feat(docs): modal examples added 2023-06-16 23:24:10 -03:00
Junior Garcia 21536b82fc fix(docs): toc overflow 2023-06-16 22:09:44 -03:00
Junior Garcia b475f892e2 feat(root): new snapshot 2023-06-16 21:55:11 -03:00
Junior Garcia 38114b16da feat(root): tv upgraded, modal docs improved, search meta script added 2023-06-16 21:34:41 -03:00
Junior Garcia 5e33f2c816 feat(root): modal, popover and navbar menu issues fixed, navbar styles simplified, docs improved 2023-06-15 23:48:25 -03:00
Junior Garcia 56e8aba53a feat(docs): avatar api updated, small improvements applied 2023-06-15 00:14:40 -03:00
Junior Garcia c589405b94 fix(root): pkg lock 2023-06-14 23:47:34 -03:00
Junior Garcia e70819ec7b feat(docs): a11y and performance optimizations on landing page 2023-06-14 23:46:12 -03:00
Junior Garcia 3406c29911 feat(root): packages updated 2023-06-14 01:48:42 -03:00
Junior Garcia 1ec784b3a5 feat(docs): migrated to app directory 2023-06-14 00:18:45 -03:00
Junior Garcia 810f2b2bd9 fix(root): pkg lock 2023-06-13 18:30:23 -03:00
Junior Garcia e802caa412 feat(docs): home migrated to app directory 2023-06-13 18:29:03 -03:00
Junior Garcia cfa43f22c7 feat(root): warning and success colors a11y improved on light theme, docs bugs fixed 2023-06-12 19:16:18 -03:00
Junior Garcia 0ac048c11f fix(docs): build 2023-06-12 18:52:32 -03:00
Junior Garcia 57ec8944c3 fix(docs): modal dynamic height, snadpack editor replaced by codeblock 2023-06-12 18:41:55 -03:00
Junior Garcia aceafaff56 feat(docs): modal docs in progress 2023-06-10 19:03:49 -03:00
Junior Garcia 5a7e63a40a feat(modal): improved on mobile 2023-06-09 23:51:11 -03:00
Junior Garcia c4f8d7015b feat(docs): scroll mask image linear gradient added to sidebar and toc 2023-06-09 22:25:17 -03:00
Junior Garcia 0a3ea728a1 fix(docs): hero height 2023-06-09 19:36:45 -03:00
Junior Garcia 1ce246d0ad feat(docs): accordion improved, badge fixed, modal started 2023-06-09 19:28:07 -03:00
Junior Garcia d165a4beb6 fix(root): button ring and examples 2023-06-08 21:38:21 -03:00
Junior Garcia 10c1292fc5 feat(docs): tabs docs done 2023-06-08 21:03:40 -03:00
Junior Garcia 27041fa545 fix(docs): tooltip docs 2023-06-06 23:44:57 -03:00
Junior Garcia 54e9c8231f feat(docs): tooltip docs done 2023-06-06 22:36:56 -03:00
Junior Garcia 8ee4cd4e0c feat(docs): popover docs done 2023-06-06 17:38:38 -03:00
Junior Garcia 87ea9a9eba fix(docs): intl message dependency, examples layout improved 2023-06-06 16:04:51 -03:00
Kyun Heo 720d944acd fix: add framer motion to snippet component peerDependencies (#1148) 2023-06-06 11:05:19 -03:00
Junior Garcia cfd6555d6d feat(docs): popover examples added 2023-06-05 23:46:57 -03:00
Junior Garcia 8df3fe624a Merge branch 'feat/v2' of github.com:nextui-org/nextui into feat/v2 2023-06-05 23:10:13 -03:00
Junior Garcia d686129687 chore(root): borders changed, types fixed 2023-06-05 23:08:50 -03:00
Jakob Guddas 2207771540 docs: updated story to use link component instead of basic anchor (#1146) 2023-06-05 23:02:26 -03:00
Junior Garcia b62ca94458 feat(docs): popover docs almost done 2023-06-04 23:33:02 -03:00
Junior Garcia 76a5c07e1f chore(docs): switch icons example color changed 2023-06-04 17:51:15 -03:00
Junior Garcia 51c6b291d5 feat(docs): switch docs done 2023-06-04 17:46:02 -03:00
Junior Garcia c5bcd70457 feat(docs): radio group done 2023-06-04 16:18:32 -03:00
Junior Garcia 78f1c5f957 feat(docs): radio group in progress 2023-06-03 16:40:03 -03:00
Junior Garcia 1ccdfb5b98 fix(docs): image events title 2023-06-03 15:56:29 -03:00
Junior Garcia dc5e4a1fd2 feat(docs): image docs done 2023-06-03 15:42:08 -03:00
Junior Garcia 51cc2f6531 fix(docs): image 2023-06-03 11:06:57 -03:00
Junior Garcia 45bb9fddc4 fix(docs): pkg imports 2023-06-03 10:40:53 -03:00
Junior Garcia a09258b47c fix(docs): checkbox custom styles 2023-06-02 17:45:23 -03:00
Junior Garcia 3a4c530785 fix(docs): nextjs templates 2023-06-02 11:44:33 -03:00
Junior Garcia 8d22a7bc56 feat(root): react aria packages upgraded, fix input types 2023-06-01 22:31:04 -03:00
Junior Garcia 017d40b623 chore(storybook): deployed 2023-05-31 21:34:23 -03:00
Junior Garcia a1f5109365 fix(docs): button colors names 2023-05-31 21:31:05 -03:00
Junior Garcia 25db8f732d fix(docs): lsc navbar fixed 2023-05-31 21:28:44 -03:00
Junior Garcia 89f2bc9be4 feat(docs): some improvements applied, button and spinner styles fixed 2023-05-31 21:20:49 -03:00
Junior Garcia 4b8655e267 feat(docs): textarea docs done 2023-05-30 23:05:11 -03:00
Junior Garcia 849dd9948b chore(docs): textarea docs in progress 2023-05-30 19:38:06 -03:00
Junior Garcia e42d3ab751 chore(docs): mobile navbar enhacements 2023-05-30 19:21:26 -03:00
Junior Garcia e7bfb81b48 feat(docs): mobile navbar improved 2023-05-30 19:16:56 -03:00
Junior Garcia 5df7003482 fix(docs): unified pkg 2023-05-30 18:53:54 -03:00
Junior Garcia 131330713f chore(root): pkg lock updated 2023-05-30 18:40:20 -03:00
Junior Garcia 6f12edbfc6 feat(docs): headings and toc enhacements 2023-05-30 18:38:13 -03:00
Junior Garcia 0e558c60c3 feat(docs): docs structure improved, steps added and toc autoscroll 2023-05-29 23:29:26 -03:00
Junior Garcia a0504a8e0e fix(root): card npm pkg 2023-05-29 20:03:23 -03:00
Junior Garcia 36ba63ff10 feat(docs): input examples responsive improved 2023-05-29 19:56:18 -03:00
Junior Garcia e8dbcab525 feat(docs): input docs done 2023-05-29 19:49:54 -03:00
Junior Garcia 2e4f54a06b feat(docs): input docs in progress 2023-05-28 23:53:22 -03:00
Junior Garcia bb27ca5e11 feat(docs): skeleton docs fixed, redirection added 2023-05-28 19:42:34 -03:00
Junior Garcia 21cae37835 fix(docs): snippet url 2023-05-28 16:23:34 -03:00
Junior Garcia 6a4e16b224 fix(docs): small fixes 2023-05-28 16:23:01 -03:00
Junior Garcia 1569b59725 feat(docs): snippet done 2023-05-28 16:17:22 -03:00
Junior Garcia 6cb0e5a97b feat(docs): skeleton docs completed, navbar menu toggle fixed 2023-05-28 12:34:29 -03:00
Junior Garcia e7f9579389 feat(docs): skeleton docs in progress 2023-05-28 01:17:12 -03:00
Junior Garcia e8fb0c7a09 feat(docs): user docs added 2023-05-28 00:30:22 -03:00
Junior Garcia 90e76df87d feat(docs): progress done, internal APi improved 2023-05-27 23:25:11 -03:00
Junior Garcia 0ac5a339f4 feat(docs): link done 2023-05-27 22:40:39 -03:00
Junior Garcia 69d9e2bcdc feat(docs): link done 2023-05-27 22:38:13 -03:00
camcam 102387a004 fix(Link): fix unknown event warning when passing onPress prop (#1135)
* fix(Link): fix warning unknown event when passing onPress prop

* add useCallback
2023-05-27 22:23:23 -03:00
Junior Garcia fa404913bd feat(docs): import tabs added, link docs in progress 2023-05-27 20:23:15 -03:00
Junior Garcia bee0c50c4b refactor(docs): neutral color renamed to default, next.js guide fixed 2023-05-27 11:55:59 -03:00
Junior Garcia 0b3ebbcfdf feat(docs): navbar manifest added 2023-05-27 10:32:39 -03:00
Junior Garcia dc0b3897d0 feat(docs): spinner docs added 2023-05-26 21:28:46 -03:00
Junior Garcia 2cb983af3e feat(docs): spacer added 2023-05-26 20:56:27 -03:00
Junior Garcia a0d4d39eab fix(docs): kbd api overflow 2023-05-26 20:28:01 -03:00
Junior Garcia c00d3f3199 feat(docs): kbd docs added 2023-05-26 20:18:45 -03:00
Junior Garcia f564f5bd2a fix(docs): data attributes section on divider 2023-05-26 19:46:55 -03:00
Junior Garcia 62c3c71e9e feat(docs): divider docs added 2023-05-26 19:45:57 -03:00
Junior Garcia f7c77e2f14 feat(docs): code documentation added 2023-05-26 19:35:44 -03:00
Junior Garcia 088c08dd63 feat(docs): circular progress improved 2023-05-26 19:11:27 -03:00
Junior Garcia 5168f4f495 feat(docs): chip and circular progress done 2023-05-26 19:02:17 -03:00
Junior Garcia d9228c1e3b feat(docs): checkbox group docs done 2023-05-26 00:16:34 -03:00
Junior Garcia 04e9836b73 fix(docs): min height viewport 2023-05-25 23:04:16 -03:00
Junior Garcia 242b1a5584 chore(root): new snapshot 2023-05-25 18:50:49 -03:00
Junior Garcia f8137b04fa chore(link): remove comment 2023-05-24 23:58:45 -03:00
camcam 5b9d85e098 Chore(Link): Remove code redundancies (#1111) 2023-05-24 23:58:11 -03:00
Junior Garcia 8b324d3943 chore(docs): a11y section added to checkbox docs 2023-05-24 23:01:07 -03:00
Junior Garcia 46ad6f7cd8 feat(docs): checkbox docs added 2023-05-24 22:52:14 -03:00
Junior Garcia 5dd095aecc feat(docs): badge done 2023-05-21 11:21:55 -03:00
1491 changed files with 103673 additions and 49335 deletions
+7 -1
View File
@@ -1,12 +1,18 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"changelog": [
"@changesets/changelog-github",
{ "repo": "nextui-org/nextui" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
},
"ignore": [
"@nextui-org/docs",
"@nextui-org/storybook"
+2 -1
View File
@@ -1,7 +1,7 @@
.now/*
.next/*
*.css
examples/*
.changeset
dist
esm/*
public/*
@@ -22,3 +22,4 @@ build
!react-shim.js
!tsup.config.ts
apps/docs/preinstall.js
apps/docs/next-redirect.js
+10
View File
@@ -21,6 +21,16 @@ body:
- NextUI's [Discussions tab](https://github.com/nextui-org/nextui/discussions)
The more information you fill in, the better the community can help you.
- type: input
id: version
attributes:
label: NextUI Version
description: |
Please provide the version of NextUI you are using.
You can find the version number in the package.json file.
placeholder: ex. 2.0.10
validations:
required: true
- type: textarea
id: description
attributes:
+27
View File
@@ -0,0 +1,27 @@
name: "Install"
description: "Sets up Node.js and runs install"
runs:
using: composite
steps:
- name: Install dependencies
uses: pnpm/action-setup@v2.2.4
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Setup Git User
shell: bash
run: |
git config --global user.email "jrgarciadev@gmail.com"
git config --global user.name "Junior Garcia"
- name: Install dependencies
shell: bash
run: pnpm install
+72
View File
@@ -0,0 +1,72 @@
name: QA
on:
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Install
uses: ./.github/common-actions/install
- name: Build packages
run: pnpm build
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Install
uses: ./.github/common-actions/install
- name: Run tests
run: pnpm test
eslint:
name: ESLint
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Install
uses: ./.github/common-actions/install
- name: Run ESLint
run: pnpm lint
types:
name: TypeScript
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Install
uses: ./.github/common-actions/install
- name: Run typecheck
run: pnpm typecheck
prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Install
uses: ./.github/common-actions/install
- name: Run prettier
run: pnpm format:check
-128
View File
@@ -1,128 +0,0 @@
name: CI/CD
on:
push:
branches: [main]
paths-ignore: ['**/README.md']
pull_request:
branches: [main]
types: [opened, synchronize]
paths-ignore: ['**/README.md']
jobs:
avoid_reduncy:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' }}
steps:
- name: Cancel Previous Redundant Builds
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: '16'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: '16'
- name: Install dependencies
run: yarn install --frozen-lockfile
- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: Build
run: yarn build
tests:
needs: [lint, build]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: '16'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test
run: yarn coverage:update
- uses: codecov/codecov-action@v2
with:
directory: './packages/react'
publish:
needs: [build, tests]
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: '16'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Pre puiblish NextUI package
run: yarn pre-publish:nextui
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: './packages/react/lib/package.json'
- name: Show published version
if: steps.publish.outputs.type != 'none'
run: |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
- name: Tag new version
if: steps.publish.outputs.type != 'none'
uses: Klemensas/action-autotag@stable
with:
GITHUB_TOKEN: ${{ github.token }}
tag_prefix: "v"
package_root: "./packages/react"
update_algolia_index:
needs: [publish]
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version: '16'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Upload docs on Algolia
run: yarn build:docs-meta
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}
+45 -10
View File
@@ -1,17 +1,52 @@
name: Tagged Release
name: Release
on:
push:
tags:
- "v*"
paths:
- ".changeset/**"
- "packages/**"
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
tagged-release:
name: Tagged Release
runs-on: ubuntu-18.04
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: "marvinpinto/action-automatic-releases@latest"
- name: Checkout branch
uses: actions/checkout@v3
- name: Install
uses: ./.github/common-actions/install
- name: Build
run: pnpm build
- name: Tests
run: pnpm test
- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: changesets/action@v1
with:
repo_token: "${{ github.token }}"
prerelease: false
publish: pnpm release
title: "ci(changesets): :package: version packages"
commit: "ci(changesets): version packages"
setupGitUser: false
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create @dev release
if: steps.changesets.outputs.published != 'true'
run: |
git checkout main
pnpm version:dev
pnpm release:dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+6
View File
@@ -20,6 +20,7 @@ coverage
dist/
storybook-static
/packages/storybook/public/tailwind.css
# misc
.DS_Store
.env
@@ -48,6 +49,8 @@ esm
examples/**/yarn.lock
examples/**/out
examples/**/.next
packages/**/*.backup
packages/**/*.backup.ts
.vercel
@@ -57,3 +60,6 @@ apps/**/sitemap.xml
# turbo
.turbo
packages/**/.turbo
# content layer
.contentlayer
+2 -2
View File
@@ -13,12 +13,12 @@ const removeIgnoredFiles = async (files) => {
};
module.exports = {
"**/*.{cjs,mjs,js,ts,jsx,tsx}": async (files) => {
"**/*.{js,ts,jsx,tsx}": async (files) => {
const filesToLint = await removeIgnoredFiles(files);
return [`eslint -c .eslintrc.json --max-warnings=0 --fix ${filesToLint}`];
},
"**/*.{css,json,md}": async (files) => {
"**/*.css": async (files) => {
const filesToLint = await removeIgnoredFiles(files);
return [`prettier --config .prettierrc.json --ignore-path --write ${filesToLint}`];
+1 -1
View File
@@ -1,8 +1,8 @@
dist
examples
node_modules
plop
coverage
.changeset
.next
build
scripts
+1 -1
View File
@@ -182,7 +182,7 @@ pnpm test:update src/button # or npm run test:update src/button
pnpm build # or npm run build
```
> Note: ensure your version of Node is 14 or higher to run scripts
> Note: ensure your version of Node is 16 or higher to run scripts
6. Send your pull request:
+1 -1
View File
@@ -9,7 +9,7 @@ NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY=
# Vercel Env (is used for skipping typescript check)
IS_VERCEL_ENV=true/false
IS_PREVIEW=true/false
ANALYZE_BUNDLE=true/false
# Vercel preview env (is used for taking the docs directly from the project files)
NEXT_PUBLIC_PREVIEW=true/false
+312
View File
@@ -0,0 +1,312 @@
[
{
"MemberId": 275354,
"createdAt": "2022-02-18 11:57",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 5,
"currency": "USD",
"lastTransactionAt": "2022-02-18 11:57",
"lastTransactionAmount": 5,
"profile": "https://opencollective.com/guest-7dc076fb",
"name": "jorge",
"company": null,
"description": null,
"image": "/sponsors/undefined",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 277819,
"createdAt": "2022-03-01 09:13",
"type": "USER",
"role": "BACKER",
"isActive": true,
"totalAmountDonated": 10,
"currency": "USD",
"lastTransactionAt": "2022-03-01 09:13",
"lastTransactionAmount": 10,
"profile": "https://opencollective.com/dhananjay-senday",
"name": "Dhananjay Senday",
"company": null,
"description": null,
"image": "/sponsors/undefined",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 292380,
"createdAt": "2022-04-22 07:47",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 10,
"currency": "USD",
"lastTransactionAt": "2022-04-22 07:47",
"lastTransactionAmount": 10,
"profile": "https://opencollective.com/manuel5",
"name": "manuel-rw",
"company": null,
"description": null,
"image": "/sponsors/292380.jpg",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 327844,
"createdAt": "2022-08-26 21:32",
"type": "ORGANIZATION",
"role": "BACKER",
"tier": "Gold Sponsor 🥇",
"isActive": true,
"totalAmountDonated": 200,
"currency": "USD",
"lastTransactionAt": "2022-12-22 07:19",
"lastTransactionAmount": 100,
"profile": "https://opencollective.com/lowdefy",
"name": "Lowdefy",
"company": null,
"description": "Create custom web apps in minutes",
"image": "/sponsors/327844.jpg",
"twitter": "https://twitter.com/lowdefy",
"github": "https://github.com/lowdefy",
"website": "https://lowdefy.com"
},
{
"MemberId": 347048,
"createdAt": "2022-10-30 06:25",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 1,
"currency": "USD",
"lastTransactionAt": "2022-10-30 06:25",
"lastTransactionAmount": 1,
"profile": "https://opencollective.com/william-frank-monroy-mamani",
"name": "William Frank Monroy Mamani",
"company": null,
"description": null,
"image": "/sponsors/347048.jpg",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 374896,
"createdAt": "2022-12-22 05:28",
"type": "ORGANIZATION",
"role": "BACKER",
"tier": "bronze sponsor 🥉",
"isActive": true,
"totalAmountDonated": 70,
"currency": "USD",
"lastTransactionAt": "2023-07-02 09:04",
"lastTransactionAmount": 10,
"profile": "https://opencollective.com/chartbrew",
"name": "Chartbrew",
"company": null,
"description": "Open source visualization and reporting platform",
"image": "/sponsors/374896.jpg",
"twitter": null,
"github": null,
"website": "https://chartbrew.com"
},
{
"MemberId": 375034,
"createdAt": "2022-12-22 13:16",
"type": "USER",
"role": "BACKER",
"isActive": true,
"totalAmountDonated": 50,
"currency": "USD",
"lastTransactionAt": "2022-12-22 13:16",
"lastTransactionAmount": 50,
"profile": "https://opencollective.com/jan-wagebach",
"name": "PRISMA European Capacity Platform GmbH",
"company": "PRISMA European Capacity Platform GmbH",
"description": null,
"image": "/sponsors/375034.jpg",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 395990,
"createdAt": "2023-02-11 13:12",
"type": "ORGANIZATION",
"role": "BACKER",
"tier": "Gold Sponsor 🥇",
"isActive": true,
"totalAmountDonated": 100,
"currency": "USD",
"lastTransactionAt": "2023-02-11 13:12",
"lastTransactionAmount": 100,
"profile": "https://opencollective.com/likn",
"name": "LIKN",
"company": null,
"description": "LIKN is a powerful, but simple Web3 component and protocol. Connect Web2 content to Web3, and solely mint content NFTs by URL. Share and Trade in different platforms and marketplaces. OpenAI empowers LIKN which can automatically generate NFT metadata. ",
"image": "/sponsors/395990.jpg",
"twitter": "https://twitter.com/oxlikn",
"github": "https://github.com/0xLIKN",
"website": "https://www.likn.co/?ref=opencollective"
},
{
"MemberId": 404415,
"createdAt": "2023-03-01 16:22",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 1,
"currency": "USD",
"lastTransactionAt": "2023-03-01 16:22",
"lastTransactionAmount": 1,
"profile": "https://opencollective.com/rharison-lucas-moreira-abreu",
"name": "Rharison Lucas Moreira Abreu",
"company": null,
"description": null,
"image": "/sponsors/404415.jpg",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 407510,
"createdAt": "2023-03-07 22:27",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 1,
"currency": "USD",
"lastTransactionAt": "2023-03-07 22:27",
"lastTransactionAmount": 1,
"profile": "https://opencollective.com/higherror",
"name": "HighError",
"company": null,
"description": null,
"image": "/sponsors/407510.jpg",
"email": null,
"twitter": null,
"github": "https://github.com/HighError",
"website": "https://higherror.github.io/"
},
{
"MemberId": 409558,
"createdAt": "2023-03-12 21:41",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 1,
"currency": "USD",
"lastTransactionAt": "2023-03-12 21:41",
"lastTransactionAmount": 1,
"profile": "https://opencollective.com/guest-6133a45c",
"name": "Kristof",
"company": null,
"description": null,
"image": "/sponsors/undefined",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 438158,
"createdAt": "2023-05-31 22:44",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 5,
"currency": "USD",
"lastTransactionAt": "2023-05-31 22:44",
"lastTransactionAmount": 5,
"profile": "https://opencollective.com/elektrnik",
"name": "ELEKTRNIK",
"company": null,
"description": null,
"image": "/sponsors/438158.jpg",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 438877,
"createdAt": "2023-06-02 17:56",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 1,
"currency": "USD",
"lastTransactionAt": "2023-06-02 17:56",
"lastTransactionAmount": 1,
"profile": "https://opencollective.com/guest-425370ea",
"name": "Gabriel Jiménez",
"company": null,
"description": null,
"image": "/sponsors/undefined",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 439182,
"createdAt": "2023-06-03 15:15",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 1,
"currency": "USD",
"lastTransactionAt": "2023-06-03 15:15",
"lastTransactionAmount": 1,
"profile": "https://opencollective.com/jay-thanawut1",
"name": "Jay Thanawut",
"company": null,
"description": null,
"image": "/sponsors/439182.jpg",
"email": null,
"twitter": null,
"github": null,
"website": null
},
{
"MemberId": 442878,
"createdAt": "2023-06-13 13:51",
"type": "USER",
"role": "BACKER",
"tier": "Backer 🖤",
"isActive": true,
"totalAmountDonated": 5,
"currency": "USD",
"lastTransactionAt": "2023-06-13 13:51",
"lastTransactionAmount": 5,
"profile": "https://opencollective.com/encurme",
"name": "EncurMe",
"company": "EncurMe",
"description": null,
"image": "/sponsors/442878.jpg",
"email": null,
"twitter": null,
"github": null,
"website": "https://encur.me/"
}
]
+127
View File
@@ -0,0 +1,127 @@
import type {Metadata} from "next";
import {notFound} from "next/navigation";
import {allBlogPosts} from "contentlayer/generated";
import {Link, User} from "@nextui-org/react";
import {format, parseISO} from "date-fns";
import NextLink from "next/link";
import {Balancer} from "react-wrap-balancer";
import {MDXContent} from "@/components/mdx-content";
import {siteConfig} from "@/config/site";
import {Route} from "@/libs/docs/page";
import {ChevronRightLinearIcon} from "@/components/icons";
interface BlogPostProps {
params: {
slug: string;
};
}
async function getBlogPostFromParams({params}: BlogPostProps) {
const slug = params.slug || "";
const post = allBlogPosts.find((post) => post.slugAsParams === slug);
if (!post) {
null;
}
const currentRoute: Route = {
key: post?._id,
title: post?.title,
path: `/${post?._raw?.sourceFilePath}`,
};
return {post, currentRoute};
}
export async function generateMetadata({params}: BlogPostProps): Promise<Metadata> {
const {post} = await getBlogPostFromParams({params});
if (!post) {
return {};
}
return {
title: post.title,
description: post.description,
openGraph: {
title: post.title,
description: post.description,
type: "article",
url: post.url,
images: [
{
url: post.imageAsParams || siteConfig.ogImage,
width: 1200,
height: 630,
alt: post.title || siteConfig.name,
},
],
},
twitter: {
card: "summary_large_image",
title: post.title,
description: post.description,
images: [siteConfig.ogImage],
creator: siteConfig.creator,
},
};
}
export async function generateStaticParams(): Promise<BlogPostProps["params"][]> {
return allBlogPosts.map((doc) => ({
slug: doc.slugAsParams,
}));
}
export default async function DocPage({params}: BlogPostProps) {
const {post} = await getBlogPostFromParams({params});
if (!post) {
notFound();
}
return (
<div className="w-full mt-12 flex flex-col justify-start items-center prose prose-neutral">
<div className="w-full max-w-4xl">
<Link
isBlock
as={NextLink}
className="mb-8 -ml-3 text-default-500 hover:text-default-900"
color="foreground"
href="/blog"
size="sm"
>
<ChevronRightLinearIcon className="rotate-180 inline-block mr-1" size={15} />
Back to blog
</Link>
<time className="block text-small mb-2 text-default-500" dateTime={post.date}>
{format(parseISO(post.date), "LLLL d, yyyy")}
</time>
<div className="mb-3 flex w-full flex-col items-start">
<User
isExternal
as={Link}
avatarProps={{
className: "w-9 h-9 text-large",
src: post.author?.avatar,
}}
className="hover:opacity-100"
classNames={{
base: "-ml-2 px-2 py-1.5 hover:bg-default-100 dark:hover:bg-default-50 cursor-pointer transition-colors",
name: "text-foreground",
}}
description={post.author?.username}
href={post.author?.link}
name={post.author?.name}
/>
</div>
<h1 className="mb-2 font-bold text-4xl">
<Balancer>{post.title}</Balancer>
</h1>
<MDXContent code={post.body.code} />
</div>
</div>
);
}
+27
View File
@@ -0,0 +1,27 @@
import {Image} from "@nextui-org/react";
interface DocsLayoutProps {
children: React.ReactNode;
}
export default function DocsLayout({children}: DocsLayoutProps) {
return (
<>
<main className="relative container mx-auto max-w-7xl z-10 px-6 min-h-[calc(100vh_-_64px_-_108px)] mb-12 flex-grow">
{children}
</main>
<div
aria-hidden="true"
className="fixed hidden dark:md:block dark:opacity-70 -bottom-[40%] -left-[20%] z-0"
>
<Image removeWrapper alt="docs left background" src="/gradients/docs-left.png" />
</div>
<div
aria-hidden="true"
className="fixed hidden dark:md:block dark:opacity-70 -top-[80%] -right-[60%] 2xl:-top-[60%] 2xl:-right-[45%] z-0 rotate-12"
>
<Image removeWrapper alt="docs right background" src="/gradients/docs-right.png" />
</div>
</>
);
}
+18
View File
@@ -0,0 +1,18 @@
import {allBlogPosts} from "contentlayer/generated";
import {compareDesc} from "date-fns";
import {BlogPostList} from "@/components/blog-post";
export default function Blog() {
const posts = allBlogPosts.sort((a, b) => compareDesc(new Date(a.date), new Date(b.date)));
return (
<div className="w-full lg:px-16 mt-12">
<div className="text-center">
<h1 className="mb-2 font-bold text-4xl">NextUI Latest Updates</h1>
<h5 className="text-default-500 text-lg">All the latest news about NextUI.</h5>
</div>
<BlogPostList posts={posts} />
</div>
);
}
+108
View File
@@ -0,0 +1,108 @@
import type {Metadata} from "next";
import {notFound} from "next/navigation";
import {allDocs} from "contentlayer/generated";
import {Link} from "@nextui-org/react";
import {MDXContent} from "@/components/mdx-content";
import {siteConfig} from "@/config/site";
import {DocsPager, DocsToc} from "@/components/docs";
import {Route} from "@/libs/docs/page";
import {GITHUB_URL, REPO_NAME} from "@/libs/github/constants";
import {CONTENT_PATH, TAG} from "@/libs/docs/config";
import {getHeadings} from "@/libs/docs/utils";
interface DocPageProps {
params: {
slug: string[];
};
}
async function getDocFromParams({params}: DocPageProps) {
const slug = params.slug?.join("/") || "";
const doc = allDocs.find((doc) => doc.slugAsParams === slug);
if (!doc) {
null;
}
const headings = getHeadings(doc?.body.raw);
const currentRoute: Route = {
key: doc?._id,
title: doc?.title,
path: `/${doc?._raw?.sourceFilePath}`,
};
return {doc, headings, currentRoute};
}
export async function generateMetadata({params}: DocPageProps): Promise<Metadata> {
const {doc} = await getDocFromParams({params});
if (!doc) {
return {};
}
return {
title: doc.title,
description: doc.description,
openGraph: {
title: doc.title,
description: doc.description,
type: "article",
url: doc.url,
images: [
{
url: siteConfig.ogImage,
width: 1200,
height: 630,
alt: siteConfig.name,
},
],
},
twitter: {
card: "summary_large_image",
title: doc.title,
description: doc.description,
images: [siteConfig.ogImage],
creator: siteConfig.creator,
},
};
}
export async function generateStaticParams(): Promise<DocPageProps["params"][]> {
return allDocs.map((doc) => ({
slug: doc.slugAsParams.split("/"),
}));
}
export default async function DocPage({params}: DocPageProps) {
const {doc, headings, currentRoute} = await getDocFromParams({params});
if (!doc) {
notFound();
}
const editUrl = `${GITHUB_URL}/${REPO_NAME}/edit/${TAG}/${CONTENT_PATH}${currentRoute?.path}`;
return (
<>
<div className="col-span-12 lg:col-span-10 xl:col-span-8 lg:px-16 mt-10">
<div className="w-full prose prose-neutral">
<MDXContent code={doc.body.code} />
</div>
{currentRoute && <DocsPager currentRoute={currentRoute} />}
<footer>
<Link isExternal showAnchorIcon href={editUrl} size="sm">
Edit this page on GitHub
</Link>
</footer>
</div>
{headings && headings.length > 0 && (
<div className="hidden z-10 xl:flex xl:col-span-2 mt-8 pl-4">
<DocsToc headings={headings} />
</div>
)}
</>
);
}
+35
View File
@@ -0,0 +1,35 @@
import {Image} from "@nextui-org/react";
import manifest from "@/config/routes.json";
import {DocsSidebar} from "@/components/docs/sidebar";
interface DocsLayoutProps {
children: React.ReactNode;
}
export default function DocsLayout({children}: DocsLayoutProps) {
return (
<>
<main className="relative container mx-auto max-w-7xl z-10 px-6 min-h-[calc(100vh_-_64px_-_108px)] mb-12 flex-grow">
<div className="grid grid-cols-12">
<div className="hidden overflow-visible relative z-10 lg:block lg:col-span-2 mt-8 pr-4">
<DocsSidebar routes={manifest.routes} />
</div>
{children}
</div>
</main>
<div
aria-hidden="true"
className="fixed hidden dark:md:block dark:opacity-70 -bottom-[40%] -left-[20%] z-0"
>
<Image removeWrapper alt="docs left background" src="/gradients/docs-left.png" />
</div>
<div
aria-hidden="true"
className="fixed hidden dark:md:block dark:opacity-70 -top-[80%] -right-[60%] 2xl:-top-[60%] 2xl:-right-[45%] z-0 rotate-12"
>
<Image removeWrapper alt="docs right background" src="/gradients/docs-right.png" />
</div>
</>
);
}
@@ -0,0 +1,47 @@
/* eslint-disable no-console */
"use client";
import * as React from "react";
import {Autocomplete, AutocompleteItem} from "@nextui-org/react";
import {useAsyncList} from "@react-stately/data";
type SWCharacter = {
name: string;
height: string;
mass: string;
birth_year: string;
};
export default function Page() {
let list = useAsyncList<SWCharacter>({
async load({signal, filterText}) {
let res = await fetch(`https://swapi.py4e.com/api/people/?search=${filterText}`, {signal});
let json = await res.json();
return {
items: json.results,
};
},
});
return (
<div className="p-6">
<Autocomplete
className="max-w-xs"
inputValue={list.filterText}
isLoading={list.isLoading}
items={list.items}
label="Select a character"
placeholder="Type to search..."
variant="bordered"
onInputChange={list.setFilterText}
>
{(item) => (
<AutocompleteItem key={item.name} className="capitalize">
{item.name}
</AutocompleteItem>
)}
</Autocomplete>
</div>
);
}
@@ -0,0 +1,113 @@
/* eslint-disable no-console */
"use client";
import * as React from "react";
import {Autocomplete, AutocompleteItem} from "@nextui-org/react";
import {useInfiniteScroll} from "@nextui-org/use-infinite-scroll";
type Pokemon = {
name: string;
url: string;
};
type UsePokemonListProps = {
/** Delay to wait before fetching more items */
fetchDelay?: number;
};
function usePokemonList({fetchDelay = 0}: UsePokemonListProps = {}) {
const [items, setItems] = React.useState<Pokemon[]>([]);
const [hasMore, setHasMore] = React.useState(true);
const [isLoading, setIsLoading] = React.useState(false);
const [offset, setOffset] = React.useState(0);
const limit = 10; // Number of items per page, adjust as necessary
const loadPokemon = async (currentOffset: number) => {
const controller = new AbortController();
const {signal} = controller;
try {
setIsLoading(true);
if (offset > 0) {
// Delay to simulate network latency
await new Promise((resolve) => setTimeout(resolve, fetchDelay));
}
let res = await fetch(
`https://pokeapi.co/api/v2/pokemon?offset=${currentOffset}&limit=${limit}`,
{signal},
);
if (!res.ok) {
throw new Error("Network response was not ok");
}
let json = await res.json();
setHasMore(json.next !== null);
// Append new results to existing ones
setItems((prevItems) => [...prevItems, ...json.results]);
} catch (error) {
// @ts-ignore
if (error.name === "AbortError") {
console.log("Fetch aborted");
} else {
console.error("There was an error with the fetch operation:", error);
}
} finally {
setIsLoading(false);
}
};
React.useEffect(() => {
loadPokemon(offset);
}, []);
const onLoadMore = () => {
const newOffset = offset + limit;
setOffset(newOffset);
loadPokemon(newOffset);
};
return {
items,
hasMore,
isLoading,
onLoadMore,
};
}
export default function Page() {
const [isOpen, setIsOpen] = React.useState(false);
const {items, hasMore, isLoading, onLoadMore} = usePokemonList({fetchDelay: 1500});
const [, scrollerRef] = useInfiniteScroll({
hasMore,
isEnabled: isOpen,
shouldUseLoader: false, // We don't want to show the loader at the bottom of the list
onLoadMore,
});
return (
<div className="p-6">
<Autocomplete
className="max-w-xs"
defaultItems={items}
isLoading={isLoading}
label="Pick a Pokemon"
placeholder="Select a Pokemon"
scrollRef={scrollerRef}
variant="bordered"
onOpenChange={setIsOpen}
>
{(item) => (
<AutocompleteItem key={item.name} className="capitalize">
{item.name}
</AutocompleteItem>
)}
</Autocomplete>
</div>
);
}
@@ -0,0 +1,107 @@
"use client";
import * as React from "react";
import {Autocomplete, AutocompleteItem, MenuTriggerAction} from "@nextui-org/react";
import {useFilter} from "@react-aria/i18n";
const animals = [
{label: "Cat", value: "cat", description: "The second most popular pet in the world"},
{label: "Dog", value: "dog", description: "The most popular pet in the world"},
{label: "Elephant", value: "elephant", description: "The largest land animal"},
{label: "Lion", value: "lion", description: "The king of the jungle"},
{label: "Tiger", value: "tiger", description: "The largest cat species"},
{label: "Giraffe", value: "giraffe", description: "The tallest land animal"},
{
label: "Dolphin",
value: "dolphin",
description: "A widely distributed and diverse group of aquatic mammals",
},
{label: "Penguin", value: "penguin", description: "A group of aquatic flightless birds"},
{label: "Zebra", value: "zebra", description: "A several species of African equids"},
{
label: "Shark",
value: "shark",
description: "A group of elasmobranch fish characterized by a cartilaginous skeleton",
},
{
label: "Whale",
value: "whale",
description: "Diverse group of fully aquatic placental marine mammals",
},
{label: "Otter", value: "otter", description: "A carnivorous mammal in the subfamily Lutrinae"},
{label: "Crocodile", value: "crocodile", description: "A large semiaquatic reptile"},
];
type FieldState = {
selectedKey: React.Key | null;
inputValue: string;
items: typeof animals;
};
export default function Page() {
// Store ComboBox input value, selected option, open state, and items
// in a state tracker
const [fieldState, setFieldState] = React.useState<FieldState>({
selectedKey: "",
inputValue: "",
items: animals,
});
// Implement custom filtering logic and control what items are
// available to the Autocomplete.
const {startsWith} = useFilter({sensitivity: "base"});
// Specify how each of the Autocomplete values should change when an
// option is selected from the list box
const onSelectionChange = (key: React.Key) => {
setFieldState((prevState) => {
let selectedItem = prevState.items.find((option) => option.value === key);
return {
inputValue: selectedItem?.label || "",
selectedKey: key,
items: animals.filter((item) => startsWith(item.label, selectedItem?.label || "")),
};
});
};
// Specify how each of the Autocomplete values should change when the input
// field is altered by the user
const onInputChange = (value: string) => {
setFieldState((prevState) => ({
inputValue: value,
selectedKey: value === "" ? null : prevState.selectedKey,
items: animals.filter((item) => startsWith(item.label, value)),
}));
};
// Show entire list if user opens the menu manually
const onOpenChange = (isOpen: boolean, menuTrigger: MenuTriggerAction) => {
if (menuTrigger === "manual" && isOpen) {
setFieldState((prevState) => ({
inputValue: prevState.inputValue,
selectedKey: prevState.selectedKey,
items: animals,
}));
}
};
return (
<div className="p-6">
<Autocomplete
className="max-w-xs"
inputValue={fieldState.inputValue}
items={fieldState.items}
label="Favorite Animal"
placeholder="Select an animal"
selectedKey={fieldState.selectedKey}
variant="bordered"
onInputChange={onInputChange}
onOpenChange={onOpenChange}
onSelectionChange={onSelectionChange}
>
{(item) => <AutocompleteItem key={item.value}>{item.label}</AutocompleteItem>}
</Autocomplete>
</div>
);
}
+27
View File
@@ -0,0 +1,27 @@
"use client";
import {Card, CardBody, CircularProgress} from "@nextui-org/react";
export default function ButtonDemo() {
return (
<main className="dark bg-background text-foreground">
<div className="flex w-screen h-screen items-center justify-center">
<Card className="w-[240px] h-[240px] bg-default-200 dark:bg-default-50">
<CardBody className="justify-center items-center py-0">
<CircularProgress
classNames={{
svg: "w-36 h-36 drop-shadow-md",
indicator: "stroke-foreground",
track: "stroke-foreground/10",
value: "text-3xl font-semibold text-foreground",
}}
showValueLabel={true}
strokeWidth={4}
value={70}
/>
</CardBody>
</Card>
</div>
</main>
);
}
@@ -0,0 +1,74 @@
"use client";
import {
Modal,
ModalContent,
ModalHeader,
ModalBody,
ModalFooter,
Button,
useDisclosure,
RadioGroup,
Radio,
ModalProps,
} from "@nextui-org/react";
import {useState} from "react";
export default function Page() {
const {isOpen, onOpen, onOpenChange} = useDisclosure();
const [modalPlacement, setModalPlacement] = useState("auto");
return (
<div className="flex px-10 min-h-[80vh] justify-center items-center flex-col gap-4">
<Button className="max-w-fit" onPress={onOpen}>
Open Modal
</Button>
<RadioGroup
label="Select modal placement"
orientation="horizontal"
value={modalPlacement}
onValueChange={setModalPlacement}
>
<Radio value="auto">auto</Radio>
<Radio value="top">top</Radio>
<Radio value="bottom">bottom</Radio>
<Radio value="center">center</Radio>
<Radio value="top-center">top-center</Radio>
<Radio value="bottom-center">bottom-center</Radio>
</RadioGroup>
<Modal
isOpen={isOpen}
placement={modalPlacement as ModalProps["placement"]}
onOpenChange={onOpenChange}
>
<ModalContent>
{(onClose) => (
<>
<ModalHeader className="flex flex-col gap-1">Modal Title</ModalHeader>
<ModalBody>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non
risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor
quam.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar risus non
risus hendrerit venenatis. Pellentesque sit amet hendrerit risus, sed porttitor
quam.
</p>
</ModalBody>
<ModalFooter>
<Button color="danger" variant="light" onClick={onClose}>
Close
</Button>
<Button color="primary" onPress={onClose}>
Action
</Button>
</ModalFooter>
</>
)}
</ModalContent>
</Modal>
</div>
);
}
@@ -0,0 +1,62 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
return (
<Navbar isBordered>
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="primary" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
</Navbar>
);
}
@@ -0,0 +1,110 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
NavbarMenu,
NavbarMenuItem,
NavbarMenuToggle,
Button,
Link as NextUiLink,
LinkProps,
} from "@nextui-org/react";
import React from "react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
const [isMenuOpen, setIsMenuOpen] = React.useState<boolean | undefined>(false);
const menuItems = [
"Profile",
"Dashboard",
"Activity",
"Analytics",
"System",
"Deployments",
"My Settings",
"Team Settings",
"Help & Feedback",
"Log Out",
];
return (
<Navbar isBordered onMenuOpenChange={setIsMenuOpen}>
<NavbarContent className="sm:hidden" justify="start">
<NavbarMenuToggle aria-label={isMenuOpen ? "Close menu" : "Open menu"} />
</NavbarContent>
<NavbarContent className="sm:hidden pr-3" justify="center">
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
</NavbarContent>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" color="warning" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="warning" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
<NavbarMenu>
{menuItems.map((item, index) => (
<NavbarMenuItem key={`${item}-${index}`}>
<Link
className="w-full"
color={
index === 2 ? "warning" : index === menuItems.length - 1 ? "danger" : "foreground"
}
href="#"
size="lg"
>
{item}
</Link>
</NavbarMenuItem>
))}
</NavbarMenu>
</Navbar>
);
}
@@ -0,0 +1,79 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
return (
<Navbar
classNames={{
item: [
"flex",
"relative",
"h-full",
"items-center",
"data-[active=true]:after:content-['']",
"data-[active=true]:after:absolute",
"data-[active=true]:after:bottom-0",
"data-[active=true]:after:left-0",
"data-[active=true]:after:right-0",
"data-[active=true]:after:h-[2px]",
"data-[active=true]:after:rounded-[2px]",
"data-[active=true]:after:bg-primary",
],
}}
>
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="primary" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
</Navbar>
);
}
@@ -0,0 +1,108 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Button,
Link as NextUiLink,
LinkProps,
NavbarMenu,
NavbarMenuItem,
NavbarMenuToggle,
} from "@nextui-org/react";
import React from "react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
const menuItems = [
"Profile",
"Dashboard",
"Activity",
"Analytics",
"System",
"Deployments",
"My Settings",
"Team Settings",
"Help & Feedback",
"Log Out",
];
return (
<Navbar disableAnimation isBordered>
<NavbarContent className="sm:hidden" justify="start">
<NavbarMenuToggle />
</NavbarContent>
<NavbarContent className="sm:hidden pr-3" justify="center">
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
</NavbarContent>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" color="warning" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="warning" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
<NavbarMenu>
{menuItems.map((item, index) => (
<NavbarMenuItem key={`${item}-${index}`}>
<Link
className="w-full"
color={
index === 2 ? "warning" : index === menuItems.length - 1 ? "danger" : "foreground"
}
href="#"
size="lg"
>
{item}
</Link>
</NavbarMenuItem>
))}
</NavbarMenu>
</Navbar>
);
}
@@ -0,0 +1,62 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
return (
<Navbar isBordered isBlurred={false}>
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="primary" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
</Navbar>
);
}
@@ -0,0 +1,62 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
return (
<Navbar shouldHideOnScroll>
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="primary" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
</Navbar>
);
}
+78
View File
@@ -0,0 +1,78 @@
const Content = () => (
<div className="px-6 flex gap-4 flex-col pb-16 flex-grow">
<h1 className="mt-4 font-bold text-4xl">Lorem ipsum dolor sit amet</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Purus gravida quis blandit turpis. Augue neque gravida in
fermentum et sollicitudin ac orci. Et sollicitudin ac orci phasellus egestas. Elementum tempus
egestas sed sed risus pretium quam vulputate. Interdum velit euismod in pellentesque massa
placerat duis ultricies.
</p>
<p>
Rhoncus mattis rhoncus urna neque viverra justo nec ultrices dui. Praesent semper feugiat nibh
sed pulvinar. Ultrices gravida dictum fusce ut placerat orci nulla pellentesque. Malesuada
proin libero nunc consequat interdum varius sit amet. Lectus quam id leo in vitae. Sed viverra
tellus in hac habitasse platea dictumst. Vivamus at augue eget arcu. Augue mauris augue neque
gravida in.
</p>
<p>
Tincidunt vitae semper quis lectus nulla at volutpat diam. Gravida dictum fusce ut placerat.
Erat velit scelerisque in dictum non. Tempus quam pellentesque nec nam aliquam sem et tortor
consequat. Eu nisl nunc mi ipsum faucibus. Cras fermentum odio eu feugiat pretium nibh. Vel
pharetra vel turpis nunc eget lorem dolor sed viverra. Sollicitudin tempor id eu nisl nunc mi
ipsum faucibus. Sed id semper risus in hendrerit gravida rutrum. Eget nulla facilisi etiam
dignissim. Erat imperdiet sed euismod nisi. Risus in hendrerit gravida rutrum quisque non
tellus orci ac.
</p>
<p>
Tempor orci dapibus ultrices in iaculis nunc sed augue lacus. In pellentesque massa placerat
duis ultricies. Sit amet massa vitae tortor condimentum. Morbi tincidunt augue interdum velit
euismod. Aliquet enim tortor at auctor urna nunc id. A scelerisque purus semper eget. Vitae
justo eget magna fermentum iaculis. Arcu non odio euismod lacinia at quis. Et leo duis ut diam
quam nulla porttitor massa. Eget nunc scelerisque viverra mauris. Suscipit tellus mauris a
diam maecenas sed enim. Cras sed felis eget velit aliquet. Est placerat in egestas erat
imperdiet sed euismod nisi porta. In ante metus dictum at tempor commodo. In cursus turpis
massa tincidunt dui ut ornare lectus. Tempus iaculis urna id volutpat. Iaculis eu non diam
phasellus vestibulum lorem sed risus.
</p>
<p>
Ridiculus mus mauris vitae ultricies leo integer malesuada nunc vel. Imperdiet massa tincidunt
nunc pulvinar sapien et ligula ullamcorper malesuada. Faucibus pulvinar elementum integer enim
neque volutpat. Gravida arcu ac tortor dignissim convallis aenean. Lectus quam id leo in
vitae. Ultricies tristique nulla aliquet enim tortor. Nec tincidunt praesent semper feugiat
nibh sed. Imperdiet proin fermentum leo vel orci porta non pulvinar neque. Praesent semper
feugiat nibh sed pulvinar proin gravida. Dis parturient montes nascetur ridiculus mus mauris.
Rhoncus dolor purus non enim praesent elementum facilisis leo vel. Ut lectus arcu bibendum at.
Integer enim neque volutpat ac. Diam sit amet nisl suscipit. Eros donec ac odio tempor orci
dapibus ultrices in iaculis. Ullamcorper a lacus vestibulum sed arcu non odio euismod. Quis
lectus nulla at volutpat diam ut. Turpis egestas integer eget aliquet. Adipiscing tristique
risus nec feugiat in fermentum posuere. Morbi tempus iaculis urna id. Amet commodo nulla
facilisi nullam vehicula ipsum a arcu.
</p>
<p>
Rhoncus mattis rhoncus urna neque viverra justo nec ultrices dui. Praesent semper feugiat nibh
sed pulvinar. Ultrices gravida dictum fusce ut placerat orci nulla pellentesque. Malesuada
proin libero nunc consequat interdum varius sit amet. Lectus quam id leo in vitae. Sed viverra
tellus in hac habitasse platea dictumst. Vivamus at augue eget arcu. Augue mauris augue neque
gravida in.
</p>
<p>
Tincidunt vitae semper quis lectus nulla at volutpat diam. Gravida dictum fusce ut placerat.
Erat velit scelerisque in dictum non. Tempus quam pellentesque nec nam aliquam sem et tortor
consequat. Eu nisl nunc mi ipsum faucibus. Cras fermentum odio eu feugiat pretium nibh. Vel
pharetra vel turpis nunc eget lorem dolor sed viverra. Sollicitudin tempor id eu nisl nunc mi
ipsum faucibus. Sed id semper risus in hendrerit gravida rutrum. Eget nulla facilisi etiam
dignissim. Erat imperdiet sed euismod nisi. Risus in hendrerit gravida rutrum quisque non
tellus orci ac.
</p>
</div>
);
export default function NavbarExamplesLayout({children}: {children: React.ReactNode}) {
return (
<div className="flex flex-col">
{children}
<Content />
</div>
);
}
@@ -0,0 +1,62 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
return (
<Navbar position="static">
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="primary" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
</Navbar>
);
}
@@ -0,0 +1,62 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
return (
<Navbar>
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="primary" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
</Navbar>
);
}
@@ -0,0 +1,86 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
DropdownItem,
DropdownTrigger,
Dropdown,
DropdownMenu,
Avatar,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
return (
<Navbar>
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" color="secondary" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent as="div" justify="end">
<Dropdown placement="bottom-end">
<DropdownTrigger>
<Avatar
isBordered
as="button"
className="transition-transform"
color="secondary"
name="Jason Hughes"
size="sm"
src="https://i.pravatar.cc/150?u=a042581f4e29026704d"
/>
</DropdownTrigger>
<DropdownMenu aria-label="Profile Actions" variant="flat">
<DropdownItem key="profile" className="h-14 gap-2">
<p className="font-semibold">Signed in as</p>
<p className="font-semibold">zoey@example.com</p>
</DropdownItem>
<DropdownItem key="settings">My Settings</DropdownItem>
<DropdownItem key="team_settings">Team Settings</DropdownItem>
<DropdownItem key="analytics">Analytics</DropdownItem>
<DropdownItem key="system">System</DropdownItem>
<DropdownItem key="configurations">Configurations</DropdownItem>
<DropdownItem key="help_and_feedback">Help & Feedback</DropdownItem>
<DropdownItem key="logout" color="danger">
Log Out
</DropdownItem>
</DropdownMenu>
</Dropdown>
</NavbarContent>
</Navbar>
);
}
@@ -0,0 +1,130 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
DropdownItem,
DropdownTrigger,
Dropdown,
DropdownMenu,
} from "@nextui-org/react";
import {ChevronDown, Lock, Activity, Flash, Server, TagUser, Scale} from "@nextui-org/shared-icons";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
const icons = {
chevron: <ChevronDown fill="currentColor" size={16} />,
scale: <Scale className="text-warning" fill="currentColor" size={30} />,
lock: <Lock className="text-success" fill="currentColor" size={30} />,
activity: <Activity className="text-secondary" fill="currentColor" size={30} />,
flash: <Flash className="text-primary" fill="currentColor" size={30} />,
server: <Server className="text-success" fill="currentColor" size={30} />,
user: <TagUser className="text-danger" fill="currentColor" size={30} />,
};
return (
<Navbar>
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<Dropdown>
<NavbarItem>
<DropdownTrigger>
<Button
disableRipple
className="p-0 bg-transparent data-[hover=true]:bg-transparent"
endContent={icons.chevron}
radius="sm"
variant="light"
>
Features
</Button>
</DropdownTrigger>
</NavbarItem>
<DropdownMenu
aria-label="ACME features"
className="w-[340px]"
itemClasses={{
base: "gap-4",
}}
>
<DropdownItem
key="autoscaling"
description="ACME scales apps to meet user demand, automagically, based on load."
startContent={icons.scale}
>
Autoscaling
</DropdownItem>
<DropdownItem
key="usage_metrics"
description="Real-time metrics to debug issues. Slow query added? Well show you exactly where."
startContent={icons.activity}
>
Usage Metrics
</DropdownItem>
<DropdownItem
key="production_ready"
description="ACME runs on ACME, join us and others serving requests at web scale."
startContent={icons.flash}
>
Production Ready
</DropdownItem>
<DropdownItem
key="99_uptime"
description="Applications stay on the grid with high availability and high uptime guarantees."
startContent={icons.server}
>
+99% Uptime
</DropdownItem>
<DropdownItem
key="supreme_support"
description="Overcome any challenge with a supporting team ready to respond."
startContent={icons.user}
>
+Supreme Support
</DropdownItem>
</DropdownMenu>
</Dropdown>
<NavbarItem isActive>
<Link aria-current="page" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="primary" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
</Navbar>
);
}
@@ -0,0 +1,104 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
NavbarMenuToggle,
NavbarMenu,
NavbarMenuItem,
} from "@nextui-org/react";
import React from "react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
const [isMenuOpen, setIsMenuOpen] = React.useState<boolean | undefined>(false);
const menuItems = [
"Profile",
"Dashboard",
"Activity",
"Analytics",
"System",
"Deployments",
"My Settings",
"Team Settings",
"Help & Feedback",
"Log Out",
];
return (
<Navbar onMenuOpenChange={setIsMenuOpen}>
<NavbarContent>
<NavbarMenuToggle
aria-label={isMenuOpen ? "Close menu" : "Open menu"}
className="sm:hidden"
/>
<NavbarBrand>
<AcmeLogo />
<p className="font-bold text-inherit">ACME</p>
</NavbarBrand>
</NavbarContent>
<NavbarContent className="hidden sm:flex gap-4" justify="center">
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
<NavbarContent justify="end">
<NavbarItem className="hidden lg:flex">
<Link href="#">Login</Link>
</NavbarItem>
<NavbarItem>
<Button as={Link} color="primary" href="#" variant="flat">
Sign Up
</Button>
</NavbarItem>
</NavbarContent>
<NavbarMenu>
{menuItems.map((item, index) => (
<NavbarMenuItem key={`${item}-${index}`}>
<Link
className="w-full"
color={
index === 2 ? "primary" : index === menuItems.length - 1 ? "danger" : "foreground"
}
href="#"
size="lg"
>
{item}
</Link>
</NavbarMenuItem>
))}
</NavbarMenu>
</Navbar>
);
}
@@ -0,0 +1,104 @@
"use client";
import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Input,
DropdownItem,
DropdownTrigger,
Dropdown,
DropdownMenu,
Avatar,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
import {SearchLinearIcon} from "@/components/icons";
const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
clipRule="evenodd"
d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
);
export default function Page() {
return (
<Navbar isBordered>
<NavbarContent justify="start">
<NavbarBrand className="mr-4">
<AcmeLogo />
<p className="hidden sm:block font-bold text-inherit">ACME</p>
</NavbarBrand>
<NavbarContent className="hidden sm:flex gap-3">
<NavbarItem>
<Link color="foreground" href="#">
Features
</Link>
</NavbarItem>
<NavbarItem isActive>
<Link aria-current="page" color="secondary" href="#">
Customers
</Link>
</NavbarItem>
<NavbarItem>
<Link color="foreground" href="#">
Integrations
</Link>
</NavbarItem>
</NavbarContent>
</NavbarContent>
<NavbarContent as="div" className="items-center" justify="end">
<Input
classNames={{
base: "max-w-full sm:max-w-[10rem] h-10",
input: "text-small",
inputWrapper:
"h-full font-normal text-default-500 bg-default-400/20 dark:bg-default-500/20",
}}
placeholder="Type to search..."
startContent={<SearchLinearIcon size={18} />}
type="search"
/>
<Dropdown placement="bottom-end">
<NavbarItem>
<DropdownTrigger>
<Avatar
isBordered
as="button"
className="transition-transform"
color="secondary"
name="Jason Hughes"
size="sm"
src="https://i.pravatar.cc/150?u=a042581f4e29026704d"
/>
</DropdownTrigger>
</NavbarItem>
<DropdownMenu aria-label="Profile Actions" variant="flat">
<DropdownItem key="profile" className="h-14 gap-2">
<p className="font-semibold">Signed in as</p>
<p className="font-semibold">zoey@example.com</p>
</DropdownItem>
<DropdownItem key="settings">My Settings</DropdownItem>
<DropdownItem key="team_settings">Team Settings</DropdownItem>
<DropdownItem key="analytics">Analytics</DropdownItem>
<DropdownItem key="system">System</DropdownItem>
<DropdownItem key="configurations">Configurations</DropdownItem>
<DropdownItem key="help_and_feedback">Help & Feedback</DropdownItem>
<DropdownItem key="logout" color="danger">
Log Out
</DropdownItem>
</DropdownMenu>
</Dropdown>
</NavbarContent>
</Navbar>
);
}
+561
View File
@@ -0,0 +1,561 @@
"use client";
import {
RadioGroup,
Radio,
Button,
Accordion,
Tabs,
Textarea,
Input,
Tab,
Avatar,
Select,
SelectItem,
AccordionItem,
Pagination,
extendVariants,
PaginationItem,
} from "@nextui-org/react";
import {useFilter} from "@react-aria/i18n";
import {useEffect, useMemo, useRef, useState} from "react";
import {useSearchParams} from "next/navigation";
import {SearchLinearIcon} from "@/components/icons";
const MyRadioGroup = () => {
const [radio, setRadio] = useState("1");
return (
<RadioGroup value={radio} onValueChange={setRadio}>
<Radio value="1">Radio 1</Radio>
<Radio value="2">Radio 2</Radio>
<Radio value="3">Radio 3</Radio>
<Radio value="4">Radio 4</Radio>
<Radio value="5">Radio 5</Radio>
<Radio value="6">Radio 6</Radio>
<Radio value="7">Radio 7</Radio>
<Radio value="8">Radio 8</Radio>
<Radio value="9">Radio 9</Radio>
<Radio value="10">Radio 10</Radio>
<Radio value="11">Radio 11</Radio>
<Radio value="12">Radio 12</Radio>
<Radio value="13">Radio 13</Radio>
<Radio value="14">Radio 14</Radio>
<Radio value="15">Radio 15</Radio>
<Radio value="16">Radio 16</Radio>
<Radio value="17">Radio 17</Radio>
<Radio value="18">Radio 18</Radio>
<Radio value="19">Radio 19</Radio>
<Radio value="20">Radio 20</Radio>
<Radio value="21">Radio 21</Radio>
<Radio value="22">Radio 22</Radio>
<Radio value="23">Radio 23</Radio>
<Radio value="24">Radio 24</Radio>
<Radio value="25">Radio 25</Radio>
<Radio value="26">Radio 26</Radio>
<Radio value="27">Radio 27</Radio>
<Radio value="28">Radio 28</Radio>
<Radio value="29">Radio 29</Radio>
<Radio value="30">Radio 30</Radio>
<Radio value="31">Radio 31</Radio>
<Radio value="32">Radio 32</Radio>
<Radio value="33">Radio 33</Radio>
<Radio value="34">Radio 34</Radio>
<Radio value="35">Radio 35</Radio>
<Radio value="36">Radio 36</Radio>
<Radio value="37">Radio 37</Radio>
<Radio value="38">Radio 38</Radio>
<Radio value="39">Radio 39</Radio>
<Radio value="40">Radio 40</Radio>
<Radio value="41">Radio 41</Radio>
<Radio value="42">Radio 42</Radio>
<Radio value="43">Radio 43</Radio>
<Radio value="44">Radio 44</Radio>
<Radio value="45">Radio 45</Radio>
<Radio value="46">Radio 46</Radio>
<Radio value="47">Radio 47</Radio>
<Radio value="48">Radio 48</Radio>
<Radio value="49">Radio 49</Radio>
<Radio value="50">Radio 50</Radio>
<Radio value="51">Radio 51</Radio>
<Radio value="52">Radio 52</Radio>
<Radio value="53">Radio 53</Radio>
<Radio value="54">Radio 54</Radio>
<Radio value="55">Radio 55</Radio>
<Radio value="56">Radio 56</Radio>
<Radio value="57">Radio 57</Radio>
<Radio value="58">Radio 58</Radio>
<Radio value="59">Radio 59</Radio>
<Radio value="60">Radio 60</Radio>
<Radio value="61">Radio 61</Radio>
<Radio value="62">Radio 62</Radio>
</RadioGroup>
);
};
const MyInput = extendVariants(Input, {
variants: {
color: {
stone: {
inputWrapper: [
"bg-zinc-100",
"border",
"shadow",
"transition-colors",
"focus-within:bg-zinc-100",
"data-[hover=true]:border-zinc-600",
"data-[hover=true]:bg-zinc-100",
"group-data-[focus=true]:border-zinc-600",
// dark theme
"dark:bg-zinc-900",
"dark:border-zinc-800",
"dark:data-[hover=true]:bg-zinc-900",
"dark:focus-within:bg-zinc-900",
],
input: [
"text-zinc-800",
"placeholder:text-zinc-600",
// dark theme
"dark:text-zinc-400",
"dark:placeholder:text-zinc-600",
],
},
},
size: {
xs: {
inputWrapper: "h-unit-6 min-h-unit-6 px-1",
input: "text-tiny",
},
md: {
inputWrapper: "h-unit-10 min-h-unit-10",
input: "text-small",
},
xl: {
inputWrapper: "h-unit-14 min-h-unit-14",
input: "text-medium",
},
},
radius: {
xs: {
inputWrapper: "rounded",
},
sm: {
inputWrapper: "rounded-[4px]",
},
},
textSize: {
base: {
input: "text-base",
},
},
removeLabel: {
true: {
label: "hidden",
},
false: {},
},
},
defaultVariants: {
color: "stone",
textSize: "base",
removeLabel: true,
},
});
const MyButton2 = extendVariants(Button, {
variants: {
color: {
foreground:
"bg-foreground text-background data-[hover=true]:bg-foreground/90 data-[pressed=true]:bg-foreground/80",
},
isScalable: {
true: "scale-125",
false: "",
},
size: {
xl: "size--xl",
"2xl": "size--2xl",
},
mySize: {
lg: "px-12 py-6 text-lg",
xl: "px-12 py-6 text-xl",
},
},
defaultVariants: {
color: "foreground",
},
});
const usersData = [
{
id: 1,
name: "Tony Reichert",
role: "CEO",
team: "Management",
status: "active",
age: "29",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/1.png",
email: "tony.reichert@example.com",
},
{
id: 2,
name: "Zoey Lang",
role: "Tech Lead",
team: "Development",
status: "paused",
age: "25",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/1.png",
email: "zoey.lang@example.com",
},
{
id: 3,
name: "Jane Fisher",
role: "Sr. Dev",
team: "Development",
status: "active",
age: "22",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/2.png",
email: "jane.fisher@example.com",
},
{
id: 4,
name: "William Howard",
role: "C.M.",
team: "Marketing",
status: "vacation",
age: "28",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/2.png",
email: "william.howard@example.com",
},
{
id: 5,
name: "Kristen Copper",
role: "S. Manager",
team: "Sales",
status: "active",
age: "24",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/3.png",
email: "kristen.cooper@example.com",
},
{
id: 6,
name: "Brian Kim",
role: "P. Manager",
team: "Management",
age: "29",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/3.png",
email: "brian.kim@example.com",
status: "Active",
},
{
id: 7,
name: "Michael Hunt",
role: "Designer",
team: "Design",
status: "paused",
age: "27",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/4.png",
email: "michael.hunt@example.com",
},
{
id: 8,
name: "Samantha Brooks",
role: "HR Manager",
team: "HR",
status: "active",
age: "31",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/4.png",
email: "samantha.brooks@example.com",
},
{
id: 9,
name: "Frank Harrison",
role: "F. Manager",
team: "Finance",
status: "vacation",
age: "33",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/5.png",
email: "frank.harrison@example.com",
},
{
id: 10,
name: "Emma Adams",
role: "Ops Manager",
team: "Operations",
status: "active",
age: "35",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/5.png",
email: "emma.adams@example.com",
},
{
id: 11,
name: "Brandon Stevens",
role: "Jr. Dev",
team: "Development",
status: "active",
age: "22",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/7.png",
email: "brandon.stevens@example.com",
},
{
id: 12,
name: "Megan Richards",
role: "P. Manager",
team: "Product",
status: "paused",
age: "28",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/7.png",
email: "megan.richards@example.com",
},
{
id: 13,
name: "Oliver Scott",
role: "S. Manager",
team: "Security",
status: "active",
age: "37",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/8.png",
email: "oliver.scott@example.com",
},
{
id: 14,
name: "Grace Allen",
role: "M. Specialist",
team: "Marketing",
status: "active",
age: "30",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/8.png",
email: "grace.allen@example.com",
},
{
id: 15,
name: "Noah Carter",
role: "IT Specialist",
team: "I. Technology",
status: "paused",
age: "31",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/9.png",
email: "noah.carter@example.com",
},
{
id: 16,
name: "Ava Perez",
role: "Manager",
team: "Sales",
status: "active",
age: "29",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/9.png",
email: "ava.perez@example.com",
},
{
id: 17,
name: "Liam Johnson",
role: "Data Analyst",
team: "Analysis",
status: "active",
age: "28",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/11.png",
email: "liam.johnson@example.com",
},
{
id: 18,
name: "Sophia Taylor",
role: "QA Analyst",
team: "Testing",
status: "active",
age: "27",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/11.png",
email: "sophia.taylor@example.com",
},
{
id: 19,
name: "Lucas Harris",
role: "Administrator",
team: "Information Technology",
status: "paused",
age: "32",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/male/12.png",
email: "lucas.harris@example.com",
},
{
id: 20,
name: "Mia Robinson",
role: "Coordinator",
team: "Operations",
status: "active",
age: "26",
avatar: "https://d2u8k2ocievbld.cloudfront.net/memojis/female/12.png",
email: "mia.robinson@example.com",
},
];
export default function NextUIPerf() {
const [textA, setTextA] = useState<string>("");
const [textB, setTextB] = useState<string>("");
const [textC, setTextC] = useState<string>("");
const [isOpen, setIsOpen] = useState<boolean>(false);
const [inputValue, setInputValue] = useState<string>();
const [selectedKey, setSelectedKey] = useState<string>("");
const searchParams = useSearchParams();
const page = Number(searchParams.get("page"));
let {startsWith} = useFilter({sensitivity: "base"});
const filteredItems = inputValue
? usersData.filter((item) => startsWith(item.name, inputValue))
: usersData;
const inputRef = useRef<HTMLInputElement>(null);
useEffect(() => {
isOpen && inputRef?.current?.focus();
}, [isOpen]);
const handleSelectionChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
setSelectedKey(e.target.value);
};
const topContent = useMemo(() => {
return (
<Input
ref={inputRef}
isClearable
aria-activedescendant={selectedKey}
aria-expanded={isOpen}
aria-label="Search user"
autoComplete="off"
autoCorrect="off"
className="z-10 sticky top-1"
placeholder="Search..."
spellCheck={false}
startContent={<SearchLinearIcon className="text-default-400" size={18} strokeWidth="2" />}
type="text"
onValueChange={setInputValue}
/>
);
}, [inputRef, selectedKey, isOpen]);
return (
<div className="w-full p-24 gap-4 flex flex-col">
<Select
classNames={{
base: "max-w-xs",
listboxWrapper: "scroll-pb-6 scroll-pt-28",
}}
items={filteredItems}
label="Assigned to"
labelPlacement="outside"
listboxProps={{
topContent,
variant: "flat",
classNames: {
base: [
"before:content-[''] before:rounded-t-medium before:fixed before:w-full before:h-14 before:z-10",
"before:top-0 before:left-0 before:bg-gradient-to-b before:from-default-50",
],
},
}}
placeholder="Select a user"
selectedKeys={[selectedKey]}
showScrollIndicators={false}
variant="flat"
onChange={handleSelectionChange}
onOpenChange={setIsOpen}
>
{(item) => (
<SelectItem key={item.id} textValue={item.name}>
<div className="flex gap-2 items-center">
<Avatar alt={item.name} className="flex-shrink-0" size="sm" src={item.avatar} />
<div className="flex flex-col">
<span className="text-small">{item.name}</span>
<span className="text-tiny text-default-400">{item.email}</span>
</div>
</div>
</SelectItem>
)}
</Select>
<Accordion>
<AccordionItem key="1" aria-label="Accordion 1" title="Accordion 1">
Non est aliqua tempor occaecat laborum. Lorem culpa minim irure mollit. Est qui
reprehenderit commodo magna proident anim ipsum ex. Mollit id amet officia nisi excepteur
eu. Commodo elit commodo nisi nisi aute eu aliquip aliquip voluptate exercitation ullamco
ipsum eiusmod veniam. Magna in laborum anim amet anim ex elit aliqua nostrud mollit.
Pariatur ullamco cillum proident aliqua nostrud. Labore ea veniam cillum duis veniam in
cupidatat voluptate eu officia. Ut laborum sunt nostrud magna. Ex magna esse cillum enim
incididunt pariatur qui veniam dolor. Exercitation id culpa et enim mollit duis duis
aliquip. Magna ullamco est cupidatat laboris irure pariatur aliquip duis aute cillum.
Officia irure do laboris ea nisi sunt reprehenderit laboris irure. Ex eiusmod in duis
veniam excepteur. Sunt et et laboris culpa. Mollit excepteur occaecat elit anim officia.
Laborum commodo proident cupidatat pariatur eu veniam id qui do culpa. Quis consectetur
adipisicing anim ex ea velit excepteur. Deserunt laboris ex aute sunt laborum tempor ea
enim dolore ut in. Id aliqua Lorem exercitation qui velit nostrud anim reprehenderit enim.
Nisi elit fugiat deserunt elit. Sit excepteur ipsum enim excepteur irure irure sint veniam
elit consequat ea id. Lorem ea qui sunt enim occaecat excepteur officia ex consequat
nostrud. Tempor sint Lorem est culpa do.
</AccordionItem>
<AccordionItem key="2" aria-label="Accordion 2" title="Accordion 2">
Non est aliqua tempor occaecat laborum. Lorem culpa minim irure mollit. Est qui
reprehenderit commodo magna proident anim ipsum ex. Mollit id amet officia nisi excepteur
eu. Commodo elit commodo nisi nisi aute eu aliquip aliquip voluptate exercitation ullamco
ipsum eiusmod veniam. Magna in laborum anim amet anim ex elit aliqua nostrud mollit.
Pariatur ullamco cillum proident aliqua nostrud. Labore ea veniam cillum duis veniam in
cupidatat voluptate eu officia. Ut laborum sunt nostrud magna. Ex magna esse cillum enim
</AccordionItem>
<AccordionItem key="3" aria-label="Accordion 3" title="Accordion 3">
Non est aliqua tempor occaecat laborum. Lorem culpa minim irure mollit. Est qui
reprehenderit commodo magna proident anim ipsum ex. Mollit id amet officia nisi excepteur
eu. Commodo elit commodo nisi nisi aute eu aliquip aliquip voluptate exercitation ullamco
ipsum eiusmod veniam. Magna in laborum anim amet anim ex elit aliqua nostrud mollit.
Pariatur ullamco cillum proident aliqua nostrud. Labore ea veniam cillum duis veniam in
</AccordionItem>
</Accordion>
<Tabs classNames={{panel: "flex flex-col gap-5"}} variant="underlined">
<Tab title="Test 1">
<Textarea defaultValue="ASdasd" label="Default value (uncontrolled)" />
<Input label="Text B Tab 1" value={textB} onValueChange={setTextB} />
<Textarea label="Text C Tab 1" value={textC} onValueChange={setTextC} />
</Tab>
<Tab title="Test 2">
<Textarea label="Text B Tab 2" value={textB} onValueChange={setTextB} />
<Textarea label="Text C Tab 2" value={textC} onValueChange={setTextC} />
</Tab>
<Tab title="Test 3">
<Textarea label="Text B Tab 3" value={textB} onValueChange={setTextB} />
<Textarea label="Text C Tab 3" value={textC} onValueChange={setTextC} />
</Tab>
</Tabs>
<h2>Outside</h2>
<Textarea label="Text A" placeholder="Text A" value={textA} onValueChange={setTextA} />
<Textarea label="Text B" placeholder="Text B" value={textB} onValueChange={setTextB} />
<Textarea label="Text C" placeholder="Text C" value={textC} onValueChange={setTextC} />
<MyRadioGroup />
<MyInput
isClearable
placeholder="Search..."
radius="md"
size="md"
startContent={<SearchLinearIcon className="text-zinc-500" size={16} />}
/>
<Button>Click Me!</Button>
<MyButton2 color="primary">Press Me!</MyButton2>
<Pagination
showControls
initialPage={page ?? 1}
renderItem={({page, ...itemProps}) => {
return <PaginationItem href={`/examples/perf?page=${page}`} {...itemProps} />;
}}
total={10}
/>
</div>
);
}
@@ -0,0 +1,113 @@
/* eslint-disable no-console */
"use client";
import {Select, SelectItem} from "@nextui-org/react";
import {useEffect, useState} from "react";
import {useInfiniteScroll} from "@nextui-org/use-infinite-scroll";
type Pokemon = {
name: string;
url: string;
};
type UsePokemonListProps = {
/** Delay to wait before fetching more items */
fetchDelay?: number;
};
function usePokemonList({fetchDelay = 0}: UsePokemonListProps = {}) {
const [items, setItems] = useState<Pokemon[]>([]);
const [hasMore, setHasMore] = useState(true);
const [isLoading, setIsLoading] = useState(false);
const [offset, setOffset] = useState(0);
const limit = 10; // Number of items per page, adjust as necessary
const loadPokemon = async (currentOffset: number) => {
const controller = new AbortController();
const {signal} = controller;
try {
setIsLoading(true);
if (offset > 0) {
// Delay to simulate network latency
await new Promise((resolve) => setTimeout(resolve, fetchDelay));
}
let res = await fetch(
`https://pokeapi.co/api/v2/pokemon?offset=${currentOffset}&limit=${limit}`,
{signal},
);
if (!res.ok) {
throw new Error("Network response was not ok");
}
let json = await res.json();
setHasMore(json.next !== null);
// Append new results to existing ones
setItems((prevItems) => [...prevItems, ...json.results]);
} catch (error) {
// @ts-ignore
if (error.name === "AbortError") {
console.log("Fetch aborted");
} else {
console.error("There was an error with the fetch operation:", error);
}
} finally {
setIsLoading(false);
}
};
useEffect(() => {
loadPokemon(offset);
}, []);
const onLoadMore = () => {
const newOffset = offset + limit;
setOffset(newOffset);
loadPokemon(newOffset);
};
return {
items,
hasMore,
isLoading,
onLoadMore,
};
}
export default function Page() {
const [isOpen, setIsOpen] = useState(false);
const {items, hasMore, isLoading, onLoadMore} = usePokemonList({fetchDelay: 1500});
const [, scrollerRef] = useInfiniteScroll({
hasMore,
isEnabled: isOpen,
shouldUseLoader: false, // We don't want to show the loader at the bottom of the list
onLoadMore,
});
return (
<div className="p-6">
<Select
className="max-w-xs"
isLoading={isLoading}
items={items}
label="Pick a Pokemon"
placeholder="Select a Pokemon"
scrollRef={scrollerRef}
selectionMode="single"
onOpenChange={setIsOpen}
>
{(item) => (
<SelectItem key={item.name} className="capitalize">
{item.name}
</SelectItem>
)}
</Select>
</div>
);
}
@@ -0,0 +1,85 @@
"use client";
import {
Table,
TableHeader,
TableColumn,
TableBody,
TableRow,
TableCell,
getKeyValue,
Spinner,
Pagination,
} from "@nextui-org/react";
import {useMemo, useState} from "react";
import useSWR from "swr";
type SWCharacter = {
name: string;
height: string;
mass: string;
birth_year: string;
};
const fetcher = (...args: Parameters<typeof fetch>) => fetch(...args).then((res) => res.json());
export default function Page() {
const [page, setPage] = useState(1);
const {data, isLoading} = useSWR<{
count: number;
results: SWCharacter[];
}>(`https://swapi.py4e.com/api/people?page=${page}`, fetcher, {
keepPreviousData: true,
});
const rowsPerPage = 10;
const pages = useMemo(() => {
return data?.count ? Math.ceil(data.count / rowsPerPage) : 0;
}, [data?.count, rowsPerPage]);
return (
<div className="p-6">
<Table
aria-label="Example table with client async pagination"
bottomContent={
pages > 0 ? (
<div className="flex w-full justify-center">
<Pagination
isCompact
showControls
showShadow
color="primary"
page={page}
total={pages}
onChange={(page) => setPage(page)}
/>
</div>
) : null
}
classNames={{
table: "min-h-[400px]",
}}
>
<TableHeader>
<TableColumn key="name">Name</TableColumn>
<TableColumn key="height">Height</TableColumn>
<TableColumn key="mass">Mass</TableColumn>
<TableColumn key="birth_year">Birth year</TableColumn>
</TableHeader>
<TableBody
isLoading={isLoading || data?.results.length === 0}
items={data?.results ?? []}
loadingContent={<Spinner />}
>
{(item) => (
<TableRow key={item.name}>
{(columnKey) => <TableCell>{getKeyValue(item, columnKey)}</TableCell>}
</TableRow>
)}
</TableBody>
</Table>
</div>
);
}
@@ -0,0 +1,579 @@
/* eslint-disable jsx-a11y/no-onchange */
"use client";
import {
Table,
TableHeader,
TableColumn,
TableBody,
TableRow,
TableCell,
Input,
Button,
DropdownTrigger,
Dropdown,
DropdownMenu,
DropdownItem,
Selection,
Chip,
User,
ChipProps,
Pagination,
SortDescriptor,
} from "@nextui-org/react";
import {ChevronDownIcon, SearchIcon} from "@nextui-org/shared-icons";
import {useCallback, useMemo, useState} from "react";
import {capitalize} from "lodash";
import {PlusLinearIcon} from "@/components/icons";
import {VerticalDotsIcon} from "@/components/icons/vertical-dots";
const statusColorMap: Record<string, ChipProps["color"]> = {
active: "success",
paused: "danger",
vacation: "warning",
};
const columns = [
{name: "ID", uid: "id", sortable: true},
{name: "NAME", uid: "name", sortable: true},
{name: "AGE", uid: "age", sortable: true},
{name: "ROLE", uid: "role", sortable: true},
{name: "TEAM", uid: "team"},
{name: "EMAIL", uid: "email"},
{name: "STATUS", uid: "status", sortable: true},
{name: "ACTIONS", uid: "actions"},
];
const statusOptions = [
{name: "Active", uid: "active"},
{name: "Paused", uid: "paused"},
{name: "Vacation", uid: "vacation"},
];
const INITIAL_VISIBLE_COLUMNS = ["name", "role", "status", "actions"];
const users = [
{
id: 1,
name: "Tony Reichert",
role: "CEO",
team: "Management",
status: "active",
age: "29",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
email: "tony.reichert@example.com",
},
{
id: 2,
name: "Zoey Lang",
role: "Tech Lead",
team: "Development",
status: "paused",
age: "25",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026704d",
email: "zoey.lang@example.com",
},
{
id: 3,
name: "Jane Fisher",
role: "Sr. Dev",
team: "Development",
status: "active",
age: "22",
avatar: "https://i.pravatar.cc/150?u=a04258114e29026702d",
email: "jane.fisher@example.com",
},
{
id: 4,
name: "William Howard",
role: "C.M.",
team: "Marketing",
status: "vacation",
age: "28",
avatar: "https://i.pravatar.cc/150?u=a048581f4e29026701d",
email: "william.howard@example.com",
},
{
id: 5,
name: "Kristen Copper",
role: "S. Manager",
team: "Sales",
status: "active",
age: "24",
avatar: "https://i.pravatar.cc/150?u=a092581d4ef9026700d",
email: "kristen.cooper@example.com",
},
{
id: 6,
name: "Brian Kim",
role: "P. Manager",
team: "Management",
age: "29",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
email: "brian.kim@example.com",
status: "Active",
},
{
id: 7,
name: "Michael Hunt",
role: "Designer",
team: "Design",
status: "paused",
age: "27",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29027007d",
email: "michael.hunt@example.com",
},
{
id: 8,
name: "Samantha Brooks",
role: "HR Manager",
team: "HR",
status: "active",
age: "31",
avatar: "https://i.pravatar.cc/150?u=a042581f4e27027008d",
email: "samantha.brooks@example.com",
},
{
id: 9,
name: "Frank Harrison",
role: "F. Manager",
team: "Finance",
status: "vacation",
age: "33",
avatar: "https://i.pravatar.cc/150?img=4",
email: "frank.harrison@example.com",
},
{
id: 10,
name: "Emma Adams",
role: "Ops Manager",
team: "Operations",
status: "active",
age: "35",
avatar: "https://i.pravatar.cc/150?img=5",
email: "emma.adams@example.com",
},
{
id: 11,
name: "Brandon Stevens",
role: "Jr. Dev",
team: "Development",
status: "active",
age: "22",
avatar: "https://i.pravatar.cc/150?img=8",
email: "brandon.stevens@example.com",
},
{
id: 12,
name: "Megan Richards",
role: "P. Manager",
team: "Product",
status: "paused",
age: "28",
avatar: "https://i.pravatar.cc/150?img=10",
email: "megan.richards@example.com",
},
{
id: 13,
name: "Oliver Scott",
role: "S. Manager",
team: "Security",
status: "active",
age: "37",
avatar: "https://i.pravatar.cc/150?img=12",
email: "oliver.scott@example.com",
},
{
id: 14,
name: "Grace Allen",
role: "M. Specialist",
team: "Marketing",
status: "active",
age: "30",
avatar: "https://i.pravatar.cc/150?img=16",
email: "grace.allen@example.com",
},
{
id: 15,
name: "Noah Carter",
role: "IT Specialist",
team: "I. Technology",
status: "paused",
age: "31",
avatar: "https://i.pravatar.cc/150?img=15",
email: "noah.carter@example.com",
},
{
id: 16,
name: "Ava Perez",
role: "Manager",
team: "Sales",
status: "active",
age: "29",
avatar: "https://i.pravatar.cc/150?img=20",
email: "ava.perez@example.com",
},
{
id: 17,
name: "Liam Johnson",
role: "Data Analyst",
team: "Analysis",
status: "active",
age: "28",
avatar: "https://i.pravatar.cc/150?img=33",
email: "liam.johnson@example.com",
},
{
id: 18,
name: "Sophia Taylor",
role: "QA Analyst",
team: "Testing",
status: "active",
age: "27",
avatar: "https://i.pravatar.cc/150?img=29",
email: "sophia.taylor@example.com",
},
{
id: 19,
name: "Lucas Harris",
role: "Administrator",
team: "Information Technology",
status: "paused",
age: "32",
avatar: "https://i.pravatar.cc/150?img=50",
email: "lucas.harris@example.com",
},
{
id: 20,
name: "Mia Robinson",
role: "Coordinator",
team: "Operations",
status: "active",
age: "26",
avatar: "https://i.pravatar.cc/150?img=45",
email: "mia.robinson@example.com",
},
];
type User = (typeof users)[number];
export default function Page() {
const [filterValue, setFilterValue] = useState("");
const [selectedKeys, setSelectedKeys] = useState<Selection>(new Set([]));
const [visibleColumns, setVisibleColumns] = useState<Selection>(new Set(INITIAL_VISIBLE_COLUMNS));
const [statusFilter, setStatusFilter] = useState<Selection>("all");
const [rowsPerPage, setRowsPerPage] = useState(5);
const [sortDescriptor, setSortDescriptor] = useState<SortDescriptor>({
column: "age",
direction: "ascending",
});
const [page, setPage] = useState(1);
const pages = Math.ceil(users.length / rowsPerPage);
const hasSearchFilter = Boolean(filterValue);
const headerColumns = useMemo(() => {
if (visibleColumns === "all") return columns;
return columns.filter((column) => Array.from(visibleColumns).includes(column.uid));
}, [visibleColumns]);
const filteredItems = useMemo(() => {
let filteredUsers = [...users];
if (hasSearchFilter) {
filteredUsers = filteredUsers.filter((user) =>
user.name.toLowerCase().includes(filterValue.toLowerCase()),
);
}
if (statusFilter !== "all" && Array.from(statusFilter).length !== statusOptions.length) {
filteredUsers = filteredUsers.filter((user) =>
Array.from(statusFilter).includes(user.status),
);
}
return filteredUsers;
}, [users, filterValue, statusFilter]);
const items = useMemo(() => {
const start = (page - 1) * rowsPerPage;
const end = start + rowsPerPage;
return filteredItems.slice(start, end);
}, [page, filteredItems, rowsPerPage]);
const sortedItems = useMemo(() => {
return [...items].sort((a: User, b: User) => {
const first = a[sortDescriptor.column as keyof User] as number;
const second = b[sortDescriptor.column as keyof User] as number;
const cmp = first < second ? -1 : first > second ? 1 : 0;
return sortDescriptor.direction === "descending" ? -cmp : cmp;
});
}, [sortDescriptor, items]);
const renderCell = useCallback((user: User, columnKey: React.Key) => {
const cellValue = user[columnKey as keyof User];
switch (columnKey) {
case "name":
return (
<User
avatarProps={{radius: "full", size: "sm", src: user.avatar}}
classNames={{
description: "text-default-500",
}}
description={user.email}
name={cellValue}
>
{user.email}
</User>
);
case "role":
return (
<div className="flex flex-col">
<p className="text-bold text-small capitalize">{cellValue}</p>
<p className="text-bold text-tiny capitalize text-default-500">{user.team}</p>
</div>
);
case "status":
return (
<Chip
className="capitalize border-none gap-1 text-default-600"
color={statusColorMap[user.status]}
size="sm"
variant="dot"
>
{cellValue}
</Chip>
);
case "actions":
return (
<div className="relative flex justify-end items-center gap-2">
<Dropdown className="bg-background border-1 border-default-200">
<DropdownTrigger>
<Button isIconOnly radius="full" size="sm" variant="light">
<VerticalDotsIcon className="text-default-400" />
</Button>
</DropdownTrigger>
<DropdownMenu>
<DropdownItem>View</DropdownItem>
<DropdownItem>Edit</DropdownItem>
<DropdownItem>Delete</DropdownItem>
</DropdownMenu>
</Dropdown>
</div>
);
default:
return cellValue;
}
}, []);
const onRowsPerPageChange = useCallback((e: React.ChangeEvent<HTMLSelectElement>) => {
setRowsPerPage(Number(e.target.value));
setPage(1);
}, []);
const onSearchChange = useCallback((value?: string) => {
if (value) {
setFilterValue(value);
setPage(1);
} else {
setFilterValue("");
}
}, []);
const topContent = useMemo(() => {
return (
<div className="flex flex-col gap-4">
<div className="flex justify-between gap-3 items-end">
<Input
isClearable
classNames={{
base: "w-full sm:max-w-[44%]",
inputWrapper: "border-1",
}}
placeholder="Search by name..."
size="sm"
startContent={<SearchIcon className="text-default-300" />}
value={filterValue}
variant="bordered"
onClear={() => setFilterValue("")}
onValueChange={onSearchChange}
/>
<div className="flex gap-3">
<Dropdown>
<DropdownTrigger className="hidden sm:flex">
<Button
endContent={<ChevronDownIcon className="text-small" />}
size="sm"
variant="flat"
>
Status
</Button>
</DropdownTrigger>
<DropdownMenu
disallowEmptySelection
aria-label="Table Columns"
closeOnSelect={false}
selectedKeys={statusFilter}
selectionMode="multiple"
onSelectionChange={setStatusFilter}
>
{statusOptions.map((status) => (
<DropdownItem key={status.uid} className="capitalize">
{capitalize(status.name)}
</DropdownItem>
))}
</DropdownMenu>
</Dropdown>
<Dropdown>
<DropdownTrigger className="hidden sm:flex">
<Button
endContent={<ChevronDownIcon className="text-small" />}
size="sm"
variant="flat"
>
Columns
</Button>
</DropdownTrigger>
<DropdownMenu
disallowEmptySelection
aria-label="Table Columns"
closeOnSelect={false}
selectedKeys={visibleColumns}
selectionMode="multiple"
onSelectionChange={setVisibleColumns}
>
{columns.map((column) => (
<DropdownItem key={column.uid} className="capitalize">
{capitalize(column.name)}
</DropdownItem>
))}
</DropdownMenu>
</Dropdown>
<Button
className="bg-foreground text-background"
endContent={<PlusLinearIcon />}
size="sm"
>
Add New
</Button>
</div>
</div>
<div className="flex justify-between items-center">
<span className="text-default-400 text-small">Total {users.length} users</span>
<label className="flex items-center text-default-400 text-small">
Rows per page:
<select
className="bg-transparent outline-none text-default-400 text-small"
onChange={onRowsPerPageChange}
>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
</select>
</label>
</div>
</div>
);
}, [
filterValue,
statusFilter,
visibleColumns,
onSearchChange,
onRowsPerPageChange,
users.length,
hasSearchFilter,
]);
const bottomContent = useMemo(() => {
return (
<div className="py-2 px-2 flex justify-between items-center">
<Pagination
showControls
classNames={{
cursor: "bg-foreground text-background",
}}
color="default"
isDisabled={hasSearchFilter}
page={page}
total={pages}
variant="light"
onChange={setPage}
/>
<span className="text-small text-default-400">
{selectedKeys === "all"
? "All items selected"
: `${selectedKeys.size} of ${items.length} selected`}
</span>
</div>
);
}, [selectedKeys, items.length, page, pages, hasSearchFilter]);
const classNames = useMemo(
() => ({
wrapper: ["max-h-[382px]", "max-w-3xl"],
th: ["bg-transparent", "text-default-500", "border-b", "border-divider"],
td: [
// changing the rows border radius
// first
"group-data-[first=true]:first:before:rounded-none",
"group-data-[first=true]:last:before:rounded-none",
// middle
"group-data-[middle=true]:before:rounded-none",
// last
"group-data-[last=true]:first:before:rounded-none",
"group-data-[last=true]:last:before:rounded-none",
],
}),
[],
);
return (
<div className="p-6">
<Table
isCompact
removeWrapper
aria-label="Example table with custom cells, pagination and sorting"
bottomContent={bottomContent}
bottomContentPlacement="outside"
checkboxesProps={{
classNames: {
wrapper: "after:bg-foreground after:text-background text-background",
},
}}
classNames={classNames}
selectedKeys={selectedKeys}
selectionMode="multiple"
sortDescriptor={sortDescriptor}
topContent={topContent}
topContentPlacement="outside"
onSelectionChange={setSelectedKeys}
onSortChange={setSortDescriptor}
>
<TableHeader columns={headerColumns}>
{(column) => (
<TableColumn
key={column.uid}
align={column.uid === "actions" ? "center" : "start"}
allowsSorting={column.sortable}
>
{column.name}
</TableColumn>
)}
</TableHeader>
<TableBody emptyContent={"No users found"} items={sortedItems}>
{(item) => (
<TableRow key={item.id}>
{(columnKey) => <TableCell>{renderCell(item, columnKey)}</TableCell>}
</TableRow>
)}
</TableBody>
</Table>
</div>
);
}
@@ -0,0 +1,87 @@
"use client";
import {
Table,
TableHeader,
TableColumn,
TableBody,
TableRow,
TableCell,
getKeyValue,
Spinner,
} from "@nextui-org/react";
import {useAsyncList} from "@react-stately/data";
import {useInfiniteScroll} from "@nextui-org/use-infinite-scroll";
import {useState} from "react";
type SWCharacter = {
name: string;
height: string;
mass: string;
birth_year: string;
};
export default function Page() {
const [isLoading, setIsLoading] = useState(true);
const [hasMore, setHasMore] = useState(false);
let list = useAsyncList<SWCharacter>({
async load({signal, cursor}) {
if (cursor) {
setIsLoading(false);
}
// If no cursor is available, then we're loading the first page.
// Otherwise, the cursor is the next URL to load, as returned from the previous page.
const res = await fetch(cursor || "https://swapi.py4e.com/api/people/?search=", {signal});
let json = await res.json();
setHasMore(json.next !== null);
return {
items: json.results,
cursor: json.next,
};
},
});
const [loaderRef, scrollerRef] = useInfiniteScroll({hasMore, onLoadMore: list.loadMore});
return (
<div className="p-6">
<Table
isHeaderSticky
aria-label="Example table with infinite pagination"
baseRef={scrollerRef}
bottomContent={
hasMore ? (
<div className="flex w-full justify-center">
<Spinner ref={loaderRef} color="white" />
</div>
) : null
}
classNames={{
base: "max-h-[520px] overflow-scroll",
table: "min-h-[400px]",
}}
>
<TableHeader>
<TableColumn key="name">Name</TableColumn>
<TableColumn key="height">Height</TableColumn>
<TableColumn key="mass">Mass</TableColumn>
<TableColumn key="birth_year">Birth year</TableColumn>
</TableHeader>
<TableBody
isLoading={isLoading}
items={list.items}
loadingContent={<Spinner color="white" />}
>
{(item) => (
<TableRow key={item.name}>
{(columnKey) => <TableCell>{getKeyValue(item, columnKey)}</TableCell>}
</TableRow>
)}
</TableBody>
</Table>
</div>
);
}
@@ -0,0 +1,92 @@
"use client";
import {
Table,
TableHeader,
TableColumn,
TableBody,
TableRow,
TableCell,
getKeyValue,
Spinner,
Button,
} from "@nextui-org/react";
import {useAsyncList} from "@react-stately/data";
import {useState} from "react";
type SWCharacter = {
name: string;
height: string;
mass: string;
birth_year: string;
};
export default function Page() {
const [page, setPage] = useState(1);
const [isLoading, setIsLoading] = useState(true);
let list = useAsyncList<SWCharacter>({
async load({signal, cursor}) {
if (cursor) {
setPage((prev) => prev + 1);
}
// If no cursor is available, then we're loading the first page.
// Otherwise, the cursor is the next URL to load, as returned from the previous page.
const res = await fetch(cursor || "https://swapi.py4e.com/api/people/?search=", {signal});
let json = await res.json();
if (!cursor) {
setIsLoading(false);
}
return {
items: json.results,
cursor: json.next,
};
},
});
const hasMore = page < 9;
return (
<div className="p-6">
<Table
isHeaderSticky
aria-label="Example table with client side sorting"
bottomContent={
hasMore && !isLoading ? (
<div className="flex w-full justify-center">
<Button isDisabled={list.isLoading} variant="flat" onPress={list.loadMore}>
{list.isLoading && <Spinner color="white" size="sm" />}
Load More
</Button>
</div>
) : null
}
classNames={{
base: "max-h-[520px] overflow-scroll",
table: "min-h-[420px]",
}}
>
<TableHeader>
<TableColumn key="name">Name</TableColumn>
<TableColumn key="height">Height</TableColumn>
<TableColumn key="mass">Mass</TableColumn>
<TableColumn key="birth_year">Birth year</TableColumn>
</TableHeader>
<TableBody
isLoading={isLoading}
items={list.items}
loadingContent={<Spinner label="Loading..." />}
>
{(item) => (
<TableRow key={item.name}>
{(columnKey) => <TableCell>{getKeyValue(item, columnKey)}</TableCell>}
</TableRow>
)}
</TableBody>
</Table>
</div>
);
}
@@ -0,0 +1,94 @@
"use client";
import {
Table,
TableHeader,
TableColumn,
TableBody,
TableRow,
TableCell,
getKeyValue,
Spinner,
} from "@nextui-org/react";
import {useAsyncList} from "@react-stately/data";
import {useState} from "react";
type SWCharacter = {
name: string;
height: string;
mass: string;
birth_year: string;
};
export default function Page() {
const [isLoading, setIsLoading] = useState(true);
let list = useAsyncList<SWCharacter>({
async load({signal}) {
let res = await fetch(`https://swapi.py4e.com/api/people/?search`, {
signal,
});
let json = await res.json();
setIsLoading(false);
return {
items: json.results,
};
},
async sort({items, sortDescriptor}) {
return {
items: items.sort((a, b) => {
let first = a[sortDescriptor.column as keyof SWCharacter];
let second = b[sortDescriptor.column as keyof SWCharacter];
let cmp = (parseInt(first) || first) < (parseInt(second) || second) ? -1 : 1;
if (sortDescriptor.direction === "descending") {
cmp *= -1;
}
return cmp;
}),
};
},
});
return (
<div className="p-6">
<Table
aria-label="Example table with client side sorting"
classNames={{
table: "min-h-[400px]",
}}
sortDescriptor={list.sortDescriptor}
onSortChange={list.sort}
>
<TableHeader>
<TableColumn key="name" allowsSorting>
Name
</TableColumn>
<TableColumn key="height" allowsSorting>
Height
</TableColumn>
<TableColumn key="mass" allowsSorting>
Mass
</TableColumn>
<TableColumn key="birth_year" allowsSorting>
Birth year
</TableColumn>
</TableHeader>
<TableBody
isLoading={isLoading}
items={list.items}
loadingContent={<Spinner label="Loading..." />}
>
{(item) => (
<TableRow key={item.name}>
{(columnKey) => <TableCell>{getKeyValue(item, columnKey)}</TableCell>}
</TableRow>
)}
</TableBody>
</Table>
</div>
);
}
@@ -0,0 +1,553 @@
/* eslint-disable jsx-a11y/no-onchange */
"use client";
import {
Table,
TableHeader,
TableColumn,
TableBody,
TableRow,
TableCell,
Input,
Button,
DropdownTrigger,
Dropdown,
DropdownMenu,
DropdownItem,
Selection,
Chip,
User,
ChipProps,
Pagination,
SortDescriptor,
} from "@nextui-org/react";
import {ChevronDownIcon, SearchIcon} from "@nextui-org/shared-icons";
import {useCallback, useMemo, useState} from "react";
import {capitalize} from "lodash";
import {PlusLinearIcon} from "@/components/icons";
import {VerticalDotsIcon} from "@/components/icons/vertical-dots";
const statusColorMap: Record<string, ChipProps["color"]> = {
active: "success",
paused: "danger",
vacation: "warning",
};
const columns = [
{name: "ID", uid: "id", sortable: true},
{name: "NAME", uid: "name", sortable: true},
{name: "AGE", uid: "age", sortable: true},
{name: "ROLE", uid: "role", sortable: true},
{name: "TEAM", uid: "team"},
{name: "EMAIL", uid: "email"},
{name: "STATUS", uid: "status", sortable: true},
{name: "ACTIONS", uid: "actions"},
];
const statusOptions = [
{name: "Active", uid: "active"},
{name: "Paused", uid: "paused"},
{name: "Vacation", uid: "vacation"},
];
const INITIAL_VISIBLE_COLUMNS = ["name", "role", "status", "actions"];
const users = [
{
id: 1,
name: "Tony Reichert",
role: "CEO",
team: "Management",
status: "active",
age: "29",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
email: "tony.reichert@example.com",
},
{
id: 2,
name: "Zoey Lang",
role: "Tech Lead",
team: "Development",
status: "paused",
age: "25",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026704d",
email: "zoey.lang@example.com",
},
{
id: 3,
name: "Jane Fisher",
role: "Sr. Dev",
team: "Development",
status: "active",
age: "22",
avatar: "https://i.pravatar.cc/150?u=a04258114e29026702d",
email: "jane.fisher@example.com",
},
{
id: 4,
name: "William Howard",
role: "C.M.",
team: "Marketing",
status: "vacation",
age: "28",
avatar: "https://i.pravatar.cc/150?u=a048581f4e29026701d",
email: "william.howard@example.com",
},
{
id: 5,
name: "Kristen Copper",
role: "S. Manager",
team: "Sales",
status: "active",
age: "24",
avatar: "https://i.pravatar.cc/150?u=a092581d4ef9026700d",
email: "kristen.cooper@example.com",
},
{
id: 6,
name: "Brian Kim",
role: "P. Manager",
team: "Management",
age: "29",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29026024d",
email: "brian.kim@example.com",
status: "Active",
},
{
id: 7,
name: "Michael Hunt",
role: "Designer",
team: "Design",
status: "paused",
age: "27",
avatar: "https://i.pravatar.cc/150?u=a042581f4e29027007d",
email: "michael.hunt@example.com",
},
{
id: 8,
name: "Samantha Brooks",
role: "HR Manager",
team: "HR",
status: "active",
age: "31",
avatar: "https://i.pravatar.cc/150?u=a042581f4e27027008d",
email: "samantha.brooks@example.com",
},
{
id: 9,
name: "Frank Harrison",
role: "F. Manager",
team: "Finance",
status: "vacation",
age: "33",
avatar: "https://i.pravatar.cc/150?img=4",
email: "frank.harrison@example.com",
},
{
id: 10,
name: "Emma Adams",
role: "Ops Manager",
team: "Operations",
status: "active",
age: "35",
avatar: "https://i.pravatar.cc/150?img=5",
email: "emma.adams@example.com",
},
{
id: 11,
name: "Brandon Stevens",
role: "Jr. Dev",
team: "Development",
status: "active",
age: "22",
avatar: "https://i.pravatar.cc/150?img=8",
email: "brandon.stevens@example.com",
},
{
id: 12,
name: "Megan Richards",
role: "P. Manager",
team: "Product",
status: "paused",
age: "28",
avatar: "https://i.pravatar.cc/150?img=10",
email: "megan.richards@example.com",
},
{
id: 13,
name: "Oliver Scott",
role: "S. Manager",
team: "Security",
status: "active",
age: "37",
avatar: "https://i.pravatar.cc/150?img=12",
email: "oliver.scott@example.com",
},
{
id: 14,
name: "Grace Allen",
role: "M. Specialist",
team: "Marketing",
status: "active",
age: "30",
avatar: "https://i.pravatar.cc/150?img=16",
email: "grace.allen@example.com",
},
{
id: 15,
name: "Noah Carter",
role: "IT Specialist",
team: "I. Technology",
status: "paused",
age: "31",
avatar: "https://i.pravatar.cc/150?img=15",
email: "noah.carter@example.com",
},
{
id: 16,
name: "Ava Perez",
role: "Manager",
team: "Sales",
status: "active",
age: "29",
avatar: "https://i.pravatar.cc/150?img=20",
email: "ava.perez@example.com",
},
{
id: 17,
name: "Liam Johnson",
role: "Data Analyst",
team: "Analysis",
status: "active",
age: "28",
avatar: "https://i.pravatar.cc/150?img=33",
email: "liam.johnson@example.com",
},
{
id: 18,
name: "Sophia Taylor",
role: "QA Analyst",
team: "Testing",
status: "active",
age: "27",
avatar: "https://i.pravatar.cc/150?img=29",
email: "sophia.taylor@example.com",
},
{
id: 19,
name: "Lucas Harris",
role: "Administrator",
team: "Information Technology",
status: "paused",
age: "32",
avatar: "https://i.pravatar.cc/150?img=50",
email: "lucas.harris@example.com",
},
{
id: 20,
name: "Mia Robinson",
role: "Coordinator",
team: "Operations",
status: "active",
age: "26",
avatar: "https://i.pravatar.cc/150?img=45",
email: "mia.robinson@example.com",
},
];
type User = (typeof users)[number];
export default function Page() {
const [filterValue, setFilterValue] = useState("");
const [selectedKeys, setSelectedKeys] = useState<Selection>(new Set([]));
const [visibleColumns, setVisibleColumns] = useState<Selection>(new Set(INITIAL_VISIBLE_COLUMNS));
const [statusFilter, setStatusFilter] = useState<Selection>("all");
const [rowsPerPage, setRowsPerPage] = useState(5);
const [sortDescriptor, setSortDescriptor] = useState<SortDescriptor>({
column: "age",
direction: "ascending",
});
const [page, setPage] = useState(1);
const hasSearchFilter = Boolean(filterValue);
const headerColumns = useMemo(() => {
if (visibleColumns === "all") return columns;
return columns.filter((column) => Array.from(visibleColumns).includes(column.uid));
}, [visibleColumns]);
const filteredItems = useMemo(() => {
let filteredUsers = [...users];
if (hasSearchFilter) {
filteredUsers = filteredUsers.filter((user) =>
user.name.toLowerCase().includes(filterValue.toLowerCase()),
);
}
if (statusFilter !== "all" && Array.from(statusFilter).length !== statusOptions.length) {
filteredUsers = filteredUsers.filter((user) =>
Array.from(statusFilter).includes(user.status),
);
}
return filteredUsers;
}, [users, filterValue, statusFilter]);
const pages = Math.ceil(filteredItems.length / rowsPerPage);
const items = useMemo(() => {
const start = (page - 1) * rowsPerPage;
const end = start + rowsPerPage;
return filteredItems.slice(start, end);
}, [page, filteredItems, rowsPerPage]);
const sortedItems = useMemo(() => {
return [...items].sort((a: User, b: User) => {
const first = a[sortDescriptor.column as keyof User] as number;
const second = b[sortDescriptor.column as keyof User] as number;
const cmp = first < second ? -1 : first > second ? 1 : 0;
return sortDescriptor.direction === "descending" ? -cmp : cmp;
});
}, [sortDescriptor, items]);
const renderCell = useCallback((user: User, columnKey: React.Key) => {
const cellValue = user[columnKey as keyof User];
switch (columnKey) {
case "name":
return (
<User
avatarProps={{radius: "lg", src: user.avatar}}
description={user.email}
name={cellValue}
>
{user.email}
</User>
);
case "role":
return (
<div className="flex flex-col">
<p className="text-bold text-small capitalize">{cellValue}</p>
<p className="text-bold text-tiny capitalize text-default-400">{user.team}</p>
</div>
);
case "status":
return (
<Chip className="capitalize" color={statusColorMap[user.status]} size="sm" variant="flat">
{cellValue}
</Chip>
);
case "actions":
return (
<div className="relative flex justify-end items-center gap-2">
<Dropdown>
<DropdownTrigger>
<Button isIconOnly size="sm" variant="light">
<VerticalDotsIcon className="text-default-300" />
</Button>
</DropdownTrigger>
<DropdownMenu>
<DropdownItem>View</DropdownItem>
<DropdownItem>Edit</DropdownItem>
<DropdownItem>Delete</DropdownItem>
</DropdownMenu>
</Dropdown>
</div>
);
default:
return cellValue;
}
}, []);
const onNextPage = useCallback(() => {
if (page < pages) {
setPage(page + 1);
}
}, [page, pages]);
const onPreviousPage = useCallback(() => {
if (page > 1) {
setPage(page - 1);
}
}, [page]);
const onRowsPerPageChange = useCallback((e: React.ChangeEvent<HTMLSelectElement>) => {
setRowsPerPage(Number(e.target.value));
setPage(1);
}, []);
const onSearchChange = useCallback((value?: string) => {
if (value) {
setFilterValue(value);
setPage(1);
} else {
setFilterValue("");
}
}, []);
const onClear = useCallback(() => {
setFilterValue("");
setPage(1);
}, []);
const topContent = useMemo(() => {
return (
<div className="flex flex-col gap-4">
<div className="flex justify-between gap-3 items-end">
<Input
isClearable
className="w-full sm:max-w-[44%]"
placeholder="Search by name..."
startContent={<SearchIcon />}
value={filterValue}
onClear={() => onClear()}
onValueChange={onSearchChange}
/>
<div className="flex gap-3">
<Dropdown>
<DropdownTrigger className="hidden sm:flex">
<Button endContent={<ChevronDownIcon className="text-small" />} variant="flat">
Status
</Button>
</DropdownTrigger>
<DropdownMenu
disallowEmptySelection
aria-label="Table Columns"
closeOnSelect={false}
selectedKeys={statusFilter}
selectionMode="multiple"
onSelectionChange={setStatusFilter}
>
{statusOptions.map((status) => (
<DropdownItem key={status.uid} className="capitalize">
{capitalize(status.name)}
</DropdownItem>
))}
</DropdownMenu>
</Dropdown>
<Dropdown>
<DropdownTrigger className="hidden sm:flex">
<Button endContent={<ChevronDownIcon className="text-small" />} variant="flat">
Columns
</Button>
</DropdownTrigger>
<DropdownMenu
disallowEmptySelection
aria-label="Table Columns"
closeOnSelect={false}
selectedKeys={visibleColumns}
selectionMode="multiple"
onSelectionChange={setVisibleColumns}
>
{columns.map((column) => (
<DropdownItem key={column.uid} className="capitalize">
{capitalize(column.name)}
</DropdownItem>
))}
</DropdownMenu>
</Dropdown>
<Button color="primary" endContent={<PlusLinearIcon />}>
Add New
</Button>
</div>
</div>
<div className="flex justify-between items-center">
<span className="text-default-400 text-small">Total {users.length} users</span>
<label className="flex items-center text-default-400 text-small">
Rows per page:
<select
className="bg-transparent outline-none text-default-400 text-small"
onChange={onRowsPerPageChange}
>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
</select>
</label>
</div>
</div>
);
}, [
filterValue,
statusFilter,
visibleColumns,
onSearchChange,
onRowsPerPageChange,
users.length,
hasSearchFilter,
]);
const bottomContent = useMemo(() => {
return (
<div className="py-2 px-2 flex justify-between items-center">
<span className="w-[30%] text-small text-default-400">
{selectedKeys === "all"
? "All items selected"
: `${selectedKeys.size} of ${filteredItems.length} selected`}
</span>
<Pagination
isCompact
showControls
showShadow
color="primary"
page={page}
total={pages}
onChange={setPage}
/>
<div className="hidden sm:flex w-[30%] justify-end gap-2">
<Button isDisabled={pages === 1} size="sm" variant="flat" onPress={onPreviousPage}>
Previous
</Button>
<Button isDisabled={pages === 1} size="sm" variant="flat" onPress={onNextPage}>
Next
</Button>
</div>
</div>
);
}, [selectedKeys, items.length, page, pages, hasSearchFilter]);
return (
<div className="p-6">
<Table
isHeaderSticky
aria-label="Example table with custom cells, pagination and sorting"
bottomContent={bottomContent}
bottomContentPlacement="outside"
classNames={{
wrapper: "max-h-[382px]",
}}
selectedKeys={selectedKeys}
selectionMode="multiple"
sortDescriptor={sortDescriptor}
topContent={topContent}
topContentPlacement="outside"
onSelectionChange={setSelectedKeys}
onSortChange={setSortDescriptor}
>
<TableHeader columns={headerColumns}>
{(column) => (
<TableColumn
key={column.uid}
align={column.uid === "actions" ? "center" : "start"}
allowsSorting={column.sortable}
>
{column.name}
</TableColumn>
)}
</TableHeader>
<TableBody emptyContent={"No users found"} items={sortedItems}>
{(item) => (
<TableRow key={item.id}>
{(columnKey) => <TableCell>{renderCell(item, columnKey)}</TableCell>}
</TableRow>
)}
</TableBody>
</Table>
</div>
);
}
+38
View File
@@ -0,0 +1,38 @@
import Rss from "rss";
import {allBlogPosts} from "contentlayer/generated";
import {siteConfig} from "@/config/site";
import {allCoreContent} from "@/libs/contentlayer";
export async function GET() {
const feed = new Rss({
title: siteConfig.name,
description: siteConfig.description,
feed_url: `${siteConfig.siteUrl}/feed.xml`,
site_url: siteConfig.siteUrl,
webMaster: `${siteConfig.author} <${siteConfig.email}>`,
managingEditor: `${siteConfig.author} <${siteConfig.email}>`,
language: "en-US",
});
allCoreContent(allBlogPosts).forEach((post) => {
const author = post.author ? post.author : siteConfig.author;
feed.item({
title: post.title,
description: post.description ?? "",
url: `${siteConfig.siteUrl}/blog/${post.slug}`,
guid: `${siteConfig.siteUrl}/blog/${post.slug}`,
date: post.date,
// @ts-ignore - name does exist
author: `${author.name} <${siteConfig.email}>`,
categories: post.tags ?? [],
});
});
return new Response(feed.xml(), {
headers: {
"Content-Type": "application/xml",
},
});
}
+48
View File
@@ -0,0 +1,48 @@
import {Image} from "@nextui-org/react";
import {Blockquote} from "@/components/docs/components/blockquote";
import {FigmaButton} from "@/components/figma-button";
export default function FigmaPage() {
return (
<>
<main className="relative container mx-auto max-w-7xl z-10 px-6 min-h-[calc(100vh_-_64px_-_108px)] mb-12 flex-grow">
<section className="w-full flex flex-col items-center lg:px-16 mt-12 gap-6">
<div className="text-center max-w-xl">
<h1 className="mb-2 font-bold text-4xl">NextUI Figma Kit</h1>
<h5 className="text-default-500 text-lg">
A Figma file that contains the basis of the NextUI design system to help you design
your applications.
</h5>
</div>
<iframe
className="aspect-video w-full border border-transparent dark:border-default-200/50 object-fit rounded-xl shadow-lg"
height="600"
src="https://embed.figma.com/file/1267584376234254760/hf_embed?community_viewer=true&embed_host=nextui"
title="NextUI Figma Kit"
width="800"
/>
<div className="text-center max-w-2xl m-auto">
<FigmaButton />
<Blockquote color="warning">
This file is still in development and will be continuously updated.
</Blockquote>
</div>
</section>
</main>
<div
aria-hidden="true"
className="fixed hidden dark:md:block dark:opacity-70 -bottom-[40%] -left-[20%] z-0"
>
<Image removeWrapper alt="docs left background" src="/gradients/docs-left.png" />
</div>
<div
aria-hidden="true"
className="fixed hidden dark:md:block dark:opacity-70 -top-[80%] -right-[60%] 2xl:-top-[60%] 2xl:-right-[45%] z-0 rotate-12"
>
<Image removeWrapper alt="docs right background" src="/gradients/docs-right.png" />
</div>
</>
);
}
+83
View File
@@ -0,0 +1,83 @@
import "@/styles/globals.css";
import "@/styles/sandpack.css";
import {Metadata} from "next";
import {clsx} from "@nextui-org/shared-utils";
import {Analytics} from "@vercel/analytics/react";
import {Providers} from "./providers";
import {Cmdk} from "@/components/cmdk";
import manifest from "@/config/routes.json";
import {siteConfig} from "@/config/site";
import {fontSans} from "@/config/fonts";
import {Navbar} from "@/components/navbar";
import {Footer} from "@/components/footer";
import {__PROD__} from "@/utils";
export const metadata: Metadata = {
title: {
default: siteConfig.name,
template: `%s | ${siteConfig.name}`,
},
description: siteConfig.description,
keywords: [
"React",
"Next.js",
"Tailwind CSS",
"NextUI",
"React Aria",
"Server Components",
"React Components",
"UI Components",
"UI Kit",
"UI Library",
"UI Framework",
"UI Design System",
],
themeColor: [
{media: "(prefers-color-scheme: light)", color: "white"},
{media: "(prefers-color-scheme: dark)", color: "black"},
],
icons: {
icon: "/favicon.ico",
shortcut: "/favicon-32x32.png",
apple: "/apple-touch-icon.png",
},
manifest: "/manifest.json",
twitter: siteConfig.twitter,
openGraph: siteConfig.openGraph,
authors: [
{
name: "jrgarciadev",
url: "https://jrgarciadev.com",
},
],
creator: "jrgarciadev",
alternates: {
canonical: "https://nextui.org",
types: {
"application/rss+xml": [{url: "https://nextui.org/feed.xml", title: "NextUI RSS Feed"}],
},
},
viewport:
"viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",
};
export default function RootLayout({children}: {children: React.ReactNode}) {
return (
<html suppressHydrationWarning dir="ltr" lang="en">
<head />
<body className={clsx("min-h-screen bg-background font-sans antialiased", fontSans.variable)}>
<Providers themeProps={{attribute: "class", defaultTheme: "dark"}}>
<div className="relative flex flex-col" id="app-container">
<Navbar mobileRoutes={manifest.mobileRoutes} routes={manifest.routes} />
{children}
<Footer />
</div>
<Cmdk />
</Providers>
{__PROD__ && <Analytics />}
</body>
</html>
);
}
+49
View File
@@ -0,0 +1,49 @@
import {Spacer} from "@nextui-org/spacer";
import {Hero} from "@/components/marketing/hero";
import {FeaturesGrid} from "@/components/marketing/features-grid";
import {CustomThemes} from "@/components/marketing/custom-themes";
import {A11yOtb} from "@/components/marketing/a11y-otb";
import {DarkMode} from "@/components/marketing/dark-mode";
import {Customization} from "@/components/marketing/customization";
import {LastButNotLeast} from "@/components/marketing/last-but-not-least";
import {InstallBanner} from "@/components/marketing/install-banner";
import {Community} from "@/components/marketing/community";
import {Support} from "@/components/marketing/support";
import landingContent from "@/content/landing";
import {getAllSponsors} from "@/utils/get-all-sponsors";
async function getData() {
try {
const sponsors = await getAllSponsors();
return {
sponsors,
};
} catch (error) {
throw new Error("Failed to fetch data");
}
}
export default async function Home() {
const data = await getData();
return (
<main className="container mx-auto max-w-7xl px-6 flex-grow">
<section className="flex flex-col items-center justify-center">
<Hero />
<FeaturesGrid features={landingContent.topFeatures} />
<CustomThemes />
<A11yOtb />
<DarkMode />
<Customization />
<LastButNotLeast />
<Support sponsors={data.sponsors} />
<Spacer y={24} />
<InstallBanner />
<Community />
<Spacer y={24} />
</section>
</main>
);
}
+22
View File
@@ -0,0 +1,22 @@
"use client";
import * as React from "react";
import {NextUIProvider} from "@nextui-org/react";
import {ThemeProvider as NextThemesProvider} from "next-themes";
import {ThemeProviderProps} from "next-themes/dist/types";
import {useRouter} from "next/navigation";
export interface ProvidersProps {
children: React.ReactNode;
themeProps?: ThemeProviderProps;
}
export function Providers({children, themeProps}: ProvidersProps) {
const router = useRouter();
return (
<NextUIProvider navigate={router.push}>
<NextThemesProvider {...themeProps}>{children}</NextThemesProvider>
</NextUIProvider>
);
}
@@ -0,0 +1,116 @@
import React, {useCallback, useEffect} from "react";
import Script from "next/script";
import carbonOptimize from "./carbon-optimize";
import {loadScript} from "@/utils/scripts";
import {useIsMounted} from "@/hooks/use-is-mounted";
import {__PROD__} from "@/utils";
const EA_PROVIDER_RATIO = 0.85;
export const CarbonAd: React.FC<unknown> = () => {
const carbonRef = React.useRef(null);
const [showEthicalAds, setShowEthicalAds] = React.useState(false);
const isMounted = useIsMounted();
const loadEthicalAds = useCallback(() => {
return new Promise((resolve) => {
const script = document.createElement("script");
script.src = "https://media.ethicalads.io/media/client/ethicalads.min.js";
script.async = true;
script.onload = () => {
// @ts-ignore
resolve(window.ethicalads);
};
script.onerror = () => {
resolve(null);
};
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
};
});
}, []);
useEffect(() => {
const shouldShowEthicalAds = Math.random() < EA_PROVIDER_RATIO;
let loadCarbon: any = null;
const loadCarbonAds = () => {
setShowEthicalAds(false);
// The isolation logic of carbonads is flawed.
// Once the script starts loading, it will asynchronous resolve, with no way to stop it.
// This leads to duplication of the ad. To solve the issue, we debounce the load action.
loadCarbon =
isMounted &&
setTimeout(() => {
const script = loadScript(
"https://cdn.carbonads.com/carbon.js?serve=CESIC53Y&placement=nextuiorg",
carbonRef.current,
);
script.id = "_carbonads_js";
carbonOptimize.init();
});
};
const loadAdProvider = async () => {
if (shouldShowEthicalAds) {
try {
const ethicalads = await loadEthicalAds();
if (!ethicalads) {
loadCarbonAds();
return;
}
// @ts-ignore
ethicalads.wait.then((placements) => {
if (!placements.length) {
loadCarbonAds();
} else {
setShowEthicalAds(true);
}
});
} catch (error) {
loadCarbonAds();
}
} else {
loadCarbonAds();
}
};
loadAdProvider();
return () => {
loadCarbon && clearTimeout(loadCarbon);
};
}, [isMounted]);
if (!__PROD__) return null;
return (
<>
<>
<Script async src="https://media.ethicalads.io/media/client/ethicalads.min.js" />
<div
className="ea-container horizontal"
data-ea-campaign-types="paid|publisher-house|community"
data-ea-publisher="nextuiorg"
data-ea-type="image"
style={{display: showEthicalAds ? "block" : "none"}}
/>
</>
<div className="carbon-ad-container" style={{display: showEthicalAds ? "none" : "block"}}>
<span ref={carbonRef} id="carbon-ad" />
</div>
</>
);
};
@@ -0,0 +1,64 @@
export default {
isRefreshAble: function () {
return !(
typeof document.addEventListener === "undefined" || this.browserSupport().hidden === undefined
);
},
browserSupport: function () {
let hidden;
let visibilityChange;
if (typeof document.hidden !== "undefined") {
// Opera 12.10 and Firefox 18 and later support
hidden = "hidden";
visibilityChange = "visibilitychange";
} else if (typeof document.msHidden !== "undefined") {
hidden = "msHidden";
visibilityChange = "msvisibilitychange";
} else if (typeof document.webkitHidden !== "undefined") {
hidden = "webkitHidden";
visibilityChange = "webkitvisibilitychange";
}
return {
hidden: hidden,
visibilityChange: visibilityChange,
};
},
handleVisibilityChange: function () {
const isElementInViewport = function (el) {
let element = document.querySelector(el);
let bounding = element.getBoundingClientRect();
let isVisible;
if (
bounding.top >= 0 &&
bounding.left >= 0 &&
bounding.right <= window.innerWidth &&
bounding.bottom <= window.innerHeight
) {
isVisible = true;
} else {
isVisible = false;
}
return isVisible;
};
if (!document.hidden) {
if (typeof _carbonads !== "undefined" && isElementInViewport("#carbonads")) {
// eslint-disable-next-line no-undef
_carbonads.refresh();
}
}
},
init: function () {
if (this.isRefreshAble()) {
document.addEventListener(
this.browserSupport().visibilityChange,
this.handleVisibilityChange,
false,
);
}
},
};
@@ -0,0 +1 @@
export * from "./carbon-ad";
+16 -18
View File
@@ -1,7 +1,5 @@
import {ReactNode, FC} from "react";
import {Image} from "@nextui-org/react";
import {clsx} from "@nextui-org/shared-utils";
export interface BgGridContainerProps {
showGradient?: boolean;
children?: ReactNode;
@@ -9,41 +7,41 @@ export interface BgGridContainerProps {
}
export const BgGridContainer: FC<BgGridContainerProps> = ({
showGradient = true,
// showGradient = true,
children,
className,
}) => {
return (
<div
className={clsx(
"relative overflow-y-hidden flex items-center border border-neutral-400/50 dark:border-neutral-100/50 px-2 py-4 rounded-lg",
"relative overflow-y-hidden flex items-center border border-default-200 dark:border-default-100 px-2 py-4 rounded-lg",
"overflow-hidden",
// blur effect
"bg-transparent",
"before:w-full",
"before:bg-background/10",
"before:content-['']",
"before:block",
"before:z-[-1]",
"before:absolute",
"before:inset-0",
"before:backdrop-blur-md",
"before:backdrop-saturate-200",
// "bg-transparent",
// "before:w-full",
// "before:bg-background/10",
// "before:content-['']",
// "before:block",
// "before:z-[-1]",
// "before:absolute",
// "before:inset-0",
// "before:backdrop-blur-md",
// "before:backdrop-saturate-200",
className,
)}
>
<div className="max-w-full py-4 px-2 w-full h-full scrollbar-hide overflow-x-scroll">
{children}
</div>
<div
{/* <div
className={clsx(
"absolute z-[-1] inset-0 bg-grid-zinc-300/25 [mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.6))]",
"hidden md:block absolute z-[-1] inset-0 bg-grid-zinc-300/25 [mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.6))]",
"dark:bg-grid-zinc-500/25 dark:[mask-image:linear-gradient(0deg,rgba(255,255,255,0.1),rgba(255,255,255,0.5))]",
)}
style={{backgroundPosition: "10px 10px"}}
/>
{showGradient && (
<div className="absolute h-full w-full z-[-1] opacity-40 -top-8 -right-28">
<div className="hidden md:block absolute h-full w-full z-[-1] opacity-40 -top-8 -right-28">
<Image
removeWrapper
alt="custom themes background"
@@ -51,7 +49,7 @@ export const BgGridContainer: FC<BgGridContainerProps> = ({
src="/gradients/blue-purple-1.svg"
/>
</div>
)}
)} */}
</div>
);
};
+79
View File
@@ -0,0 +1,79 @@
"use client";
import {BlogPost} from "contentlayer/generated";
import {Card, CardFooter, CardBody, CardHeader, Link, Avatar, Image} from "@nextui-org/react";
import Balancer from "react-wrap-balancer";
import {format, parseISO} from "date-fns";
import NextLink from "next/link";
import {AnimatePresence, motion} from "framer-motion";
import {useIsMounted} from "@/hooks/use-is-mounted";
import {trackEvent} from "@/utils/va";
const BlogPostCard = (post: BlogPost) => {
const isMounted = useIsMounted();
const handlePress = () => {
trackEvent("BlogPostCard - Selection", {
name: post.title,
action: "click",
category: "blog",
data: post.url ?? "",
});
};
return (
<AnimatePresence>
{isMounted && (
<motion.article
animate={{opacity: 1, y: 0}}
exit={{opacity: 0, y: 5}}
initial={{opacity: 0, y: 5}}
transition={{duration: 0.3}}
>
<Card
isBlurred
as={NextLink}
className="p-2 h-full border-transparent text-start bg-white/5 dark:bg-default-400/10 backdrop-blur-lg backdrop-saturate-[1.8]"
href={post.url}
isPressable={!!post.url}
onPress={handlePress}
>
<CardHeader>
<Link
as={NextLink}
className="font-semibold "
href={post.url}
size="lg"
underline="hover"
onPress={handlePress}
>
<Balancer>{post.title}</Balancer>
</Link>
</CardHeader>
<CardBody className="pt-0 px-2 pb-1">
<Image className="mb-4" src={post.image} />
<p className="font-normal w-full text-default-600">{post.description}</p>
</CardBody>
<CardFooter className="flex justify-between items-center">
<time className="block text-small text-default-500" dateTime={post.date}>
{format(parseISO(post.date), "LLLL d, yyyy")}
</time>
<Avatar size="sm" src={post.author?.avatar} />
</CardFooter>
</Card>
</motion.article>
)}
</AnimatePresence>
);
};
export const BlogPostList = ({posts}: {posts: BlogPost[]}) => {
return (
<div className="mt-10 grid gap-4 grid-cols-[repeat(auto-fill,minmax(300px,1fr))]">
{posts.map((post, idx) => (
<BlogPostCard key={idx} {...post} />
))}
</div>
);
};
+2
View File
@@ -0,0 +1,2 @@
export * from "./nextjs-templates";
export * from "./video-in-view";
@@ -0,0 +1,34 @@
import {NewNextJSIcon} from "@/components/icons";
import {FeaturesGrid} from "@/components/marketing/features-grid";
const frameworks = [
{
title: "Next.js 13 (App) Template",
isExternal: true,
description:
"A Next.js 13 with app directory template pre-configured with NextUI (v2) and Tailwind CSS.",
icon: <NewNextJSIcon height={40} width={40} />,
href: "https://github.com/nextui-org/next-app-template",
},
{
title: "Next.js 13 (Pages) Template",
isExternal: true,
description:
"A Next.js 13 with pages directory template pre-configured with NextUI (v2) and Tailwind CSS.",
icon: <NewNextJSIcon height={40} width={40} />,
href: "https://github.com/nextui-org/next-pages-template",
},
];
export const NextJsTemplates = () => {
return (
<FeaturesGrid
classNames={{
base: "mt-8 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-4",
iconWrapper: "bg-default-300/20",
body: "py-0",
}}
features={frameworks}
/>
);
};
+151
View File
@@ -0,0 +1,151 @@
/* eslint-disable jsx-a11y/media-has-caption */
"use client";
import {useInView} from "framer-motion";
import {useRef, FC, useEffect, useState, useCallback} from "react";
import {Button, cn, Spinner, Tooltip} from "@nextui-org/react";
import {PlayBoldIcon, PauseBoldIcon} from "@/components/icons";
import {RotateLeftLinearIcon} from "@/components/icons";
interface VideoInViewProps {
src: string;
playMode?: "auto" | "manual";
autoPlay?: boolean;
poster?: string;
width?: number;
height?: number;
controls?: boolean;
className?: string;
}
export const VideoInView: FC<VideoInViewProps> = ({
src,
width,
height,
poster,
autoPlay = true,
playMode = "manual",
controls = false,
className,
}) => {
const [isLoading, setIsLoading] = useState(true);
const [isPlaying, setIsPlaying] = useState(false);
const videoRef = useRef<HTMLVideoElement>(null);
const isVisible = useInView(videoRef);
// play video when it is visible and playMode is auto
useEffect(() => {
if (playMode !== "auto") {
return;
}
if (isVisible) {
videoRef.current?.play();
} else {
videoRef.current?.pause();
}
}, [isVisible]);
const handleCanPlay = useCallback(() => {
setIsLoading(false);
}, []);
useEffect(() => {
const videoEl = videoRef.current;
if (videoEl) {
if (videoEl.readyState > 3) {
// HAVE_FUTURE_DATA: enough data to start playing
handleCanPlay();
} else {
videoEl.addEventListener("canplaythrough", handleCanPlay);
}
// Cleanup the event listener
return () => {
videoEl.removeEventListener("canplaythrough", handleCanPlay);
};
}
}, []);
const onRestart = useCallback(() => {
if (videoRef.current) {
videoRef.current.currentTime = 0;
videoRef.current.play();
setIsPlaying(true);
}
}, []);
const onTogglePlay = useCallback(() => {
if (videoRef.current) {
if (!isPlaying) {
videoRef.current.play();
} else {
videoRef.current.pause();
}
setIsPlaying((v) => !v);
}
}, [isPlaying]);
return (
<div
className="relative data-[playing=true]:after:opacity-0 data-[playing=true]:after:z-[-1] after:content-[''] after:absolute after:inset-0 after:bg-black/30 after:z-20 after:transition-opacity"
data-playing={isPlaying}
>
{isLoading && (
<Spinner
className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
color="secondary"
size="lg"
/>
)}
<Tooltip content={isPlaying ? "Pause" : "Play"} delay={1000}>
<Button
isIconOnly
className="absolute z-50 right-12 top-3 border-1 border-transparent bg-transparent before:bg-white/10 before:content-[''] before:block before:z-[-1] before:absolute before:inset-0 before:backdrop-blur-md before:backdrop-saturate-100 before:rounded-lg"
size="sm"
variant="bordered"
onPress={onTogglePlay}
>
{isPlaying ? (
<PauseBoldIcon className="text-white" size={16} />
) : (
<PlayBoldIcon className="text-white" size={16} />
)}
</Button>
</Tooltip>
<Tooltip content="Restart" delay={1000}>
<Button
isIconOnly
className="absolute z-50 right-3 top-3 border-1 border-transparent bg-transparent before:bg-white/10 before:content-[''] before:block before:z-[-1] before:absolute before:inset-0 before:backdrop-blur-md before:backdrop-saturate-100 before:rounded-lg"
size="sm"
variant="bordered"
onPress={onRestart}
>
<RotateLeftLinearIcon className="text-white" size={16} />
</Button>
</Tooltip>
<video
ref={videoRef}
loop
muted
autoPlay={autoPlay && playMode === "auto"}
className={cn(
"w-full border border-transparent dark:border-default-200/50 object-fit rounded-xl shadow-lg",
className,
)}
controls={controls}
height={height}
poster={poster}
src={src}
width={width}
onCanPlay={handleCanPlay}
/>
</div>
);
};
+456
View File
@@ -0,0 +1,456 @@
/* eslint-disable jsx-a11y/no-autofocus */
"use client";
import {Command} from "cmdk";
import {useEffect, useState, FC, useMemo, useCallback, useRef} from "react";
import {matchSorter} from "match-sorter";
import {Button, ButtonProps, Kbd, Modal, ModalContent} from "@nextui-org/react";
import {CloseIcon} from "@nextui-org/shared-icons";
import {tv} from "tailwind-variants";
import {usePathname, useRouter} from "next/navigation";
import MultiRef from "react-multi-ref";
import {clsx} from "@nextui-org/shared-utils";
import scrollIntoView from "scroll-into-view-if-needed";
import {isAppleDevice, isWebKit} from "@react-aria/utils";
import {create} from "zustand";
import {intersectionBy, isEmpty} from "lodash";
import {writeStorage, useLocalStorage} from "@rehooks/local-storage";
import {
DocumentCodeBoldIcon,
HashBoldIcon,
ChevronRightLinearIcon,
SearchLinearIcon,
} from "./icons";
import searchData from "@/config/search-meta.json";
import {useUpdateEffect} from "@/hooks/use-update-effect";
import {trackEvent} from "@/utils/va";
const hideOnPaths = ["examples"];
export interface CmdkStore {
isOpen: boolean;
onClose: () => void;
onOpen: () => void;
}
export const useCmdkStore = create<CmdkStore>((set) => ({
isOpen: false,
onClose: () => set({isOpen: false}),
onOpen: () => set({isOpen: true}),
}));
const cmdk = tv({
slots: {
base: "max-h-full overflow-y-auto",
header: [
"flex",
"items-center",
"w-full",
"px-4",
"border-b",
"border-default-400/50",
"dark:border-default-100",
],
searchIcon: "text-default-400 text-lg",
input: [
"w-full",
"px-2",
"h-14",
"font-sans",
"text-lg",
"outline-none",
"rounded-none",
"bg-transparent",
"text-default-700",
"placeholder-default-500",
"dark:text-default-500",
"dark:placeholder:text-default-300",
],
list: ["px-4", "mt-2", "pb-4", "overflow-y-auto", "max-h-[50vh]"],
itemWrapper: [
"px-4",
"mt-2",
"group",
"flex",
"h-16",
"justify-between",
"items-center",
"rounded-lg",
"shadow",
"bg-content2/50",
"active:opacity-70",
"cursor-pointer",
"transition-opacity",
"data-[active=true]:bg-primary",
"data-[active=true]:text-primary-foreground",
],
leftWrapper: ["flex", "gap-3", "items-center", "w-full", "max-w-full"],
leftIcon: [
"text-default-500 dark:text-default-300",
"group-data-[active=true]:text-primary-foreground",
],
itemContent: ["flex", "flex-col", "gap-0", "justify-center", "max-w-[80%]"],
itemParentTitle: [
"text-default-400",
"text-xs",
"group-data-[active=true]:text-primary-foreground",
"select-none",
],
itemTitle: [
"truncate",
"text-default-500",
"group-data-[active=true]:text-primary-foreground",
"select-none",
],
emptyWrapper: ["flex", "flex-col", "text-center", "items-center", "justify-center", "h-32"],
},
});
interface SearchResultItem {
content: string;
objectID: string;
url: string;
type: "lvl1" | "lvl2" | "lvl3";
hierarchy: {
lvl1: string | null;
lvl2?: string | null;
lvl3?: string | null;
};
}
const MATCH_KEYS = ["hierarchy.lvl1", "hierarchy.lvl2", "hierarchy.lvl3", "content"];
const RECENT_SEARCHES_KEY = "recent-searches";
const MAX_RECENT_SEARCHES = 10;
const MAX_RESULTS = 20;
export const Cmdk: FC<{}> = () => {
const [query, setQuery] = useState("");
const [activeItem, setActiveItem] = useState(0);
const [menuNodes] = useState(() => new MultiRef<number, HTMLElement>());
const slots = useMemo(() => cmdk(), []);
const pathname = usePathname();
const eventRef = useRef<"mouse" | "keyboard">();
const listRef = useRef<HTMLDivElement>(null);
const router = useRouter();
const {isOpen, onClose, onOpen} = useCmdkStore();
const [recentSearches] = useLocalStorage<SearchResultItem[]>(RECENT_SEARCHES_KEY);
const addToRecentSearches = (item: SearchResultItem) => {
let searches = recentSearches ?? [];
// Avoid adding the same search again
if (!searches.find((i) => i.objectID === item.objectID)) {
writeStorage(RECENT_SEARCHES_KEY, [item, ...searches].slice(0, MAX_RECENT_SEARCHES));
} else {
// Move the search to the top
searches = searches.filter((i) => i.objectID !== item.objectID);
writeStorage(RECENT_SEARCHES_KEY, [item, ...searches].slice(0, MAX_RECENT_SEARCHES));
}
};
const results = useMemo<SearchResultItem[]>(
function getResults() {
if (query.length < 2) return [];
const data = searchData as SearchResultItem[];
const words = query.split(" ");
if (words.length === 1) {
return matchSorter(data, query, {
keys: MATCH_KEYS,
}).slice(0, MAX_RESULTS);
}
const matchesForEachWord = words.map((word) =>
matchSorter(data, word, {
keys: MATCH_KEYS,
}),
);
const matches = intersectionBy(...matchesForEachWord, "objectID").slice(0, MAX_RESULTS);
trackEvent("Cmdk - Search", {
name: "cmdk - search",
action: "search",
category: "cmdk",
data: {query, words, matches: matches?.map((match) => match.url).join(", ")},
});
return matches;
},
[query],
);
const items = !isEmpty(results) ? results : recentSearches ?? [];
// Toggle the menu when ⌘K / CTRL K is pressed
useEffect(() => {
const onKeyDown = (e: KeyboardEvent) => {
const hotkey = isAppleDevice() ? "metaKey" : "ctrlKey";
if (e?.key?.toLowerCase() === "k" && e[hotkey]) {
e.preventDefault();
isOpen ? onClose() : onOpen();
trackEvent("Cmdk - Open/Close", {
name: "cmdk - open/close",
action: "keydown",
category: "cmdk",
data: isOpen ? "close" : "open",
});
}
};
document.addEventListener("keydown", onKeyDown);
return () => {
document.removeEventListener("keydown", onKeyDown);
};
}, [isOpen]);
const onItemSelect = useCallback(
(item: SearchResultItem) => {
onClose();
router.push(item.url);
addToRecentSearches(item);
trackEvent("Cmdk - ItemSelect", {
name: item.content,
action: "click",
category: "cmdk",
data: item.url,
});
},
[router, recentSearches],
);
const onInputKeyDown = useCallback(
(e: React.KeyboardEvent) => {
eventRef.current = "keyboard";
switch (e.key) {
case "ArrowDown": {
e.preventDefault();
if (activeItem + 1 < items.length) {
setActiveItem(activeItem + 1);
}
break;
}
case "ArrowUp": {
e.preventDefault();
if (activeItem - 1 >= 0) {
setActiveItem(activeItem - 1);
}
break;
}
case "Control":
case "Alt":
case "Shift": {
e.preventDefault();
break;
}
case "Enter": {
if (items?.length <= 0) {
break;
}
onItemSelect(items[activeItem]);
break;
}
}
},
[activeItem, items, router],
);
useUpdateEffect(() => {
setActiveItem(0);
}, [query]);
useUpdateEffect(() => {
if (!listRef.current || eventRef.current === "mouse") return;
const node = menuNodes.map.get(activeItem);
if (!node) return;
scrollIntoView(node, {
scrollMode: "if-needed",
behavior: "smooth",
block: "end",
inline: "end",
boundary: listRef.current,
});
}, [activeItem]);
const CloseButton = useCallback(
({
onPress,
className,
}: {
onPress?: ButtonProps["onPress"];
className?: ButtonProps["className"];
}) => {
return (
<Button
isIconOnly
className={clsx(
"border data-[hover=true]:bg-content2 border-default-400 dark:border-default-100",
className,
)}
radius="full"
size="sm"
variant="bordered"
onPress={onPress}
>
<CloseIcon />
</Button>
);
},
[],
);
const renderItem = useCallback(
(item: SearchResultItem, index: number, isRecent = false) => {
const isLvl1 = item.type === "lvl1";
const mainIcon = isRecent ? (
<SearchLinearIcon className={slots.leftIcon()} size={20} strokeWidth={2} />
) : isLvl1 ? (
<DocumentCodeBoldIcon className={slots.leftIcon()} />
) : (
<HashBoldIcon className={slots.leftIcon()} />
);
return (
<Command.Item
key={item.objectID}
ref={menuNodes.ref(index)}
className={slots.itemWrapper()}
data-active={index === activeItem}
value={item.content}
onMouseEnter={() => {
eventRef.current = "mouse";
setActiveItem(index);
}}
onSelect={() => {
if (eventRef.current === "keyboard") {
return;
}
onItemSelect(item);
}}
>
<div className={slots.leftWrapper()}>
{mainIcon}
<div className={slots.itemContent()}>
{!isLvl1 && <span className={slots.itemParentTitle()}>{item.hierarchy.lvl1}</span>}
<p className={slots.itemTitle()}>{item.content}</p>
</div>
</div>
<ChevronRightLinearIcon size={14} />
</Command.Item>
);
},
[activeItem, onItemSelect, CloseButton, slots],
);
const shouldOpen = !hideOnPaths.some((path) => pathname.includes(path));
return (
<Modal
hideCloseButton
backdrop="opaque"
classNames={{
base: [
"mt-[20vh]",
"border-small",
"dark:border-default-100",
"supports-[backdrop-filter]:bg-background/80",
"dark:supports-[backdrop-filter]:bg-background/30",
"supports-[backdrop-filter]:backdrop-blur-md",
"supports-[backdrop-filter]:backdrop-saturate-150",
],
backdrop: ["bg-black/80"],
}}
isOpen={isOpen && shouldOpen}
motionProps={{
onAnimationComplete: () => {
if (!isOpen) {
setQuery("");
}
},
}}
placement="top-center"
scrollBehavior="inside"
size="xl"
onClose={() => onClose()}
>
<ModalContent>
<Command className={slots.base()} label="Quick search command" shouldFilter={false}>
<div className={slots.header()}>
<SearchLinearIcon className={slots.searchIcon()} strokeWidth={2} />
<Command.Input
autoFocus={!isWebKit()}
className={slots.input()}
placeholder="Search documentation"
value={query}
onKeyDown={onInputKeyDown}
onValueChange={setQuery}
/>
{query.length > 0 && <CloseButton onPress={() => setQuery("")} />}
<Kbd className="hidden md:block border-none px-2 py-1 ml-2 font-medium text-[0.6rem]">
ESC
</Kbd>
</div>
<Command.List ref={listRef} className={slots.list()} role="listbox">
{query.length > 0 && (
<Command.Empty>
<div className={slots.emptyWrapper()}>
<div>
<p>No results for &quot;{query}&quot;</p>
{query.length === 1 ? (
<p className="text-default-400">
Try adding more characters to your search term.
</p>
) : (
<p className="text-default-400">Try searching for something else.</p>
)}
</div>
</div>
</Command.Empty>
)}
{isEmpty(query) &&
(isEmpty(recentSearches) ? (
<div className={slots.emptyWrapper()}>
<p className="text-default-400">No recent searches</p>
</div>
) : (
recentSearches &&
recentSearches.length > 0 && (
<Command.Group
heading={
<div className="flex items-center justify-between">
<p className="text-default-600">Recent</p>
</div>
}
>
{recentSearches.map((item, index) => renderItem(item, index, true))}
</Command.Group>
)
))}
{results.map((item, index) => renderItem(item, index))}
</Command.List>
</Command>
</ModalContent>
</Modal>
);
};
@@ -108,9 +108,9 @@ function CodeTypewriter({value, className, css, ...props}: any) {
return (
<Pre className={className} css={css} {...props}>
<code
dangerouslySetInnerHTML={{__html: value}}
ref={wrapperRef}
className={className}
dangerouslySetInnerHTML={{__html: value}}
style={{opacity: 0}}
/>
</Pre>
@@ -155,7 +155,7 @@ const CodeBlock = React.forwardRef<HTMLPreElement, CodeBlockProps>((_props, forw
{...props}
>
{showWindowIcons && <WindowActions title={title} />}
<code className={clsx(classes, codeClasses)} dangerouslySetInnerHTML={{__html: result}} />
<code dangerouslySetInnerHTML={{__html: result}} className={clsx(classes, codeClasses)} />
</Pre>
);
});
@@ -1,3 +1,4 @@
"use client";
// Inspired by https://github.dev/modulz/stitches-site code demo
import React from "react";
import rangeParser from "parse-numeric-range";
+16 -5
View File
@@ -1,10 +1,14 @@
"use client";
import {FC, useState} from "react";
import {
Modal,
Button,
ModalContent,
ModalHeader,
Link as NextUILink,
ModalBody,
ModalFooter,
Skeleton,
} from "@nextui-org/react";
import Link from "next/link";
@@ -41,7 +45,7 @@ export const DemoCodeModal: FC<DemoCodeModalProps> = ({isOpen, code, title, subt
setIsCodeVisible(isOpen);
},
}}
radius={isMobile ? "none" : "2xl"}
radius={isMobile ? "none" : "lg"}
size={isMobile ? "full" : "2xl"}
onClose={onClose}
>
@@ -61,18 +65,25 @@ export const DemoCodeModal: FC<DemoCodeModalProps> = ({isOpen, code, title, subt
)}
</p>
</ModalHeader>
<ModalBody>
<Skeleton className="h-[320px] md:h-[60vh] rounded-xl" isLoaded={isCodeVisible}>
<ModalBody className="flex-initial md:pb-6">
{isCodeVisible ? (
<CodeWindow
showCopy
showWindowIcons
className="min-h-[320px] max-h-[80vh] md:max-h-[60vh] h-screen"
className="min-h-[320px] !h-[60vh] max-h-full"
language="jsx"
title={fileName}
value={code}
/>
</Skeleton>
) : (
<Skeleton className="h-[60vh] rounded-xl" />
)}
</ModalBody>
<ModalFooter className="md:hidden">
<Button fullWidth onPress={onClose}>
Close
</Button>
</ModalFooter>
</ModalContent>
</Modal>
);
+11 -2
View File
@@ -1,11 +1,14 @@
"use client";
import {useRef} from "react";
import {Button} from "@nextui-org/react";
import confetti from "canvas-confetti";
import {trackEvent} from "@/utils/va";
export const CustomButton = () => {
const buttonRef = useRef<HTMLButtonElement | null>(null);
const handleConfetti = () => {
const handleConfetti = async () => {
const {clientWidth, clientHeight} = document.documentElement;
const boundingBox = buttonRef.current?.getBoundingClientRect?.();
@@ -14,6 +17,7 @@ export const CustomButton = () => {
const targetWidth = boundingBox?.width ?? 0;
const targetCenterX = targetX + targetWidth / 2;
const confetti = (await import("canvas-confetti")).default;
confetti({
zIndex: 999,
@@ -24,6 +28,11 @@ export const CustomButton = () => {
x: targetCenterX / clientWidth,
},
});
trackEvent("LandingPage - Confetti Button", {
action: "press",
category: "landing-page",
});
};
return (
+24 -18
View File
@@ -1,6 +1,9 @@
import {Card, CardBody, Button, Image, Progress, CardProps} from "@nextui-org/react";
"use client";
import {Card, CardBody, Button, Image, Slider, CardProps} from "@nextui-org/react";
import {useState, FC} from "react";
import {clsx} from "@nextui-org/shared-utils";
import NextImage from "next/image";
import {
PauseCircleBoldIcon,
@@ -19,9 +22,8 @@ export const MusicPlayer: FC<MusicPlayerProps> = ({className, ...otherProps}) =>
return (
<Card
isBlurred
className={clsx("border-none dark:bg-black/40 bg-background/60", className)}
radius="2xl"
shadow="2xl"
className={clsx("border-none bg-background/60 dark:bg-default-100/50", className)}
shadow="sm"
{...otherProps}
>
<CardBody>
@@ -29,27 +31,26 @@ export const MusicPlayer: FC<MusicPlayerProps> = ({className, ...otherProps}) =>
<div className="relative col-span-6 md:col-span-4">
<Image
alt="Album cover"
as={NextImage}
className="object-cover"
classNames={{
base: "shadow-black/20",
}}
height={200}
shadow="lg"
height={300}
shadow="md"
src="/images/album-cover.png"
width="100%"
width={240}
/>
</div>
<div className="flex flex-col col-span-6 md:col-span-8">
<div className="flex justify-between items-start">
<div className="flex flex-col gap-0">
<h3 className="font-semibold text-foreground/90">Daily Mix</h3>
<p className="font-semibold text-foreground/90">Daily Mix</p>
<p className="text-sm text-foreground/80">12 Tracks</p>
<h1 className="text-lg font-medium mt-2">Frontend Radio</h1>
<p className="text-lg font-medium mt-2">Frontend Radio</p>
</div>
<Button
isIconOnly
className="text-neutral-900/60 data-[hover]:bg-foreground/10 -translate-y-2 translate-x-2"
aria-label="Like"
className="text-default-900/60 data-[hover]:bg-foreground/10 -translate-y-2 translate-x-2"
radius="full"
variant="light"
onPress={() => setLiked((v) => !v)}
@@ -62,15 +63,15 @@ export const MusicPlayer: FC<MusicPlayerProps> = ({className, ...otherProps}) =>
</div>
<div className="flex flex-col mt-3 gap-1">
<Progress
<Slider
aria-label="Music progress"
classNames={{
filler: "bg-neutral-800 dark:bg-white",
track: "bg-neutral-500/30",
track: "bg-default-500/30",
thumb: "w-2 h-2 after:w-2 after:h-2 after:bg-foreground",
}}
color="neutral"
color="foreground"
defaultValue={33}
size="sm"
value={33}
/>
<div className="flex justify-between">
<p className="text-sm">1:23</p>
@@ -81,6 +82,7 @@ export const MusicPlayer: FC<MusicPlayerProps> = ({className, ...otherProps}) =>
<div className="flex w-full items-center justify-center">
<Button
isIconOnly
aria-label="Repeat"
className="data-[hover]:bg-foreground/10"
radius="full"
variant="light"
@@ -89,6 +91,7 @@ export const MusicPlayer: FC<MusicPlayerProps> = ({className, ...otherProps}) =>
</Button>
<Button
isIconOnly
aria-label="Previous"
className="data-[hover]:bg-foreground/10"
radius="full"
variant="light"
@@ -97,6 +100,7 @@ export const MusicPlayer: FC<MusicPlayerProps> = ({className, ...otherProps}) =>
</Button>
<Button
isIconOnly
aria-label="Play"
className="w-auto h-auto data-[hover]:bg-foreground/10"
radius="full"
variant="light"
@@ -105,6 +109,7 @@ export const MusicPlayer: FC<MusicPlayerProps> = ({className, ...otherProps}) =>
</Button>
<Button
isIconOnly
aria-label="Next"
className="data-[hover]:bg-foreground/10"
radius="full"
variant="light"
@@ -113,6 +118,7 @@ export const MusicPlayer: FC<MusicPlayerProps> = ({className, ...otherProps}) =>
</Button>
<Button
isIconOnly
aria-label="Shuffle"
className="data-[hover]:bg-foreground/10"
radius="full"
variant="light"
@@ -0,0 +1,89 @@
import {
tv,
VariantProps,
CircularProgress,
CircularProgressProps,
circularProgress,
} from "@nextui-org/react";
import {FC} from "react";
const speedProgress = tv({
extend: circularProgress,
slots: {
svg: "",
label: "",
value: "",
},
variants: {
color: {
olive: {
svg: "text-[#84cc16]",
},
orange: {
svg: "text-[#ff8c00]",
},
violet: {
svg: "text-[#8b5cf6]",
},
},
size: {
sm: {
svg: "w-10 h-10",
label: "text-small",
value: "text-[0.5rem]",
},
md: {
svg: "w-12 h-12",
label: "text-medium",
value: "text-small",
},
lg: {
svg: "w-14 h-14",
label: "text-medium",
value: "text-[0.6rem]",
},
xl: {
svg: "w-16 h-16",
label: "text-large",
value: "text-small",
},
},
},
defaultVariants: {
color: "olive",
size: "sm",
},
});
type SpeedProgressVariants = VariantProps<typeof speedProgress>;
export interface SpeedProgressProps extends Omit<CircularProgressProps, "color" | "size"> {
color?: SpeedProgressVariants["color"];
size?: SpeedProgressVariants["size"];
}
export const SpeedProgress: FC<SpeedProgressProps> = ({color, size, ...otherProps}) => {
const slots = speedProgress({size, color});
return (
<CircularProgress
classNames={{
svg: slots.svg(),
label: slots.label(),
value: slots.value(),
}}
// color={color} // not needed because is being passed from slots
formatOptions={{style: "unit", unit: "kilometer"}}
label="Speed"
showValueLabel={true}
// size={size}
{...otherProps}
/>
);
};
// const MyApp = () => {
// return (
// <SpeedProgress color="orange" />
// );
// }
+25
View File
@@ -0,0 +1,25 @@
/* eslint-disable react/display-name */
import React from "react";
type Variants = {[K: string]: {[P: string]: string}};
type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
type StylesProps<V extends Variants> = {
[K in keyof V]?: StringToBoolean<keyof V[K]>;
} & {
variants: V;
[x: string]: any;
};
type ComponentType<P = {}> = React.ComponentType<P> | React.ForwardRefExoticComponent<P>;
export function extendStyles<P extends Variants>(
Component: ComponentType<StylesProps<P>>,
styles: {variants: P},
) {
return React.forwardRef<HTMLButtonElement, StylesProps<P>>((props, ref) => {
return <Component ref={ref} {...styles} {...props} />;
});
}
@@ -1,6 +1,9 @@
"use client";
import {useState, FC} from "react";
import {Card, CardHeader, Button, Avatar, CardBody, CardFooter} from "@nextui-org/react";
import {clsx} from "@nextui-org/shared-utils";
import NextImage from "next/image";
interface UserTwitterCardProps {
className?: string;
@@ -13,14 +16,25 @@ export const UserTwitterCard: FC<UserTwitterCardProps> = ({className}) => {
<Card className={clsx("max-w-[300px]", className)}>
<CardHeader className="justify-between">
<div className="flex gap-5">
<Avatar isBordered radius="full" size="md" src="/avatars/avatar-1.png" />
<Avatar
isBordered
ImgComponent={NextImage}
alt="Zoey Lang"
imgProps={{
width: 40,
height: 40,
}}
radius="full"
size="md"
src="/avatars/avatar-1.webp"
/>
<div className="flex flex-col items-start justify-center">
<h4 className="text-sm font-semibold leading-none text-neutral-600">Zoey Lang</h4>
<h5 className="text-sm tracking-tight text-neutral-400">@zoeylang</h5>
<h4 className="text-sm font-semibold leading-none text-default-600">Zoey Lang</h4>
<h5 className="text-sm tracking-tight text-default-400">@zoeylang</h5>
</div>
</div>
<Button
className={isFollowed ? "bg-transparent text-foreground border-neutral-200" : ""}
className={isFollowed ? "bg-transparent text-foreground border-default-200" : ""}
color="primary"
radius="full"
size="sm"
@@ -31,7 +45,7 @@ export const UserTwitterCard: FC<UserTwitterCardProps> = ({className}) => {
</Button>
</CardHeader>
<CardBody className="px-3 py-0">
<p className="text-sm pl-px text-neutral-400">
<p className="text-sm pl-px text-default-400">
Full-stack developer, @getnextui lover she/her&nbsp;
<span aria-label="confetti" role="img">
🎉
@@ -40,12 +54,12 @@ export const UserTwitterCard: FC<UserTwitterCardProps> = ({className}) => {
</CardBody>
<CardFooter className="gap-3">
<div className="flex gap-1">
<p className="font-semibold text-neutral-400 text-sm">4</p>
<p className=" text-neutral-400 text-sm">Following</p>
<p className="font-semibold text-default-400 text-sm">4</p>
<p className=" text-default-400 text-sm">Following</p>
</div>
<div className="flex gap-1">
<p className="font-semibold text-neutral-400 text-sm">97.1K</p>
<p className="text-neutral-400 text-sm">Followers</p>
<p className="font-semibold text-default-400 text-sm">97.1K</p>
<p className="text-default-400 text-sm">Followers</p>
</div>
</CardFooter>
</Card>
@@ -1,12 +1,13 @@
"use client";
import {FC} from "react";
import {tv, VariantProps} from "tailwind-variants";
const blockquote = tv({
base: "border pl-4 bg-neutral-50 my-6 py-3 rounded-xl [&>p]:m-0",
const blockquoteStyles = tv({
base: "border px-4 bg-default-50 my-6 py-3 rounded-xl [&>p]:m-0",
variants: {
color: {
neutral: "border-neutral-100 bg-neutral-50/20",
default: "border-default-200 dark:border-default-100 bg-default-200/20",
primary: "border-primary-100 bg-primary-50/20",
secondary: "border-secondary-100 bg-secondary-50/20",
success: "border-success-100 bg-success-50/20",
@@ -15,11 +16,11 @@ const blockquote = tv({
},
},
defaultVariants: {
color: "neutral",
color: "default",
},
});
type BlockquoteVariantProps = VariantProps<typeof blockquote>;
type BlockquoteVariantProps = VariantProps<typeof blockquoteStyles>;
export interface BlockquoteProps extends BlockquoteVariantProps {
children?: React.ReactNode;
@@ -27,7 +28,7 @@ export interface BlockquoteProps extends BlockquoteVariantProps {
}
export const Blockquote: FC<BlockquoteProps> = ({children, color, className, ...props}) => {
const styles = blockquote({color, className});
const styles = blockquoteStyles({color, className});
return (
<blockquote className={styles} {...props}>
@@ -1,87 +1,207 @@
import React from "react";
"use client";
import React, {useCallback, useMemo, useRef} from "react";
import dynamic from "next/dynamic";
import {Spinner} from "@nextui-org/react";
import {Skeleton, Tab, Tabs} from "@nextui-org/react";
import {useInView} from "framer-motion";
import {useCodeDemo, UseCodeDemoProps} from "./use-code-demo";
import WindowResizer, {WindowResizerProps} from "./window-resizer";
import {GradientBoxProps} from "@/components/gradient-box";
import {trackEvent} from "@/utils/va";
const DynamicReactLiveDemo = dynamic(
() => import("./react-live-demo").then((m) => m.ReactLiveDemo),
{
ssr: false,
// eslint-disable-next-line react/display-name
loading: () => (
<div>
<Spinner />
</div>
),
loading: () => <Skeleton className="w-full h-24 rounded-xl" />,
},
);
const DynamicSandpack = dynamic(() => import("../../../sandpack").then((m) => m.Sandpack), {
ssr: false,
// eslint-disable-next-line react/display-name
loading: () => (
<div>
<Spinner />
</div>
),
loading: () => <Skeleton className="w-full h-32 rounded-xl" />,
});
interface CodeDemoProps extends UseCodeDemoProps {
component?: string;
interface CodeDemoProps extends UseCodeDemoProps, WindowResizerProps {
title?: string;
asIframe?: boolean;
showSandpackPreview?: boolean;
initialEditorOpen?: boolean;
enableResize?: boolean;
showPreview?: boolean;
showWindowActions?: boolean;
iframeSrc?: string;
asIframe?: boolean;
iframeInitialWidth?: number;
hideWindowActions?: boolean;
showOpenInCodeSandbox?: boolean;
isPreviewCentered?: boolean;
resizeEnabled?: boolean;
typescriptStrict?: boolean;
displayMode?: "always" | "visible";
isGradientBox?: boolean;
gradientColor?: GradientBoxProps["color"];
defaultExpanded?: boolean;
previewHeight?: string | number;
overflow?: "auto" | "visible" | "hidden";
className?: string;
}
export const CodeDemo: React.FC<CodeDemoProps> = ({
files = {},
component,
title,
showEditor = true,
showPreview = true,
asIframe = false,
showTabs = true,
resizeEnabled = true,
hideWindowActions = false,
showSandpackPreview = false,
showWindowActions = false,
enableResize = false,
isPreviewCentered = false,
// when false .js files will be used
typescriptStrict = false,
showOpenInCodeSandbox,
isGradientBox = false,
defaultExpanded = false,
previewHeight = "auto",
overflow = "visible",
displayMode = "always",
gradientColor,
highlightedLines,
iframeInitialWidth,
iframeSrc,
className,
}) => {
const ref = useRef(null);
const isInView = useInView(ref, {
once: true,
margin: "600px",
});
const {noInline, code} = useCodeDemo({
files,
});
return (
<div className="flex flex-col gap-4">
{showPreview && (
<DynamicReactLiveDemo
code={code}
enableResize={enableResize || asIframe}
height={previewHeight}
iframeInitialWidth={iframeInitialWidth}
iframeSrc={iframeSrc}
iframeTitle={component}
noInline={noInline}
overflow={overflow}
showWindowActions={showWindowActions || asIframe}
/>
)}
const renderContent = useCallback(
(content: React.ReactNode) => {
if (displayMode === "always") return content;
if (displayMode === "visible") {
if (!isInView) {
return <div style={{height: previewHeight}} />;
}
return content;
}
},
[displayMode, previewHeight, isInView],
);
const previewContent = useMemo(() => {
if (!showPreview) return null;
const content = asIframe ? (
<WindowResizer
hideWindowActions={hideWindowActions}
iframeHeight={previewHeight}
iframeInitialWidth={iframeInitialWidth}
iframeSrc={iframeSrc}
iframeTitle={title}
resizeEnabled={resizeEnabled}
/>
) : (
<DynamicReactLiveDemo
className={className}
code={code}
gradientColor={gradientColor}
height={previewHeight}
isCentered={isPreviewCentered}
isGradientBox={isGradientBox}
noInline={noInline}
overflow={overflow}
/>
);
return renderContent(content);
}, [
displayMode,
isGradientBox,
gradientColor,
previewHeight,
hideWindowActions,
asIframe,
showPreview,
isInView,
className,
]);
const editorContent = useMemo(() => {
if (!showEditor) return null;
const content = (
<DynamicSandpack
defaultExpanded={defaultExpanded}
files={files}
highlightedLines={highlightedLines}
showEditor={showEditor}
showOpenInCodeSandbox={showPreview}
showOpenInCodeSandbox={showOpenInCodeSandbox || showPreview}
showPreview={showSandpackPreview}
typescriptStrict={typescriptStrict}
/>
);
return renderContent(content);
}, [
displayMode,
showEditor,
isInView,
files,
highlightedLines,
defaultExpanded,
showPreview,
showSandpackPreview,
showOpenInCodeSandbox,
]);
const shouldRenderTabs = useMemo(() => {
if (!showTabs) return false;
if (!showPreview) return false;
if (!showEditor) return false;
return true;
}, [showTabs, showPreview, showEditor]);
return (
<div ref={ref} className="flex flex-col gap-2">
{shouldRenderTabs ? (
<Tabs
disableAnimation
aria-label="Code demo tabs"
classNames={{
panel: "pt-0",
}}
variant="underlined"
onSelectionChange={(tabKey) => {
trackEvent("CodeDemo - Selection", {
name: tabKey as string,
action: "tabChange",
category: "docs",
data: tabKey ?? "",
});
}}
>
<Tab key="preview" title="Preview">
{previewContent}
</Tab>
<Tab key="code" title="Code">
{editorContent}
</Tab>
</Tabs>
) : (
<>
{previewContent}
{editorContent}
</>
)}
</div>
);
};
@@ -1,18 +1,19 @@
import React from "react";
import {LivePreview, LiveProvider, LiveError} from "react-live";
import {clsx} from "@nextui-org/shared-utils";
import * as Components from "@nextui-org/react";
import {BgGridContainer} from "@/components/bg-grid-container";
import {GradientBox, GradientBoxProps} from "@/components/gradient-box";
export interface ReactLiveDemoProps {
code: string;
height?: string | number;
noInline?: boolean;
showWindowActions?: boolean;
iframeSrc?: string;
iframeTitle?: string;
iframeInitialWidth?: number;
enableResize?: boolean;
height?: string | number;
isCentered?: boolean;
isGradientBox?: boolean;
className?: string;
gradientColor?: GradientBoxProps["color"];
overflow?: "auto" | "visible" | "hidden";
}
@@ -20,13 +21,46 @@ export const scope = {
...Components,
} as Record<string, unknown>;
export const ReactLiveDemo: React.FC<ReactLiveDemoProps> = ({code, noInline}) => {
export const ReactLiveDemo: React.FC<ReactLiveDemoProps> = ({
code,
isGradientBox,
gradientColor = "orange",
isCentered = false,
height,
className,
noInline,
}) => {
const content = (
<>
<LivePreview
className={clsx("live-preview flex h-full w-full not-prose", {
"justify-center items-center": isCentered,
})}
style={{height}}
/>
<LiveError />
</>
);
return (
<LiveProvider code={code} noInline={noInline} scope={scope}>
<BgGridContainer>
<LivePreview className="live-preview flex w-full not-prose" />
<LiveError />
</BgGridContainer>
{isGradientBox ? (
<GradientBox
isCentered
className={clsx(
className,
"relative overflow-y-hidden flex items-center border border-default-200 dark:border-default-100 px-2 py-4 rounded-lg overflow-hidden",
)}
color={gradientColor}
to="top-right"
>
<div className="max-w-full py-4 px-2 w-full h-full scrollbar-hide overflow-x-scroll">
{content}
</div>
</GradientBox>
) : (
<BgGridContainer className={className}>{content}</BgGridContainer>
)}
</LiveProvider>
);
};
@@ -0,0 +1,168 @@
import React from "react";
import {motion, useMotionValue, useTransform} from "framer-motion";
import {tv} from "tailwind-variants";
import {useIsMobile} from "@/hooks/use-media-query";
import {useIsomorphicLayoutEffect} from "@/hooks/use-isomorphic-layout-effect";
import {WindowActions} from "@/components/code-window/window-actions";
const resizer = tv({
slots: {
base: "flex items-center justify-end absolute right-[5px] z-10 w-auto xs:hidden",
main: "relative w-full",
barWrapper:
"cursor-ew-resize select-none absolute d-flex justify-center flex items-center w-[10px] h-auto active:opacity-80",
barInner: "relative z-10",
bar: "w-[6px] h-[40px] rounded-full bg-default-400",
iframeWrapper:
"relative z-10 w-full h-full border border-default-200 dark:border-default-100 rounded-lg overflow-hidden",
iframe: "w-full h-[calc(100%_-_2rem)] border-none z-10 overflow-scroll",
},
variants: {
hasInitialWidth: {
true: {
base: "justify-start",
},
},
isMobile: {
true: {
barInner: "hidden",
},
},
enablePointerEvents: {
true: {
iframe: "pointer-events-auto",
iframeWrapper: "pointer-events-auto",
},
false: {
iframe: "pointer-events-none select-none",
iframeWrapper: "pointer-events-none select-none",
},
},
},
defaultVariants: {
hasInitialWidth: false,
isMobile: false,
enablePointerEvents: true,
},
});
export interface WindowResizerProps {
resizeEnabled?: boolean;
hideWindowActions?: boolean;
iframeHeight?: string | number;
iframeMinWidth?: number;
iframeSrc?: string;
iframeInitialWidth?: number;
iframeTitle?: string;
}
const MIN_WIDTH = 320;
const WindowResizer: React.FC<WindowResizerProps> = (props) => {
let constraintsResizerRef = React.useRef<HTMLDivElement>(null);
let resizerRef = React.useRef<HTMLDivElement>(null);
let iframeRef = React.useRef<HTMLIFrameElement>(null);
const [enablePointerEvents, setEnablePointerEvents] = React.useState(true);
const isMobile = useIsMobile();
const {
iframeSrc,
iframeTitle,
resizeEnabled,
hideWindowActions = false,
iframeHeight: height = "420px",
iframeInitialWidth,
iframeMinWidth: minWidth = MIN_WIDTH,
} = props;
const hasInitialWidth = iframeInitialWidth !== undefined;
const {main, base, barInner, barWrapper, bar, iframe, iframeWrapper} = resizer({
hasInitialWidth,
isMobile,
enablePointerEvents,
});
const resizerX = useMotionValue(0);
const browserWidth = useTransform(resizerX, (x) =>
hasInitialWidth ? iframeInitialWidth + x + 14 : `calc(100% + ${x}px - 14px)`,
);
useIsomorphicLayoutEffect(() => {
let observer = new window.ResizeObserver(() => {
if (constraintsResizerRef.current && resizerRef.current) {
let width = constraintsResizerRef.current.offsetWidth - resizerRef.current.offsetWidth;
if (resizerX.get() > width) {
resizerX.set(width);
}
}
});
constraintsResizerRef.current && observer.observe(constraintsResizerRef.current);
return () => {
observer.disconnect();
};
}, []);
React.useEffect(() => {
if (!resizerRef.current) {
return;
}
resizerRef.current.onselectstart = () => false;
}, []);
return (
<div className={main()} style={{height}}>
<motion.div
className={iframeWrapper()}
style={{
width: isMobile ? "100%" : browserWidth,
}}
>
{!hideWindowActions && <WindowActions className="bg-default-100 dark:bg-default-50" />}
<motion.iframe ref={iframeRef} className={iframe()} src={iframeSrc} title={iframeTitle} />
</motion.div>
{resizeEnabled && (
<div
ref={constraintsResizerRef}
className={base({
className: "z-1 top-0 bottom-0 right-0 xs:w-mw-xs",
})}
style={{
width: `calc(100% - ${hasInitialWidth ? iframeInitialWidth : minWidth}px - 20px)`,
}}
>
<motion.div
ref={resizerRef}
_dragX={resizerX}
className={barWrapper()}
drag="x"
dragConstraints={constraintsResizerRef}
dragElastic={0}
dragMomentum={false}
style={{x: resizerX}}
onDragEnd={() => {
document.documentElement.classList.remove("dragging-ew");
iframeRef.current?.classList.remove("dragging-ew");
setEnablePointerEvents(true);
}}
onDragStart={() => {
document.documentElement.classList.add("dragging-ew");
iframeRef.current?.classList.add("dragging-ew");
setEnablePointerEvents(false);
}}
>
<div className={barInner()}>
<div className={bar()} />
</div>
</motion.div>
</div>
)}
</div>
);
};
export default WindowResizer;
@@ -1,19 +1,25 @@
import React from "react";
import {clsx} from "@nextui-org/shared-utils";
import React, {forwardRef, useEffect} from "react";
import {clsx, dataAttr, getUniqueID} from "@nextui-org/shared-utils";
import BaseHighlight, {Language, PrismTheme, defaultProps} from "prism-react-renderer";
import {debounce} from "lodash";
import defaultTheme from "@/libs/prism-theme";
import {trackEvent} from "@/utils/va";
interface CodeblockProps {
language: Language;
codeString: string;
metastring?: string;
theme?: PrismTheme;
children?: React.ReactNode;
showLines?: boolean;
removeIndent?: boolean;
hideScrollBar?: boolean;
className?: string;
children?: (props: any) => React.ReactNode;
}
type HighlightStyle = "inserted" | "deleted" | undefined;
const RE = /{([\d,-]+)}/;
const calculateLinesToHighlight = (meta?: string) => {
@@ -39,61 +45,151 @@ const calculateLinesToHighlight = (meta?: string) => {
};
};
export function Codeblock({
codeString,
language,
showLines,
theme: themeProp,
metastring,
className: classNameProp,
...props
}: CodeblockProps) {
const theme = themeProp || defaultTheme;
const shouldHighlightLine = calculateLinesToHighlight(metastring);
const isMultiLine = codeString.split("\n").length > 2;
const Codeblock = forwardRef<HTMLPreElement, CodeblockProps>(
(
{
codeString,
language,
showLines,
theme: themeProp,
metastring,
hideScrollBar,
removeIndent,
className: classNameProp,
...props
},
ref,
) => {
const theme = themeProp || defaultTheme;
const shouldHighlightLine = calculateLinesToHighlight(metastring);
const isMultiLine = codeString.split("\n").length > 2;
return (
<BaseHighlight {...defaultProps} code={codeString} language={language} theme={theme} {...props}>
{({className, style, tokens, getLineProps, getTokenProps}) => (
<div className="w-full" data-language={language}>
<pre
className={clsx(className, classNameProp, "flex max-w-full", {
"flex-col": isMultiLine,
})}
style={style}
>
{tokens.map((line, i) => {
const lineProps = getLineProps({line, key: i});
const lastSelectionText = React.useRef<string | null>(null);
return (
<div
key={i}
{...lineProps}
className={clsx(
lineProps.className,
"px-4 relative [&>span]:relative [&>span]:z-10",
{
"px-2": showLines,
},
{
"before:content-[''] before:w-full before:h-full before:absolute before:z-0 before:left-0 before:bg-gradient-to-r before:from-white/10 before:to-code-background before:border-l-2 border-l-white/80 dark:before:border-l-white/50": shouldHighlightLine(
i,
),
},
)}
>
{showLines && (
<span className="select-none text-xs mr-6 opacity-30">{i + 1}</span>
)}
{line.map((token, key) => (
<span key={key} {...getTokenProps({token, key})} className={className} />
))}
</div>
);
})}
</pre>
</div>
)}
</BaseHighlight>
);
}
const isDiff = language.includes("diff");
const codeLang = isDiff ? (language.split("-")[1] as Language) : language;
let highlightStyle: HighlightStyle[] = [];
if (isDiff) {
let code: string[] = [];
highlightStyle = codeString.split?.("\n").map((line) => {
if (line.startsWith("+")) {
code.push(line.substr(1));
return "inserted";
}
if (line.startsWith("-")) {
code.push(line.substr(1));
return "deleted";
}
code.push(line);
});
codeString = code.join("\n");
}
useEffect(() => {
const handleSelectionChange = () => {
if (!window.getSelection) return;
const el = window.getSelection()?.anchorNode?.parentNode;
if (!el) return;
const selectionText = window.getSelection()?.toString();
if (!selectionText) return;
if (
!selectionText ||
selectionText === lastSelectionText.current ||
!codeString.includes(selectionText)
)
return;
lastSelectionText.current = selectionText;
trackEvent("Codeblock - Selection", {
action: "selectText",
category: "docs",
data: selectionText,
});
};
const debouncedHandleSelectionChange = debounce(handleSelectionChange, 1000);
document.addEventListener("selectionchange", debouncedHandleSelectionChange);
return () => {
document.removeEventListener("selectionchange", debouncedHandleSelectionChange);
};
}, []);
return (
<BaseHighlight
{...defaultProps}
code={codeString}
language={codeLang}
theme={theme}
{...props}
>
{({className, style, tokens, getLineProps, getTokenProps}) => (
<div className="w-full" data-language={language}>
<pre
ref={ref}
className={clsx(className, classNameProp, "flex max-w-full", {
"flex-col": isMultiLine,
"scrollbar-hide overflow-x-scroll": hideScrollBar,
})}
style={style}
>
{tokens.map((line, i) => {
const lineProps = getLineProps({line, key: i});
return (
<div
key={`${i}-${getUniqueID("line-wrapper")}`}
{...lineProps}
className={clsx(
lineProps.className,
removeIndent ? "pr-4" : "px-4",
"relative [&>span]:relative [&>span]:z-10",
{
"px-2": showLines,
},
{
"before:content-[''] before:w-full before:h-full before:absolute before:z-0 before:left-0 before:bg-gradient-to-r before:from-white/10 before:to-code-background":
shouldHighlightLine(i),
},
)}
data-deleted={dataAttr(highlightStyle?.[i] === "deleted")}
data-inserted={dataAttr(highlightStyle?.[i] === "inserted")}
>
{showLines && (
<span className="select-none text-xs mr-6 opacity-30">{i + 1}</span>
)}
{line.map((token, key) => (
<span
key={`${key}-${getUniqueID("line")}`}
{...getTokenProps({token, key})}
className={className}
/>
))}
</div>
);
})}
</pre>
</div>
)}
</BaseHighlight>
);
},
);
Codeblock.displayName = "CodeBlock";
export default Codeblock;
@@ -1,4 +1,4 @@
import {FeaturesGrid} from "@/components/marketing";
import {FeaturesGrid} from "@/components/marketing/features-grid";
import {communityAccounts} from "@/libs/constants";
export const Community = () => {
@@ -1,82 +1,127 @@
import {Button, Link} from "@nextui-org/react";
import {Button, ButtonProps, Code, Link, Tooltip} from "@nextui-org/react";
import {ReactNode} from "react";
import Balancer from "react-wrap-balancer";
import {GithubIcon, NpmIcon, AdobeIcon, StorybookIcon} from "@/components/icons";
import {GithubIcon, NpmIcon, AdobeIcon, StorybookIcon, NextJsIcon} from "@/components/icons";
import {COMPONENT_PATH, COMPONENT_THEME_PATH} from "@/libs/github/constants";
import {trackEvent} from "@/utils/va";
export interface ComponentLinksProps {
component: string;
styles?: string;
storybook?: string;
rscCompatible?: boolean;
reactAriaHook?: string;
}
export const ComponentLinks = ({component, reactAriaHook}: ComponentLinksProps) => {
const ButtonLink = ({
children,
href,
startContent,
tooltip,
...props
}: ButtonProps & {
href: string;
tooltip?: string | ReactNode;
}) => {
const handlePress = () => {
if (!href) return;
trackEvent("ComponentLinks - Click", {
category: "docs",
action: "click",
data: href || "",
});
};
const button = (
<Button
isExternal
as={Link}
className="!text-small py-4 bg-default-100 dark:bg-default-50 text-default-700"
href={href}
size="sm"
startContent={startContent}
onPress={handlePress}
{...props}
>
{children}
</Button>
);
return tooltip ? (
<Tooltip className="max-w-[230px]" content={tooltip}>
{button}
</Tooltip>
) : (
button
);
};
export const ComponentLinks = ({
component,
storybook,
styles,
rscCompatible,
reactAriaHook,
}: ComponentLinksProps) => {
if (!component) {
return null;
}
return (
<div className="flex flex-wrap gap-3 mt-6">
<Button
isExternal
as={Link}
className="text-neutral-700"
href={`https://storiesv2.nextui.org/?path=/story/components-${component}`}
radius="md"
size="sm"
startIcon={<StorybookIcon className="text-lg text-[#ff4785]" />}
variant="flat"
<ButtonLink
href={`https://storybook.nextui.org/?path=/story/components-${
storybook || component
}--default`}
startContent={<StorybookIcon className="text-lg text-[#ff4785]" />}
>
Storybook
</Button>
<Button
isExternal
as={Link}
className="text-neutral-700"
</ButtonLink>
<ButtonLink
href={`https://www.npmjs.com/package/@nextui-org/${component}`}
radius="md"
size="sm"
startIcon={<NpmIcon className="text-2xl text-[#E53E3E]" />}
variant="flat"
startContent={<NpmIcon className="text-2xl text-[#E53E3E]" />}
>
{`@nextui-org/${component}`}
</Button>
</ButtonLink>
{reactAriaHook && (
<Button
isExternal
as={Link}
className="text-neutral-700"
<ButtonLink
href={`https://react-spectrum.adobe.com/react-aria/${reactAriaHook}.html`}
radius="md"
size="sm"
startIcon={<AdobeIcon className="text-lg text-[#E1251B]" />}
variant="flat"
startContent={<AdobeIcon className="text-lg text-[#E1251B]" />}
>
React Aria
</Button>
</ButtonLink>
)}
<Button
isExternal
as={Link}
className="text-neutral-700"
href={`${COMPONENT_PATH}/${component}`}
radius="md"
size="sm"
startIcon={<GithubIcon />}
variant="flat"
>
{rscCompatible && (
<ButtonLink
href="https://nextjs.org/docs/app/building-your-application/rendering/server-components"
startContent={<NextJsIcon size={18} />}
tooltip={
<p>
<Balancer>
This component doesn&apos;t use the
<Code className="font-normal bg-transparent px-0 py-0 text-code-mdx">
`use client;`
</Code>
directive making it compatible with RSC.
</Balancer>
</p>
}
>
Server component
</ButtonLink>
)}
<ButtonLink href={`${COMPONENT_PATH}/${component}`} startContent={<GithubIcon size={20} />}>
Source
</Button>
<Button
isExternal
as={Link}
className="text-neutral-700"
href={`${COMPONENT_THEME_PATH}/${component}.ts`}
radius="md"
size="sm"
startIcon={<GithubIcon />}
variant="flat"
</ButtonLink>
<ButtonLink
href={`${COMPONENT_THEME_PATH}/${styles || component}.ts`}
startContent={<GithubIcon size={20} />}
>
Styles source
</Button>
</ButtonLink>
</div>
);
};
@@ -1,5 +1,5 @@
import {NewNextJSIcon, ViteIcon, RemixIcon, AstroIcon} from "@/components/icons";
import {FeaturesGrid} from "@/components/marketing";
import {FeaturesGrid} from "@/components/marketing/features-grid";
const frameworks = [
{
@@ -33,7 +33,7 @@ export const Frameworks = () => {
<FeaturesGrid
classNames={{
base: "mt-8 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-4",
iconWrapper: "bg-neutral-300/20",
iconWrapper: "bg-default-300/20",
body: "py-0",
}}
features={frameworks}
@@ -0,0 +1,81 @@
import {Tabs, Tab, Snippet} from "@nextui-org/react";
import Codeblock from "./codeblock";
import {trackEvent} from "@/utils/va";
type PackageManager = {
key: string;
name: string;
};
const importTabs: PackageManager[] = [
{
key: "main",
name: "Main",
},
{
key: "individual",
name: "Individual",
},
];
export interface ImportTabsProps {
commands: Record<string, string>;
}
export const ImportTabs = ({commands}: ImportTabsProps) => {
return (
<Tabs
disableAnimation
aria-label="NextUI import commands"
classNames={{
base: "group mt-4",
tabList: "relative h-10",
}}
variant="underlined"
onSelectionChange={(tabKey) => {
trackEvent("ImportTabs - Selection", {
name: tabKey as string,
action: "tabChange",
category: "docs",
data: commands[tabKey] ?? "",
});
}}
>
{importTabs.map(({key, name}) => {
if (!commands[key]) return null;
return (
<Tab key={key} title={name}>
<Snippet
disableTooltip
fullWidth
hideSymbol
classNames={{
base: "bg-code-background text-code-foreground",
pre: "font-light text-base",
copyButton: "text-lg text-default-400",
}}
onCopy={() => {
trackEvent("ImportTabs - Copy", {
name,
action: "copyInstallScript",
category: "docs",
data: commands[name] ?? "",
});
}}
>
<Codeblock
hideScrollBar
removeIndent
codeString={commands[key] as string}
language="jsx"
/>
</Snippet>
</Tab>
);
})}
</Tabs>
);
};
@@ -4,3 +4,6 @@ export * from "./blockquote";
export * from "./community";
export * from "./frameworks";
export * from "./code-demo";
export * from "./import-tabs";
export * from "./swatch-colors-set";
export {default as Codeblock} from "./codeblock";
@@ -1,8 +1,11 @@
import {Tabs, TabItem, Snippet} from "@nextui-org/react";
import {Tabs, Tab, Snippet} from "@nextui-org/react";
import {Key} from "react";
import {useLocalStorage} from "usehooks-ts";
import {Codeblock} from "./codeblock";
import Codeblock from "./codeblock";
import {YarnIcon, NpmSmallIcon, PnpmIcon} from "@/components/icons";
import {trackEvent} from "@/utils/va";
type PackageManagerName = "npm" | "yarn" | "pnpm";
@@ -27,10 +30,26 @@ const packageManagers: PackageManager[] = [
];
export interface PackageManagersProps {
commands: Partial<Record<PackageManagerName, string>>;
commands: Partial<Record<PackageManagerName, React.Key>>;
}
export const PackageManagers = ({commands}: PackageManagersProps) => {
const [selectedManager, setSelectedManager] = useLocalStorage<PackageManagerName>(
"selectedPackageManager",
"npm",
);
const handleSelectionChange = (tabKey: Key) => {
trackEvent("PackageManagers - Selection", {
name: `${tabKey}`,
action: "tabChange",
category: "docs",
data: commands[tabKey as unknown as PackageManagerName] ?? "",
});
setSelectedManager(tabKey as PackageManagerName);
};
return (
<Tabs
aria-label="NextUI installation commands"
@@ -38,13 +57,15 @@ export const PackageManagers = ({commands}: PackageManagersProps) => {
base: "group mt-4",
tabList: "h-10",
}}
selectedKey={selectedManager}
variant="underlined"
onSelectionChange={handleSelectionChange}
>
{packageManagers.map(({name, icon}) => {
if (!commands[name]) return null;
return (
<TabItem
<Tab
key={name}
title={
<div className="flex items-center space-x-2">
@@ -60,12 +81,20 @@ export const PackageManagers = ({commands}: PackageManagersProps) => {
classNames={{
base: "bg-code-background text-code-foreground",
pre: "font-light text-base",
copyButton: "text-lg text-code-foreground/50",
copyButton: "text-lg text-zinc-500 mr-2",
}}
onCopy={() => {
trackEvent("PackageManagers - Copy", {
name,
action: "copyScript",
category: "docs",
data: commands[name] ?? "",
});
}}
>
<Codeblock codeString={commands[name] as string} language="bash" />
<Codeblock removeIndent codeString={commands[name] as string} language="bash" />
</Snippet>
</TabItem>
</Tab>
);
})}
</Tabs>
@@ -0,0 +1,641 @@
import {parseToRgba, readableColor} from "color2k";
import {Button, Tooltip} from "@nextui-org/react";
import {commonColors, semanticColors} from "@nextui-org/theme";
import {useClipboard} from "@nextui-org/use-clipboard";
import {useState} from "react";
import {useTheme} from "next-themes";
import {get, isEmpty} from "lodash";
type ColorsItem = {
color: string;
scale?: string;
className?: string;
textClassName?: string;
};
type SwatchColors = {
title: string;
items: ColorsItem[];
};
type SwatchSetProps = {
colors: SwatchColors[];
isSematic?: boolean;
};
const scaleIndexMap: Record<number, string> = {
0: "50",
1: "100",
2: "200",
3: "300",
4: "400",
5: "500",
6: "600",
7: "700",
8: "800",
9: "900",
};
const Swatch = ({color, scale}: {color: string; scale?: string}) => {
const [copied, setCopied] = useState(false);
const {copy} = useClipboard();
const colorText = color
? `#${parseToRgba(color)
.slice(0, 3)
.map((x) => x.toString(16).padStart(2, "0"))
.join("")
.toUpperCase()}`
: "N/A";
const handleCopy = () => {
copy(colorText);
setCopied(true);
setTimeout(() => {
setCopied(false);
}, 1000);
};
return (
<Tooltip content="Copied" isOpen={copied}>
<Button
className="flex flex-col gap-1 items-center justify-center w-24 h-24 m-2 rounded-medium shadow-small"
style={{
backgroundColor: color,
}}
onPress={handleCopy}
>
<span
className="text-small font-semibold"
style={{
color: readableColor(color),
}}
>
{colorText}
</span>
{scale && (
<span
className="text-tiny font-semibold"
style={{
color: readableColor(color),
}}
>
{scale}
</span>
)}
</Button>
</Tooltip>
);
};
const SematicSwatch = ({
color,
className,
textClassName,
}: {
color: string;
className?: string;
textClassName?: string;
}) => {
const [copied, setCopied] = useState(false);
const {copy} = useClipboard();
const {theme} = useTheme();
let value: string = "";
const [colorName, colorScale] = color.split("-");
let currentPalette = get(semanticColors, theme ?? "", {});
if (!colorScale) {
value = get(currentPalette, `${colorName}.DEFAULT`, "");
} else {
value = get(currentPalette, `${colorName}.${colorScale}`, "");
}
const handleCopy = () => {
copy(value);
setCopied(true);
setTimeout(() => {
setCopied(false);
}, 1000);
};
return (
<Tooltip content="Copied" isOpen={copied}>
<Button
className={`${className} gap-1 flex flex-col items-center justify-center w-24 h-24 m-2 rounded-medium shadow-small`}
onPress={handleCopy}
>
<span className={`${textClassName} text-tiny font-semibold`}>{color}</span>
{!isEmpty(value) && (
<span className={`${textClassName} text-tiny font-semibold`}>{value}</span>
)}
</Button>
</Tooltip>
);
};
const SwatchSet = ({colors, isSematic = false}: SwatchSetProps) => (
<div className="flex flex-row flex-wrap items-center justify-center">
{colors.map(({title, items}) => (
<div key={title} className="flex flex-col items-start w-full h-full">
<h2 className="text-xl font-bold text-foreground">{title}</h2>
<div className="flex flex-row flex-wrap items-center justify-start w-full h-full px-4 py-1">
{items.map((c, index) =>
isSematic ? (
<SematicSwatch
key={`${c.color}-${index}`}
className={c.className}
color={c.color}
textClassName={c.textClassName}
/>
) : (
<Swatch key={`${c.color}-${index}`} color={c.color} scale={c.scale} />
),
)}
</div>
</div>
))}
</div>
);
const getCommonItems = (colors: string[]) => {
return colors.map((color, index, array) => ({
color,
scale: array.length > 2 ? scaleIndexMap[index] : undefined,
}));
};
export const CommonColors = () => {
return (
<SwatchSet
colors={[
{
title: "White & Black",
items: getCommonItems([commonColors.white, commonColors.black]),
},
{
title: "Blue",
items: getCommonItems([...Object.values(commonColors.blue)]),
},
{
title: "Purple",
items: getCommonItems([...Object.values(commonColors.purple)]),
},
{
title: "Green",
items: getCommonItems([...Object.values(commonColors.green)]),
},
{
title: "Red",
items: getCommonItems([...Object.values(commonColors.red)]),
},
{
title: "Pink",
items: getCommonItems([...Object.values(commonColors.pink)]),
},
{
title: "Yellow",
items: getCommonItems([...Object.values(commonColors.yellow)]),
},
{
title: "Cyan",
items: getCommonItems([...Object.values(commonColors.cyan)]),
},
{
title: "Zinc",
items: getCommonItems([...Object.values(commonColors.zinc)]),
},
]}
/>
);
};
export const SemanticColors = () => {
return (
<SwatchSet
isSematic
colors={[
{
title: "Layout",
items: [
{
color: "background",
className: "bg-background",
textClassName: "text-foreground",
},
{
color: "foreground",
className: "bg-foreground",
textClassName: "text-background",
},
{
color: "divider",
className: "bg-divider",
textClassName: "text-foreground",
},
{
color: "focus",
className: "bg-focus",
textClassName: "text-primary-foreground",
},
],
},
{
title: "Content",
items: [
{
color: "content1",
className: "bg-content1",
textClassName: "text-content1-foreground",
},
{
color: "content2",
className: "bg-content2",
textClassName: "text-content2-foreground",
},
{
color: "content3",
className: "bg-content3",
textClassName: "text-content3-foreground",
},
{
color: "content4",
className: "bg-content4",
textClassName: "text-content4-foreground",
},
],
},
{
title: "Base",
items: [
{
color: "default",
className: "bg-default",
textClassName: "text-default-foreground",
},
{
color: "primary",
className: "bg-primary",
textClassName: "text-primary-foreground",
},
{
color: "secondary",
className: "bg-secondary",
textClassName: "text-secondary-foreground",
},
{
color: "success",
className: "bg-success",
textClassName: "text-success-foreground",
},
{
color: "warning",
className: "bg-warning",
textClassName: "text-warning-foreground",
},
{
color: "danger",
className: "bg-danger",
textClassName: "text-danger-foreground",
},
],
},
{
title: "Default",
items: [
{
color: "default-50",
className: "bg-default-50",
textClassName: "text-default-900",
},
{
color: "default-100",
className: "bg-default-100",
textClassName: "text-default-900",
},
{
color: "default-200",
className: "bg-default-200",
textClassName: "text-default-800",
},
{
color: "default-300",
className: "bg-default-300",
textClassName: "text-default-800",
},
{
color: "default-400",
className: "bg-default-400",
textClassName: "text-default-800",
},
{
color: "default-500",
className: "bg-default-500",
textClassName: "text-default-foreground",
},
{
color: "default-600",
className: "bg-default-600",
textClassName: "text-default-50",
},
{
color: "default-700",
className: "bg-default-700",
textClassName: "text-default-100",
},
{
color: "default-800",
className: "bg-default-800",
textClassName: "text-default-100",
},
{
color: "default-900",
className: "bg-default-900",
textClassName: "text-default-100",
},
],
},
{
title: "Primary",
items: [
{
color: "primary-50",
className: "bg-primary-50",
textClassName: "text-primary-900",
},
{
color: "primary-100",
className: "bg-primary-100",
textClassName: "text-primary-900",
},
{
color: "primary-200",
className: "bg-primary-200",
textClassName: "text-primary-800",
},
{
color: "primary-300",
className: "bg-primary-300",
textClassName: "text-primary-800",
},
{
color: "primary-400",
className: "bg-primary-400",
textClassName: "text-primary-800",
},
{
color: "primary-500",
className: "bg-primary-500",
textClassName: "text-primary-foreground",
},
{
color: "primary-600",
className: "bg-primary-600",
textClassName: "text-primary-50",
},
{
color: "primary-700",
className: "bg-primary-700",
textClassName: "text-primary-100",
},
{
color: "primary-800",
className: "bg-primary-800",
textClassName: "text-primary-100",
},
{
color: "primary-900",
className: "bg-primary-900",
textClassName: "text-primary-100",
},
],
},
{
title: "Secondary",
items: [
{
color: "secondary-50",
className: "bg-secondary-50",
textClassName: "text-secondary-900",
},
{
color: "secondary-100",
className: "bg-secondary-100",
textClassName: "text-secondary-900",
},
{
color: "secondary-200",
className: "bg-secondary-200",
textClassName: "text-secondary-800",
},
{
color: "secondary-300",
className: "bg-secondary-300",
textClassName: "text-secondary-800",
},
{
color: "secondary-400",
className: "bg-secondary-400",
textClassName: "text-secondary-800",
},
{
color: "secondary-500",
className: "bg-secondary-500",
textClassName: "text-secondary-foreground",
},
{
color: "secondary-600",
className: "bg-secondary-600",
textClassName: "text-secondary-50",
},
{
color: "secondary-700",
className: "bg-secondary-700",
textClassName: "text-secondary-100",
},
{
color: "secondary-800",
className: "bg-secondary-800",
textClassName: "text-secondary-100",
},
{
color: "secondary-900",
className: "bg-secondary-900",
textClassName: "text-secondary-100",
},
],
},
{
title: "Success",
items: [
{
color: "success-50",
className: "bg-success-50",
textClassName: "text-success-900",
},
{
color: "success-100",
className: "bg-success-100",
textClassName: "text-success-900",
},
{
color: "success-200",
className: "bg-success-200",
textClassName: "text-success-800",
},
{
color: "success-300",
className: "bg-success-300",
textClassName: "text-success-800",
},
{
color: "success-400",
className: "bg-success-400",
textClassName: "text-success-800",
},
{
color: "success-500",
className: "bg-success-500",
textClassName: "text-success-foreground",
},
{
color: "success-600",
className: "bg-success-600",
textClassName: "text-success-50",
},
{
color: "success-700",
className: "bg-success-700",
textClassName: "text-success-100",
},
{
color: "success-800",
className: "bg-success-800",
textClassName: "text-success-100",
},
{
color: "success-900",
className: "bg-success-900",
textClassName: "text-success-100",
},
],
},
{
title: "Warning",
items: [
{
color: "warning-50",
className: "bg-warning-50",
textClassName: "text-warning-900",
},
{
color: "warning-100",
className: "bg-warning-100",
textClassName: "text-warning-900",
},
{
color: "warning-200",
className: "bg-warning-200",
textClassName: "text-warning-800",
},
{
color: "warning-300",
className: "bg-warning-300",
textClassName: "text-warning-800",
},
{
color: "warning-400",
className: "bg-warning-400",
textClassName: "text-warning-800",
},
{
color: "warning-500",
className: "bg-warning-500",
textClassName: "text-warning-foreground",
},
{
color: "warning-600",
className: "bg-warning-600",
textClassName: "text-warning-50",
},
{
color: "warning-700",
className: "bg-warning-700",
textClassName: "text-warning-100",
},
{
color: "warning-800",
className: "bg-warning-800",
textClassName: "text-warning-100",
},
{
color: "warning-900",
className: "bg-warning-900",
textClassName: "text-warning-100",
},
],
},
{
title: "Danger",
items: [
{
color: "danger-50",
className: "bg-danger-50",
textClassName: "text-danger-900",
},
{
color: "danger-100",
className: "bg-danger-100",
textClassName: "text-danger-900",
},
{
color: "danger-200",
className: "bg-danger-200",
textClassName: "text-danger-800",
},
{
color: "danger-300",
className: "bg-danger-300",
textClassName: "text-danger-800",
},
{
color: "danger-400",
className: "bg-danger-400",
textClassName: "text-danger-800",
},
{
color: "danger-500",
className: "bg-danger-500",
textClassName: "text-danger-foreground",
},
{
color: "danger-600",
className: "bg-danger-600",
textClassName: "text-danger-50",
},
{
color: "danger-700",
className: "bg-danger-700",
textClassName: "text-danger-100",
},
{
color: "danger-800",
className: "bg-danger-800",
textClassName: "text-danger-100",
},
{
color: "danger-900",
className: "bg-danger-900",
textClassName: "text-danger-100",
},
],
},
]}
/>
);
};
-46
View File
@@ -1,46 +0,0 @@
import * as React from "react";
import NextLink from "next/link";
import {Link} from "@nextui-org/react";
import {ChevronIcon} from "@nextui-org/shared-icons";
import {removeFromLast} from "@/utils";
import {Route, addTagToSlug} from "@/libs/docs/page";
export interface FooterNavProps {
tag?: string;
prevRoute?: Route;
nextRoute?: Route;
}
export const FooterNav: React.FC<FooterNavProps> = ({tag, prevRoute, nextRoute}) => {
return (
<div className="flex w-full justify-between py-20">
{prevRoute ? (
<Link
isBlock
as={NextLink}
className="flex gap-2"
color="foreground"
href={addTagToSlug(removeFromLast(prevRoute.path || "", "."), tag)}
>
<ChevronIcon className="text-primary" height={20} width={20} />
{prevRoute.title}
</Link>
) : (
<span />
)}
{nextRoute && (
<Link
isBlock
as={NextLink}
className="flex gap-1 items-center"
color="foreground"
href={addTagToSlug(removeFromLast(nextRoute.path || "", "."), tag)}
>
{nextRoute.title}
<ChevronIcon className="rotate-180 text-primary" height={20} width={20} />
</Link>
)}
</div>
);
};
+1 -1
View File
@@ -1,4 +1,4 @@
export * from "./sidebar";
export * from "./toc";
export * from "./footer-nav";
export * from "./pager";
export * from "./components/code-demo";
+61
View File
@@ -0,0 +1,61 @@
"use client";
import * as React from "react";
import {Link} from "@nextui-org/react";
import {useRouter} from "next/navigation";
import {ChevronIcon} from "@nextui-org/shared-icons";
import manifest from "@/config/routes.json";
import {removeFromLast} from "@/utils";
import {Route} from "@/libs/docs/page";
import {useDocsRoute} from "@/hooks/use-docs-route";
import {trackEvent} from "@/utils/va";
export interface FooterNavProps {
currentRoute?: Route;
}
export const DocsPager: React.FC<FooterNavProps> = ({currentRoute}) => {
const router = useRouter();
const {prevRoute, nextRoute} = useDocsRoute(manifest.routes, currentRoute);
const handlePress = (path: string) => {
trackEvent("DocsPager - Click", {
category: "docs",
action: "click",
data: path || "",
});
router.push(removeFromLast(path || "", "."));
};
return (
<div className="flex w-full justify-between py-20">
{prevRoute ? (
<Link
isBlock
className="cursor-pointer flex gap-2"
color="foreground"
onPress={() => handlePress(prevRoute.path || "")}
>
<ChevronIcon className="text-primary" height={20} width={20} />
{prevRoute.title}
</Link>
) : (
<span />
)}
{nextRoute && (
<Link
isBlock
className="cursor-pointer flex gap-1 items-center"
color="foreground"
onPress={() => handlePress(nextRoute.path || "")}
>
{nextRoute.title}
<ChevronIcon className="rotate-180 text-primary" height={20} width={20} />
</Link>
)}
</div>
);
};
+79 -27
View File
@@ -1,3 +1,5 @@
"use client";
import {FC} from "react";
import {ChevronIcon} from "@nextui-org/shared-icons";
import {CollectionBase, Expandable, MultipleSelection, Node, ItemProps} from "@react-types/shared";
@@ -8,15 +10,24 @@ import {TreeState, useTreeState} from "@react-stately/tree";
import {useSelectableCollection} from "@react-aria/selection";
import {usePress} from "@react-aria/interactions";
import {clsx, dataAttr} from "@nextui-org/shared-utils";
import {SpacerProps, Spacer, Link as NextUILink} from "@nextui-org/react";
import {
SpacerProps,
Spacer,
Link as NextUILink,
Chip,
dataFocusVisibleClasses,
} from "@nextui-org/react";
import Link from "next/link";
import {isEmpty} from "lodash";
import {useRouter} from "next/router";
import {usePathname, useRouter} from "next/navigation";
import {ScrollArea} from "../scroll-area";
import {getRoutePaths} from "./utils";
import {Route} from "@/libs/docs/page";
import {TreeKeyboardDelegate} from "@/utils/tree-keyboard-delegate";
import {trackEvent} from "@/utils/va";
export interface Props<T> extends Omit<ItemProps<T>, "title">, Route {
slug?: string;
@@ -49,6 +60,7 @@ function TreeItem<T>(props: TreeItemProps<T>) {
const {key, rendered, childNodes} = item;
const router = useRouter();
const pathname = usePathname();
const paths = item.props.path
? getRoutePaths(item.props.path, item.props?.tag)
@@ -57,8 +69,15 @@ function TreeItem<T>(props: TreeItemProps<T>) {
pathname: "",
};
const isNew = item.props?.newPost;
const isUpdated = item.props?.updated;
const isExpanded = state.expandedKeys.has(key);
const isSelected = state.selectionManager.isSelected(key) || paths.pathname === item.props.slug;
const isSelected =
state.selectionManager.isSelected(key) ||
paths.pathname === item.props.slug ||
paths.pathname === pathname ||
paths.pagePath === pathname;
const ref = useRef<any>(null);
@@ -72,6 +91,12 @@ function TreeItem<T>(props: TreeItemProps<T>) {
state.toggleKey(item.key);
} else {
router.push(paths.pathname);
trackEvent("SidebarDocs", {
category: "docs",
action: "click",
data: paths.pathname || "",
});
}
},
});
@@ -85,14 +110,11 @@ function TreeItem<T>(props: TreeItemProps<T>) {
aria-expanded={dataAttr(hasChildNodes ? isExpanded : undefined)}
aria-selected={dataAttr(isSelected)}
className={clsx(
"flex flex-col gap-3 outline-none",
"flex flex-col gap-3outline-none w-full tap-highlight-transparent",
hasChildNodes ? "mb-4" : "first:mt-4",
// focus ring
"data-[focus-visible=true]:outline-none",
"data-[focus-visible=true]:ring-2",
"data-[focus-visible=true]:ring-primary",
"data-[focus-visible=true]:ring-offset-2",
"data-[focus-visible=true]:ring-offset-background",
"data-[focus-visible=true]:dark:ring-offset-background-dark",
...dataFocusVisibleClasses,
)}
data-focus-visible={isFocusVisible}
data-focused={isFocused}
@@ -113,16 +135,12 @@ function TreeItem<T>(props: TreeItemProps<T>) {
<NextUILink
as={Link}
className={clsx(
"opacity-60",
"dark:font-light",
{
"opacity-100": isSelected,
"pointer-events-none": item.props?.comingSoon,
},
"w-full",
"font-normal",
"before:mr-4",
"before:content-['']",
"before:block",
"before:bg-neutral-300",
"before:bg-default-300",
"before:w-1",
"before:h-1",
"before:rounded-full",
@@ -130,9 +148,42 @@ function TreeItem<T>(props: TreeItemProps<T>) {
color="foreground"
href={paths.pathname}
>
{rendered}
<span
className={clsx(
isSelected
? "text-primary font-medium dark:text-foreground"
: "opacity-80 dark:opacity-60",
{
"pointer-events-none": item.props?.comingSoon,
},
)}
>
{rendered}
</span>
{isUpdated && (
<Chip
className="ml-1 py-1 text-tiny text-default-400 bg-default-100/50"
color="default"
size="sm"
variant="flat"
>
Updated
</Chip>
)}
{isNew && (
<Chip className="ml-1 py-1 text-tiny" color="primary" size="sm" variant="flat">
New
</Chip>
)}
{item.props?.comingSoon && (
<Chip className="ml-1 py-1 text-tiny" color="default" size="sm" variant="flat">
Coming soon
</Chip>
)}
</NextUILink>
)}
{/* Workaround to avoid scrollbar overlapping */}
<Spacer x={4} />
</div>
{isExpanded && hasChildNodes && (
<div className="flex flex-col gap-3 items-start" role="group">
@@ -161,14 +212,14 @@ function TreeHeading({item}: {item: any}) {
function Tree<T extends object>(props: CollectionBase<T> & Expandable & MultipleSelection) {
let state = useTreeState(props);
let ref = useRef<HTMLDivElement>(null);
let keyboardDelegate = useMemo(
// @ts-expect-error
() => new TreeKeyboardDelegate(state.collection, state.disabledKeys),
[state.collection, state.disabledKeys],
);
let ref = useRef(null);
let {collectionProps} = useSelectableCollection({
ref,
selectionManager: state.selectionManager,
@@ -176,11 +227,11 @@ function Tree<T extends object>(props: CollectionBase<T> & Expandable & Multiple
});
return (
<ul
{...collectionProps}
<ScrollArea
ref={ref}
className="flex flex-col gap-4 scrollbar-hide overflow-y-scroll max-h-[calc(100vh_-_64px)] pb-28"
className="h-full lg:max-h-[calc(100vh_-_64px)]"
role="tree"
{...collectionProps}
>
{[...state.collection].map((item) => {
if (item.type === "section") {
@@ -189,7 +240,7 @@ function Tree<T extends object>(props: CollectionBase<T> & Expandable & Multiple
return <TreeItem key={item.key} item={item} state={state} />;
})}
</ul>
</ScrollArea>
);
}
@@ -197,19 +248,20 @@ export interface DocsSidebarProps {
routes?: Route[];
tag?: string;
slug?: string;
className?: string;
}
export const DocsSidebar: FC<DocsSidebarProps> = ({routes, slug, tag}) => {
export const DocsSidebar: FC<DocsSidebarProps> = ({routes, slug, tag, className}) => {
const expandedKeys = routes?.reduce((keys, route) => {
if (route.defaultOpen) {
keys.push(route.key);
keys.push(route.key as string);
}
return keys;
}, [] as string[]);
return (
<div className="sticky top-20 mt-2 z-0 h-[calc(100vh-121px)]">
<div className={clsx("lg:fixed lg:top-20 mt-2 z-0 lg:h-[calc(100vh-121px)]", className)}>
<Tree defaultExpandedKeys={expandedKeys} items={routes || []}>
{(route) => (
<Item
+68 -34
View File
@@ -1,23 +1,31 @@
import {FC} from "react";
"use client";
import {FC, useRef, useEffect} from "react";
import {clsx} from "@nextui-org/shared-utils";
import {Divider, Spacer} from "@nextui-org/react";
import {ChevronCircleTopLinearIcon} from "@nextui-org/shared-icons";
import scrollIntoView from "scroll-into-view-if-needed";
import {Heading} from "@/utils/docs-utils";
import {Heading} from "@/libs/docs/utils";
import {useScrollSpy} from "@/hooks/use-scroll-spy";
import {useScrollPosition} from "@/hooks/use-scroll-position";
export interface DocsTocProps {
headings: Heading[];
}
const paddingLeftByLevel: Record<string, string> = {
const paddingLeftByLevel: Record<number, string> = {
1: "pl-0",
2: "pl-3",
3: "pl-6",
4: "pl-9",
2: "pl-0",
3: "pl-3",
4: "pl-3",
};
export const DocsToc: FC<DocsTocProps> = ({headings}) => {
const tocRef = useRef<HTMLDivElement>(null);
const scrollPosition = useScrollPosition(tocRef);
const activeId = useScrollSpy(
headings.map(({id}) => `[id="${id}"]`),
{
@@ -25,39 +33,65 @@ export const DocsToc: FC<DocsTocProps> = ({headings}) => {
},
);
if (headings.length <= 0) return null;
const activeIndex = headings.findIndex(({id}) => id == activeId);
const firstId = headings[0].id;
useEffect(() => {
if (!activeId || activeIndex < 2) return;
const anchor = tocRef.current?.querySelector(`li > a[href="#${activeId}"]`);
if (anchor) {
scrollIntoView(anchor, {
behavior: "smooth",
block: "center",
inline: "center",
scrollMode: "always",
boundary: tocRef.current,
});
}
}, [activeId, activeIndex]);
return (
<div className="sticky w-full flex flex-col gap-4 text-left top-20 h-[calc(100vh-121px)] overflow-y-scroll scrollbar-hide">
<div
ref={tocRef}
className="fixed w-full max-w-[12rem] flex flex-col gap-4 text-left top-20 pb-20 h-[calc(100vh-121px)] scrollbar-hide overflow-y-scroll"
style={{
WebkitMaskImage: `linear-gradient(to top, transparent 0%, #000 100px, #000 ${
scrollPosition > 30 ? "90%" : "100%"
}, transparent 100%)`,
}}
>
<p className="text-sm">On this page</p>
<ul className="scrollbar-hide flex flex-col gap-2">
{headings.map((heading, i) => (
<li
key={i}
className={clsx(
"flex items-center text-sm font-normal text-foreground/30",
"data-[active=true]:text-foreground/80",
"data-[active=true]:font-medium",
"before:content-['']",
"before:opacity-0",
"data-[active=true]:before:opacity-100",
"before:transition-opacity",
"before:mr-3",
"before:block",
"before:bg-neutral-300",
"before:w-1",
"before:h-1",
"before:rounded-full",
paddingLeftByLevel[heading.level],
)}
data-active={activeId == heading.id}
>
<a href={`#${heading.id}`}>{heading.text}</a>
</li>
))}
{headings.map(
(heading, i) =>
heading.level > 1 && (
<li
key={i}
className={clsx(
"transition-colors",
"font-normal",
"flex items-center text-sm font-normal text-default-500 dark:text-default-300",
"data-[active=true]:text-foreground",
"dark:data-[active=true]:text-foreground",
"before:content-['']",
"before:opacity-0",
"data-[active=true]:before:opacity-100",
"before:transition-opacity",
"before:-ml-3",
"before:absolute",
"before:bg-default-400",
"before:w-1",
"before:h-1",
"before:rounded-full",
paddingLeftByLevel[heading.level],
)}
data-active={activeId == heading.id}
>
<a href={`#${heading.id}`}>{heading.text}</a>
</li>
),
)}
<li
className="mt-2 opacity-0 data-[visible=true]:opacity-100 transition-opacity"
data-visible={activeIndex >= 2}
@@ -65,7 +99,7 @@ export const DocsToc: FC<DocsTocProps> = ({headings}) => {
<Divider />
<Spacer y={2} />
<a
className="flex gap-2 items-center text-sm text-foreground/30 hover:text-foreground/80 pl-4 transition-opacity"
className="flex gap-2 items-center text-sm text-default-500 dark:text-foreground/30 hover:text-foreground/80 pl-4 transition-opacity"
href={`#${firstId}`}
>
Back to top
+25
View File
@@ -0,0 +1,25 @@
"use client";
import {Button, Link} from "@nextui-org/react";
import {trackEvent} from "@/utils/va";
export const FigmaButton = () => (
<Button
isExternal
showAnchorIcon
as={Link}
className="max-w-fit text-current"
color="default"
href="https://www.figma.com/community/file/1267584376234254760"
variant="bordered"
onPress={() => {
trackEvent("FigmaPage - Open Figma Link", {
action: "click",
category: "figma",
});
}}
>
Open in Figma
</Button>
);
+31
View File
@@ -0,0 +1,31 @@
"use client";
import dynamic from "next/dynamic";
import {usePathname} from "next/navigation";
import {siteConfig} from "@/config/site";
const Link = dynamic(() => import("@nextui-org/react").then((mod) => mod.Link));
const VercelCallout = dynamic(() => import("./vercel-callout").then((mod) => mod.VercelCallout));
export const Footer = () => {
const pathname = usePathname();
if (pathname.includes("/examples")) {
return null;
}
return (
<footer className="container mx-auto max-w-7xl pb-12 px-12">
<div className="flex flex-col justify-center items-center gap-1">
<p className="text-sm text-default-400">
Created&nbsp;by&nbsp;
<Link isExternal className="text-sm" href={siteConfig.links.portfolio}>
Junior Garcia
</Link>
</p>
<VercelCallout />
</div>
</footer>
);
};
@@ -0,0 +1,19 @@
import {IconSvgProps} from "@/types";
export const DocumentCodeBoldIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={size || height}
role="presentation"
viewBox="0 0 24 24"
width={size || width}
{...props}
>
<path
d="M16 2H8C4.5 2 3 4 3 7V17C3 20 4.5 22 8 22H16C19.5 22 21 20 21 17V7C21 4 19.5 2 16 2ZM10.53 16.47C10.82 16.76 10.82 17.24 10.53 17.53C10.38 17.68 10.19 17.75 10 17.75C9.81 17.75 9.62 17.68 9.47 17.53L7.47 15.53C7.18 15.24 7.18 14.76 7.47 14.47L9.47 12.47C9.76 12.18 10.24 12.18 10.53 12.47C10.82 12.76 10.82 13.24 10.53 13.53L9.06 15L10.53 16.47ZM16.53 15.53L14.53 17.53C14.38 17.68 14.19 17.75 14 17.75C13.81 17.75 13.62 17.68 13.47 17.53C13.18 17.24 13.18 16.76 13.47 16.47L14.94 15L13.47 13.53C13.18 13.24 13.18 12.76 13.47 12.47C13.76 12.18 14.24 12.18 14.53 12.47L16.53 14.47C16.82 14.76 16.82 15.24 16.53 15.53ZM18.5 9.25H16.5C14.98 9.25 13.75 8.02 13.75 6.5V4.5C13.75 4.09 14.09 3.75 14.5 3.75C14.91 3.75 15.25 4.09 15.25 4.5V6.5C15.25 7.19 15.81 7.75 16.5 7.75H18.5C18.91 7.75 19.25 8.09 19.25 8.5C19.25 8.91 18.91 9.25 18.5 9.25Z"
fill="currentColor"
/>
</svg>
);
+23
View File
@@ -0,0 +1,23 @@
import {IconSvgProps} from "@/types";
export const HashBoldIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={size || height}
role="presentation"
viewBox="0 0 24 24"
width={size || width}
{...props}
>
<path
d="M10.4199 13.4181H13.2599L13.5799 10.5781H10.7399L10.4199 13.4181Z"
fill="currentColor"
/>
<path
d="M16.19 2H7.81C4.17 2 2 4.17 2 7.81V16.18C2 19.83 4.17 22 7.81 22H16.18C19.82 22 21.99 19.83 21.99 16.19V7.81C22 4.17 19.83 2 16.19 2ZM18.82 10.58H15.05L14.73 13.43H18.1C18.5 13.43 18.83 13.76 18.83 14.16C18.83 14.56 18.5 14.89 18.1 14.89H14.57L14.16 18.55C14.12 18.92 13.8 19.2 13.43 19.2C13.4 19.2 13.38 19.2 13.35 19.2C12.95 19.16 12.66 18.79 12.7 18.39L13.09 14.89H10.25L9.84 18.55C9.8 18.92 9.48 19.2 9.11 19.2C9.08 19.2 9.06 19.2 9.03 19.2C8.63 19.16 8.34 18.79 8.38 18.39L8.77 14.89H5.18C4.78 14.89 4.45 14.56 4.45 14.16C4.45 13.76 4.78 13.43 5.18 13.43H8.95L9.27 10.58H5.9C5.5 10.58 5.17 10.25 5.17 9.85C5.17 9.45 5.5 9.12 5.9 9.12H9.43L9.84 5.46C9.88 5.06 10.25 4.77 10.65 4.81C11.05 4.85 11.34 5.22 11.3 5.62L10.91 9.12H13.75L14.16 5.46C14.21 5.06 14.57 4.77 14.97 4.81C15.37 4.85 15.66 5.22 15.62 5.62L15.23 9.12H18.84C19.24 9.12 19.57 9.45 19.57 9.85C19.57 10.25 19.22 10.58 18.82 10.58Z"
fill="currentColor"
/>
</svg>
);
+5
View File
@@ -11,3 +11,8 @@ export * from "./previous";
export * from "./repeat-one";
export * from "./shuffle";
export * from "./info";
export * from "./document-code";
export * from "./hash";
export * from "./more-square";
export * from "./play";
export * from "./pause";
@@ -0,0 +1,19 @@
import {IconSvgProps} from "@/types";
export const MoreSquareBoldIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={size || height}
role="presentation"
viewBox="0 0 24 24"
width={size || width}
{...props}
>
<path
d="M16.19 2H7.81C4.17 2 2 4.17 2 7.81V16.18C2 19.83 4.17 22 7.81 22H16.18C19.82 22 21.99 19.83 21.99 16.19V7.81C22 4.17 19.83 2 16.19 2ZM8 13C7.44 13 7 12.55 7 12C7 11.45 7.45 11 8 11C8.55 11 9 11.45 9 12C9 12.55 8.56 13 8 13ZM12 13C11.44 13 11 12.55 11 12C11 11.45 11.45 11 12 11C12.55 11 13 11.45 13 12C13 12.55 12.56 13 12 13ZM16 13C15.44 13 15 12.55 15 12C15 11.45 15.45 11 16 11C16.55 11 17 11.45 17 12C17 12.55 16.56 13 16 13Z"
fill="currentColor"
/>
</svg>
);
+23
View File
@@ -0,0 +1,23 @@
import {IconSvgProps} from "@/types";
export const PauseBoldIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={size || height}
role="presentation"
viewBox="0 0 24 24"
width={size || width}
{...props}
>
<path
d="M10.65 19.11V4.89C10.65 3.54 10.08 3 8.64 3H5.01C3.57 3 3 3.54 3 4.89V19.11C3 20.46 3.57 21 5.01 21H8.64C10.08 21 10.65 20.46 10.65 19.11Z"
fill="currentColor"
/>
<path
d="M21 19.11V4.89C21 3.54 20.43 3 18.99 3H15.36C13.93 3 13.35 3.54 13.35 4.89V19.11C13.35 20.46 13.92 21 15.36 21H18.99C20.43 21 21 20.46 21 19.11Z"
fill="currentColor"
/>
</svg>
);
+19
View File
@@ -0,0 +1,19 @@
import {IconSvgProps} from "@/types";
export const PlayBoldIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={size || height}
role="presentation"
viewBox="0 0 24 24"
width={size || width}
{...props}
>
<path
d="M4 11.9999V8.43989C4 4.01989 7.13 2.2099 10.96 4.4199L14.05 6.1999L17.14 7.9799C20.97 10.1899 20.97 13.8099 17.14 16.0199L14.05 17.7999L10.96 19.5799C7.13 21.7899 4 19.9799 4 15.5599V11.9999Z"
fill="currentColor"
/>
</svg>
);
@@ -0,0 +1,23 @@
import {IconSvgProps} from "@/types";
export const ChevronRightLinearIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={height || size}
role="presentation"
viewBox="0 0 24 24"
width={width || size}
{...props}
>
<path
d="M8.91003 19.9201L15.43 13.4001C16.2 12.6301 16.2 11.3701 15.43 10.6001L8.91003 4.08008"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit="10"
strokeWidth="1.5"
/>
</svg>
);
@@ -0,0 +1,43 @@
import {IconSvgProps} from "@/types";
export const HashLinearIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={height || size}
role="presentation"
viewBox="0 0 24 24"
width={width || size}
{...props}
>
<path
d="M10 3L8 21"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M16 3L14 21"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M3.5 9H21.5"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M2.5 15H20.5"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
</svg>
);
@@ -15,3 +15,8 @@ export * from "./paperclip";
export * from "./link-squared";
export * from "./link";
export * from "./rotate-right";
export * from "./hash";
export * from "./chevron-right";
export * from "./search";
export * from "./simple-grid";
export * from "./rotate-left";
@@ -0,0 +1,36 @@
import {IconSvgProps} from "@/types";
export const RotateLeftLinearIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={size || height}
role="presentation"
viewBox="0 0 24 24"
width={size || width}
{...props}
>
<path
d="M9.11008 5.0799C9.98008 4.8199 10.9401 4.6499 12.0001 4.6499C16.7901 4.6499 20.6701 8.5299 20.6701 13.3199C20.6701 18.1099 16.7901 21.9899 12.0001 21.9899C7.21008 21.9899 3.33008 18.1099 3.33008 13.3199C3.33008 11.5399 3.87008 9.8799 4.79008 8.4999"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M7.87012 5.32L10.7601 2"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M7.87012 5.32007L11.2401 7.78007"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
</svg>
);
@@ -0,0 +1,35 @@
import {IconSvgProps} from "@/types";
export const SearchLinearIcon = ({
size = 24,
strokeWidth = 1.5,
width,
height,
...props
}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={height || size}
role="presentation"
viewBox="0 0 24 24"
width={width || size}
{...props}
>
<path
d="M11.5 21C16.7467 21 21 16.7467 21 11.5C21 6.25329 16.7467 2 11.5 2C6.25329 2 2 6.25329 2 11.5C2 16.7467 6.25329 21 11.5 21Z"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={strokeWidth}
/>
<path
d="M22 22L20 20"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={strokeWidth}
/>
</svg>
);
@@ -0,0 +1,29 @@
import {IconSvgProps} from "@/types";
export const SimpleGridIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={size || height}
role="presentation"
viewBox="0 0 24 24"
width={size || width}
{...props}
>
<path
d="M9 22H15C20 22 22 20 22 15V9C22 4 20 2 15 2H9C4 2 2 4 2 9V15C2 20 4 22 9 22Z"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M9 2V22"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
</svg>
);
@@ -0,0 +1,19 @@
import {IconSvgProps} from "@/types";
export const VerticalDotsIcon = ({size = 24, width, height, ...props}: IconSvgProps) => (
<svg
aria-hidden="true"
fill="none"
focusable="false"
height={size || height}
role="presentation"
viewBox="0 0 24 24"
width={size || width}
{...props}
>
<path
d="M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 12c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
fill="currentColor"
/>
</svg>
);
+19 -9
View File
@@ -1,3 +1,5 @@
"use client";
/* eslint-disable react/display-name */
import {
Button,
@@ -19,12 +21,13 @@ import {
DeleteDocumentBulkIcon,
} from "@nextui-org/shared-icons";
import Link from "next/link";
import dynamic from "next/dynamic";
import {useEffect, useRef, useState} from "react";
import {FeaturesGrid} from "./features-grid";
import landingContent from "@/content/landing";
import {GradientBox, DemoCodeModal} from "@/components";
import {GradientBox} from "@/components";
import {
KeyboardBoldIcon,
MouseCircleBoldIcon,
@@ -37,6 +40,10 @@ import {
import {title, subtitle, titleWrapper, sectionWrapper} from "@/components/primitives";
import {useIsMobile} from "@/hooks/use-media-query";
const DemoCodeModal = dynamic(() => import("../demo-code-modal").then((mod) => mod.DemoCodeModal), {
ssr: false,
});
const a11yItems = [
{
title: "Keyboard navigation",
@@ -64,7 +71,7 @@ const a11yItems = [
},
];
const iconClasses = "text-2xl text-neutral-500 pointer-events-none flex-shrink-0";
const iconClasses = "text-2xl text-default-500 pointer-events-none flex-shrink-0";
export const A11yOtb = () => {
const [isModalOpen, setIsModalOpen] = useState(false);
@@ -97,7 +104,7 @@ export const A11yOtb = () => {
NextUI components are built on top of&nbsp;
<NextUILink
isExternal
className="text-xl text-neutral-500 font-light [&>svg]:ml-1"
className="text-xl text-default-500 font-light [&>svg]:ml-1"
href="https://react-spectrum.adobe.com/react-aria/"
underline="always"
>
@@ -112,15 +119,17 @@ export const A11yOtb = () => {
classNames={{
base: "grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-4",
header: "pb-3",
iconWrapper: "bg-neutral-100 dark:bg-transparent text-neutral-500/50",
card: "bg-white dark:bg-default-400/10",
iconWrapper: "bg-default-100 dark:bg-transparent text-default-500/50",
}}
features={a11yItems}
/>
<Button
aria-label="Learn more about accessibility"
as={Link}
className="max-w-fit"
color="success"
href="/docs/theme/customize-theme"
href="/docs/customization/customize-theme"
radius="full"
size="sm"
variant="flat"
@@ -137,6 +146,7 @@ export const A11yOtb = () => {
<Tooltip className="text-xs px-2" content="Show code" placement="top">
<Button
isIconOnly
aria-label="Show code"
className="absolute top-1 right-1 text-success-50 data-[hover]:bg-foreground/10"
radius="full"
variant="light"
@@ -152,22 +162,22 @@ export const A11yOtb = () => {
isOpen={isDropdownOpen}
placement="bottom"
portalContainer={ref.current}
shouldBlockScroll={isMobile}
shouldBlockScroll={false}
shouldFlip={isMobile}
onOpenChange={(open) => setIsDropdownOpen(open)}
>
<DropdownTrigger>
<Button color="success" variant="flat">
<Button className="bg-success-50" color="success" variant="flat">
{isMobile ? "Click me" : "Actions"}
</Button>
</DropdownTrigger>
<DropdownMenu
aria-label="Actions"
closeOnSelect={true}
color="neutral"
color="default"
variant="flat"
>
<DropdownSection title="Actions">
<DropdownSection showDivider title="Actions">
<DropdownItem
key="new"
description="Create a new file"
+1 -1
View File
@@ -2,7 +2,7 @@ import {Spacer} from "@nextui-org/react";
import {sectionWrapper, titleWrapper, title, subtitle} from "../primitives";
import {FeaturesGrid} from "@/components/marketing";
import {FeaturesGrid} from "@/components/marketing/features-grid";
import {communityAccounts} from "@/libs/constants";
export const Community = () => {

Some files were not shown because too many files have changed in this diff Show More