Skip to content

Commit

Permalink
Merge branch 'with-fragment'
Browse files Browse the repository at this point in the history
  • Loading branch information
sapkra committed Mar 27, 2024
2 parents 9badc38 + 5dad429 commit fd2e254
Show file tree
Hide file tree
Showing 50 changed files with 396 additions and 50 deletions.
8 changes: 8 additions & 0 deletions src/components/base/Accordion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
Accordion as NextAccordion,
AccordionItem as NextAccordionItem,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Accordion = withFragment(NextAccordion, 'accordion');
export const AccordionItem = withFragment(NextAccordionItem, 'accordionItem');
10 changes: 10 additions & 0 deletions src/components/base/Autocomplete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {
Autocomplete as NextAutocomplete,
AutocompleteItem as NextAutocompleteItem,
AutocompleteSection as NextAutocompleteSection,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Autocomplete = withFragment(NextAutocomplete, 'autocomplete');
export const AutocompleteItem = withFragment(NextAutocompleteItem, 'autocompleteItem');
export const AutocompleteSection = withFragment(NextAutocompleteSection, 'autocompleteSection');
8 changes: 8 additions & 0 deletions src/components/base/Avatar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
Avatar as NextAvatar,
AvatarGroup as NextAvatarGroup,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Avatar = withFragment(NextAvatar, 'avatar');
export const AvatarGroup = withFragment(NextAvatarGroup, 'avatarGroup');
4 changes: 4 additions & 0 deletions src/components/base/Badge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Badge as NextBadge } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Badge = withFragment(NextBadge, 'badge');
8 changes: 8 additions & 0 deletions src/components/base/Breadcrumbs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
Breadcrumbs as NextBreadcrumbs,
BreadcrumbItem as NextBreadcrumbItem,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Breadcrumbs = withFragment(NextBreadcrumbs, 'breadcrumbs');
export const BreadcrumbItem = withFragment(NextBreadcrumbItem, 'breadcrumbItem');
4 changes: 4 additions & 0 deletions src/components/base/Button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Button as NextButton } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Button = withFragment(NextButton, 'button');
5 changes: 5 additions & 0 deletions src/components/base/Card.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Card as NextCard } from '@nextui-org/react';
import { withFragment } from '../../withFragment';

export const Card = withFragment(NextCard, 'card');
export { CardBody, CardFooter, CardHeader } from '@nextui-org/react';
8 changes: 8 additions & 0 deletions src/components/base/Checkbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
Checkbox as NextCheckbox,
Checkbox as NextCheckboxGroup,
} from '@nextui-org/react';
import { withFragment } from '../../withFragment';

export const Checkbox = withFragment(NextCheckbox, 'checkbox');
export const CheckboxGroup = withFragment(NextCheckboxGroup, 'checkboxGroup');
4 changes: 4 additions & 0 deletions src/components/base/Chip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Chip as NextChip } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Chip = withFragment(NextChip, 'chip');
4 changes: 4 additions & 0 deletions src/components/base/CircularProgress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { CircularProgress as NextCircularProgress } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const CircularProgress = withFragment(NextCircularProgress, 'circularProgress');
4 changes: 4 additions & 0 deletions src/components/base/Code.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Code as NextCode } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Code = withFragment(NextCode, 'code');
4 changes: 4 additions & 0 deletions src/components/base/Divider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Divider as NextDivider } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Divider = withFragment(NextDivider, 'divider');
14 changes: 14 additions & 0 deletions src/components/base/Dropdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
Dropdown as NextDropdown,
DropdownItem as NextDropdownItem,
DropdownMenu as NextDropdownMenu,
DropdownSection as NextDropdownSection,
DropdownTrigger as NextDropdownTrigger,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Dropdown = withFragment(NextDropdown, 'dropdown');
export const DropdownItem = withFragment(NextDropdownItem, 'dropdownItem');
export const DropdownMenu = withFragment(NextDropdownMenu, 'dropdownMenu');
export const DropdownSection = withFragment(NextDropdownSection, 'dropdownSection');
export const DropdownTrigger = withFragment(NextDropdownTrigger, 'dropdownTrigger');
4 changes: 4 additions & 0 deletions src/components/base/Image.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Image as NextImage } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Image = withFragment(NextImage, 'image');
4 changes: 4 additions & 0 deletions src/components/base/Input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Input as NextInput } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Input = withFragment(NextInput, 'input');
4 changes: 4 additions & 0 deletions src/components/base/Kbd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Kbd as NextKbd } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Kbd = withFragment(NextKbd, 'kbd');
4 changes: 4 additions & 0 deletions src/components/base/Link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Link as NextLink } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Link = withFragment(NextLink, 'link');
10 changes: 10 additions & 0 deletions src/components/base/Listbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {
Listbox as NextListbox,
ListboxItem as NextListboxItem,
ListboxSection as NextListboxSection,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Listbox = withFragment(NextListbox, 'listbox');
export const ListboxItem = withFragment(NextListboxItem, 'listboxItem');
export const ListboxSection = withFragment(NextListboxSection, 'listboxSection');
14 changes: 14 additions & 0 deletions src/components/base/Modal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
Modal as NextModal,
ModalBody as NextModalBody,
ModalContent as NextModalContent,
ModalFooter as NextModalFooter,
ModalHeader as NextModalHeader,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Modal = withFragment(NextModal, 'modal');
export const ModalBody = withFragment(NextModalBody, 'modalBody');
export const ModalContent = withFragment(NextModalContent, 'modalContent');
export const ModalFooter = withFragment(NextModalFooter, 'modalFooter');
export const ModalHeader = withFragment(NextModalHeader, 'modalHeader');
18 changes: 18 additions & 0 deletions src/components/base/Navbar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {
Navbar as NextNavbar,
NavbarBrand as NextNavbarBrand,
NavbarContent as NextNavbarContent,
NavbarItem as NextNavbarItem,
NavbarMenu as NextNavbarMenu,
NavbarMenuItem as NextNavbarMenuItem,
NavbarMenuToggle as NextNavbarMenuToggle,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Navbar = withFragment(NextNavbar, 'navbar');
export const NavbarBrand = withFragment(NextNavbarBrand, 'navbarBrand');
export const NavbarContent = withFragment(NextNavbarContent, 'navbarContent');
export const NavbarItem = withFragment(NextNavbarItem, 'navbarItem');
export const NavbarMenu = withFragment(NextNavbarMenu, 'navbarMenu');
export const NavbarMenuItem = withFragment(NextNavbarMenuItem, 'navbarMenuItem');
export const NavbarMenuToggle = withFragment(NextNavbarMenuToggle, 'navbarMenuToggle');
10 changes: 10 additions & 0 deletions src/components/base/Pagination.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {
Pagination as NextPagination,
PaginationItem as NextPaginationItem,
PaginationCursor as NextPaginationCursor,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Pagination = withFragment(NextPagination, 'pagination');
export const PaginationItem = withFragment(NextPaginationItem, 'paginationItem');
export const PaginationCursor = withFragment(NextPaginationCursor, 'paginationCursor');
10 changes: 10 additions & 0 deletions src/components/base/Popover.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {
Popover as NextPopover,
PopoverContent as NextPopoverContent,
PopoverTrigger as NextPopoverTrigger,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Popover = withFragment(NextPopover, 'popover');
export const PopoverContent = withFragment(NextPopoverContent, 'popoverContent');
export const PopoverTrigger = withFragment(NextPopoverTrigger, 'popoverTrigger');
4 changes: 4 additions & 0 deletions src/components/base/Progress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Progress as NextProgress } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Progress = withFragment(NextProgress, 'progress');
8 changes: 8 additions & 0 deletions src/components/base/Radio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
Radio as NextRadio,
RadioGroup as NextRadioGroup,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Radio = withFragment(NextRadio, 'radio');
export const RadioGroup = withFragment(NextRadioGroup, 'radioGroup');
4 changes: 4 additions & 0 deletions src/components/base/ScrollShadow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { ScrollShadow as NextScrollShadow } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const ScrollShadow = withFragment(NextScrollShadow, 'scrollShadow');
10 changes: 10 additions & 0 deletions src/components/base/Select.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {
Select as NextSelect,
SelectItem as NextSelectItem,
SelectSection as NextSelectSection,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Select = withFragment(NextSelect, 'select');
export const SelectItem = withFragment(NextSelectItem, 'selectItem');
export const SelectSection = withFragment(NextSelectSection, 'selectSection');
4 changes: 4 additions & 0 deletions src/components/base/Skeleton.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Skeleton as NextSkeleton } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Skeleton = withFragment(NextSkeleton, 'skeleton');
4 changes: 4 additions & 0 deletions src/components/base/Slider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Slider as NextSlider } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Slider = withFragment(NextSlider, 'slider');
4 changes: 4 additions & 0 deletions src/components/base/Snippet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Snippet as NextSnippet } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Snippet = withFragment(NextSnippet, 'snippet');
4 changes: 4 additions & 0 deletions src/components/base/Spacer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Spacer as NextSpacer } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Spacer = withFragment(NextSpacer, 'spacer');
4 changes: 4 additions & 0 deletions src/components/base/Spinner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Spinner as NextSpinner } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Spinner = withFragment(NextSpinner, 'spinner');
4 changes: 4 additions & 0 deletions src/components/base/Switch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Switch as NextSwitch } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Switch = withFragment(NextSwitch, 'switch');
8 changes: 8 additions & 0 deletions src/components/base/Tab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
Tab as NextTab,
Tabs as NextTabs,
} from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Tab = withFragment(NextTab, 'tab');
export const Tabs = withFragment(NextTabs, 'tabs');
File renamed without changes.
4 changes: 4 additions & 0 deletions src/components/base/Textarea.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Textarea as NextTextarea } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Textarea = withFragment(NextTextarea, 'textArea');
4 changes: 4 additions & 0 deletions src/components/base/Tooltip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Tooltip as NextTooltip } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const Tooltip = withFragment(NextTooltip, 'tooltip');
4 changes: 4 additions & 0 deletions src/components/base/User.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { User as NextUser } from '@nextui-org/react'
import { withFragment } from '../../withFragment'

export const User = withFragment(NextUser, 'user');
37 changes: 37 additions & 0 deletions src/components/base/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export * from './Accordion'
export * from './Autocomplete'
export * from './Avatar'
export * from './Badge'
export * from './Breadcrumbs'
export * from './Button'
export * from './Card'
export * from './Checkbox'
export * from './Chip'
export * from './CircularProgress'
export * from './Code'
export * from './Divider'
export * from './Dropdown'
export * from './Image'
export * from './Input'
export * from './Kbd'
export * from './Link'
export * from './Listbox'
export * from './Modal'
export * from './Navbar'
export * from './Pagination'
export * from './Popover'
export * from './Progress'
export * from './Radio'
export * from './ScrollShadow'
export * from './Select'
export * from './Skeleton'
export * from './Slider'
export * from './Snippet'
export * from './Spacer'
export * from './Spinner'
export * from './Switch'
export * from './Tab'
export * from './Table'
export * from './Textarea'
export * from './Tooltip'
export * from './User'
12 changes: 6 additions & 6 deletions src/components/color-input/ColorInput.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use client';

import { Avatar, Input, InputProps } from '@nextui-org/react';
import type { InputProps } from '@nextui-org/react';
import { useEffect, useMemo, useState } from 'react';
import { Avatar, Input } from '../base';
import { withFragment } from '../../withFragment';

/**
* Primary UI component for selecting a color
*/

interface ColorInputProps extends InputProps {}
export interface ColorInputProps extends InputProps {}

export const ColorInput: React.FC<ColorInputProps> = ({
export const ColorInput: React.FC<ColorInputProps> = withFragment(({
defaultValue,
label = 'Color',
errorMessage = "Please enter a valid color in hex format e.g. #f3f or #ff33ff",
Expand Down Expand Up @@ -50,4 +50,4 @@ export const ColorInput: React.FC<ColorInputProps> = ({
)}
/>
);
};
}, 'colorInput');
12 changes: 6 additions & 6 deletions src/components/color-selector/ColorSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use client';

import { Avatar, AvatarProps } from '@nextui-org/react';
import type { AvatarProps } from '@nextui-org/react';
import { useEffect, useState } from 'react';
import { Avatar } from '../base';
import { withFragment } from '../../withFragment';

/**
* Primary UI component for selecting a color
*/

interface ColorSelectorProps {
export interface ColorSelectorProps {
values: string[];
defaultValue?: string;
onValueChange: (color: string) => void;
Expand All @@ -16,7 +16,7 @@ interface ColorSelectorProps {
icon?: React.ReactNode;
}

export const ColorSelector: React.FC<ColorSelectorProps> = ({ values, defaultValue, onValueChange, icon, ...rest }) => {
export const ColorSelector: React.FC<ColorSelectorProps> = withFragment(({ values, defaultValue, onValueChange, icon, ...rest }) => {
const [value, setValue] = useState(defaultValue && values.includes(defaultValue) ? defaultValue : values[0]);

useEffect(() => onValueChange(value), [value, onValueChange]);
Expand All @@ -37,4 +37,4 @@ export const ColorSelector: React.FC<ColorSelectorProps> = ({ values, defaultVal
))}
</div>
);
};
}, 'colorSelector');
3 changes: 3 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './base';
export * from './color-input/ColorInput';
export * from './color-selector/ColorSelector';
Loading

0 comments on commit fd2e254

Please sign in to comment.