@chassis-ui/react 0.0.0-20260831090525
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/index.d.ts +5909 -0
- package/dist/index.js +2 -0
- package/dist/style.css +1 -0
- package/package.json +114 -0
- package/src/components/accordion/Accordion.tsx +190 -0
- package/src/components/accordion/AccordionBody.tsx +46 -0
- package/src/components/accordion/AccordionHeader.tsx +21 -0
- package/src/components/accordion/AccordionItem.tsx +59 -0
- package/src/components/accordion/context.ts +8 -0
- package/src/components/accordion/index.ts +8 -0
- package/src/components/autocomplete/Autocomplete.tsx +464 -0
- package/src/components/autocomplete/AutocompleteGroup.tsx +20 -0
- package/src/components/autocomplete/AutocompleteItem.tsx +18 -0
- package/src/components/autocomplete/index.ts +6 -0
- package/src/components/avatar/Avatar.tsx +134 -0
- package/src/components/avatar/AvatarImage.tsx +19 -0
- package/src/components/avatar/AvatarStack.tsx +98 -0
- package/src/components/avatar/index.ts +6 -0
- package/src/components/badge/Badge.tsx +94 -0
- package/src/components/badge/index.ts +2 -0
- package/src/components/breadcrumb/Breadcrumb.tsx +59 -0
- package/src/components/breadcrumb/BreadcrumbItem.tsx +38 -0
- package/src/components/breadcrumb/index.ts +4 -0
- package/src/components/button/Button.tsx +229 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/button-group/ButtonGroup.tsx +55 -0
- package/src/components/button-group/ButtonToolbar.tsx +47 -0
- package/src/components/button-group/index.ts +4 -0
- package/src/components/calendar/Calendar.scss +57 -0
- package/src/components/calendar/Calendar.tsx +324 -0
- package/src/components/calendar/CalendarMonthBlock.tsx +57 -0
- package/src/components/calendar/CalendarMonthGrid.tsx +92 -0
- package/src/components/calendar/CalendarMonthYearPicker.tsx +162 -0
- package/src/components/calendar/CalendarNavButton.tsx +24 -0
- package/src/components/calendar/CalendarWeekGrid.tsx +58 -0
- package/src/components/calendar/CalendarYearGrid.tsx +126 -0
- package/src/components/calendar/RangeCalendar.scss +95 -0
- package/src/components/calendar/RangeCalendar.tsx +361 -0
- package/src/components/calendar/index.ts +5 -0
- package/src/components/card/Card.tsx +173 -0
- package/src/components/card/CardBody.tsx +75 -0
- package/src/components/card/CardFooter.tsx +47 -0
- package/src/components/card/CardGroup.tsx +51 -0
- package/src/components/card/CardHeader.tsx +47 -0
- package/src/components/card/CardImage.tsx +70 -0
- package/src/components/card/CardImageOverlay.tsx +47 -0
- package/src/components/card/CardLink.tsx +40 -0
- package/src/components/card/CardSubtitle.tsx +47 -0
- package/src/components/card/CardText.tsx +47 -0
- package/src/components/card/CardTitle.tsx +47 -0
- package/src/components/card/index.ts +22 -0
- package/src/components/carousel/Carousel.tsx +742 -0
- package/src/components/carousel/CarouselControlButton.tsx +74 -0
- package/src/components/carousel/CarouselControlNext.tsx +22 -0
- package/src/components/carousel/CarouselControlPrev.tsx +22 -0
- package/src/components/carousel/CarouselIndicators.tsx +44 -0
- package/src/components/carousel/CarouselInner.tsx +56 -0
- package/src/components/carousel/CarouselItem.tsx +51 -0
- package/src/components/carousel/CarouselOverlay.tsx +51 -0
- package/src/components/carousel/CarouselPlayPause.tsx +61 -0
- package/src/components/carousel/carouselEngine.ts +170 -0
- package/src/components/carousel/context.ts +29 -0
- package/src/components/carousel/index.ts +21 -0
- package/src/components/checkbox/Checkbox.tsx +236 -0
- package/src/components/checkbox/CheckboxGroup.tsx +145 -0
- package/src/components/checkbox/context.ts +14 -0
- package/src/components/checkbox/index.ts +4 -0
- package/src/components/chip/Chip.tsx +183 -0
- package/src/components/chip/index.ts +2 -0
- package/src/components/chip-input/ChipInput.tsx +363 -0
- package/src/components/chip-input/ChipList.tsx +95 -0
- package/src/components/chip-input/index.ts +2 -0
- package/src/components/close-button/CloseButton.tsx +205 -0
- package/src/components/close-button/index.ts +2 -0
- package/src/components/collapse/Collapse.tsx +128 -0
- package/src/components/collapse/index.ts +2 -0
- package/src/components/color-input/ColorInput.tsx +106 -0
- package/src/components/color-input/index.ts +2 -0
- package/src/components/combobox/Combobox.tsx +320 -0
- package/src/components/combobox/ComboboxGroup.tsx +27 -0
- package/src/components/combobox/ComboboxItem.tsx +44 -0
- package/src/components/combobox/ComboboxListBox.tsx +98 -0
- package/src/components/combobox/index.ts +6 -0
- package/src/components/datepicker/CalendarToggleButton.tsx +58 -0
- package/src/components/datepicker/ClearButton.tsx +35 -0
- package/src/components/datepicker/DateField.tsx +54 -0
- package/src/components/datepicker/DatePicker.scss +51 -0
- package/src/components/datepicker/DatePicker.tsx +574 -0
- package/src/components/datepicker/DateRangePicker.scss +11 -0
- package/src/components/datepicker/DateRangePicker.tsx +343 -0
- package/src/components/datepicker/index.ts +4 -0
- package/src/components/datepicker/renderDatePickerShell.tsx +104 -0
- package/src/components/drawer/Drawer.tsx +211 -0
- package/src/components/drawer/DrawerBody.tsx +47 -0
- package/src/components/drawer/DrawerFooter.tsx +51 -0
- package/src/components/drawer/DrawerHeader.tsx +60 -0
- package/src/components/drawer/DrawerTitle.tsx +49 -0
- package/src/components/drawer/index.ts +10 -0
- package/src/components/file-input/FileInput.tsx +100 -0
- package/src/components/file-input/index.ts +2 -0
- package/src/components/flex/Flex.tsx +134 -0
- package/src/components/flex/index.ts +2 -0
- package/src/components/floating-input/FloatingInput.tsx +94 -0
- package/src/components/floating-input/index.ts +2 -0
- package/src/components/form/Form.tsx +26 -0
- package/src/components/form/FormFeedback.tsx +64 -0
- package/src/components/form/FormHelp.tsx +46 -0
- package/src/components/form/FormLabel.tsx +26 -0
- package/src/components/form/index.ts +8 -0
- package/src/components/form/renderFormCheck.tsx +86 -0
- package/src/components/form-field/FormField.tsx +84 -0
- package/src/components/form-field/index.ts +2 -0
- package/src/components/form-field/renderFormField.tsx +74 -0
- package/src/components/grid/Col.tsx +69 -0
- package/src/components/grid/Container.tsx +59 -0
- package/src/components/grid/Grid.tsx +86 -0
- package/src/components/grid/GridItem.tsx +123 -0
- package/src/components/grid/Row.tsx +71 -0
- package/src/components/grid/gap.ts +8 -0
- package/src/components/grid/index.ts +10 -0
- package/src/components/icon/Icon.tsx +74 -0
- package/src/components/icon/index.ts +2 -0
- package/src/components/input-adorn/InputAdorn.tsx +55 -0
- package/src/components/input-adorn/index.ts +2 -0
- package/src/components/input-group/InputGroup.tsx +50 -0
- package/src/components/input-group/InputGroupAddon.tsx +50 -0
- package/src/components/input-group/index.ts +4 -0
- package/src/components/link/Link.tsx +148 -0
- package/src/components/link/index.ts +2 -0
- package/src/components/list/List.tsx +193 -0
- package/src/components/list/ListItem.tsx +91 -0
- package/src/components/list/index.ts +4 -0
- package/src/components/menu/Menu.tsx +398 -0
- package/src/components/menu/MenuDivider.tsx +19 -0
- package/src/components/menu/MenuHeader.tsx +55 -0
- package/src/components/menu/MenuItem.tsx +85 -0
- package/src/components/menu/MenuItemDef.ts +83 -0
- package/src/components/menu/MenuList.tsx +142 -0
- package/src/components/menu/MenuSubmenu.tsx +284 -0
- package/src/components/menu/MenuSubmenuBack.tsx +39 -0
- package/src/components/menu/MenuText.tsx +47 -0
- package/src/components/menu/MenuToggle.tsx +148 -0
- package/src/components/menu/index.ts +19 -0
- package/src/components/menu/menuNavigation.ts +106 -0
- package/src/components/menu/submenuGroup.ts +43 -0
- package/src/components/modal/Modal.tsx +162 -0
- package/src/components/modal/ModalBody.tsx +47 -0
- package/src/components/modal/ModalFooter.tsx +51 -0
- package/src/components/modal/ModalHeader.tsx +60 -0
- package/src/components/modal/ModalTitle.tsx +49 -0
- package/src/components/modal/index.ts +10 -0
- package/src/components/nav/Nav.tsx +97 -0
- package/src/components/nav/NavItem.tsx +42 -0
- package/src/components/nav/NavLink.tsx +48 -0
- package/src/components/nav/NavTitle.tsx +22 -0
- package/src/components/nav/index.ts +7 -0
- package/src/components/navbar/Navbar.tsx +112 -0
- package/src/components/navbar/NavbarBrand.tsx +55 -0
- package/src/components/navbar/NavbarNav.tsx +47 -0
- package/src/components/navbar/NavbarText.tsx +47 -0
- package/src/components/navbar/NavbarToggler.tsx +34 -0
- package/src/components/navbar/index.ts +10 -0
- package/src/components/notification/Notification.scss +15 -0
- package/src/components/notification/Notification.tsx +187 -0
- package/src/components/notification/NotificationIcon.tsx +21 -0
- package/src/components/notification/NotificationStack.tsx +66 -0
- package/src/components/notification/NotificationText.tsx +47 -0
- package/src/components/notification/NotificationTitle.tsx +47 -0
- package/src/components/notification/context.ts +14 -0
- package/src/components/notification/index.ts +17 -0
- package/src/components/notification/notificationQueue.ts +48 -0
- package/src/components/otp-input/OtpBox.tsx +68 -0
- package/src/components/otp-input/OtpInput.tsx +341 -0
- package/src/components/otp-input/index.ts +2 -0
- package/src/components/pagination/Pagination.tsx +199 -0
- package/src/components/pagination/PaginationItem.tsx +133 -0
- package/src/components/pagination/index.ts +4 -0
- package/src/components/password-strength/PasswordStrength.tsx +155 -0
- package/src/components/password-strength/index.ts +2 -0
- package/src/components/password-strength/strengthScore.ts +79 -0
- package/src/components/placeholder/Placeholder.tsx +178 -0
- package/src/components/placeholder/index.ts +2 -0
- package/src/components/popover/Popover.tsx +243 -0
- package/src/components/popover/index.ts +2 -0
- package/src/components/progress/Progress.tsx +154 -0
- package/src/components/progress/ProgressBar.tsx +88 -0
- package/src/components/progress/index.ts +4 -0
- package/src/components/radio/Radio.tsx +88 -0
- package/src/components/radio/RadioGroup.tsx +142 -0
- package/src/components/radio/context.ts +14 -0
- package/src/components/radio/index.ts +4 -0
- package/src/components/range-input/RangeInput.tsx +109 -0
- package/src/components/range-input/index.ts +2 -0
- package/src/components/select/Select.tsx +277 -0
- package/src/components/select/index.ts +2 -0
- package/src/components/skeleton/Skeleton.tsx +89 -0
- package/src/components/skeleton/SkeletonLoader.tsx +91 -0
- package/src/components/skeleton/index.ts +4 -0
- package/src/components/spinner/Spinner.tsx +77 -0
- package/src/components/spinner/index.ts +2 -0
- package/src/components/stack/Stack.tsx +81 -0
- package/src/components/stack/index.ts +2 -0
- package/src/components/stepper/Stepper.tsx +172 -0
- package/src/components/stepper/StepperItem.tsx +66 -0
- package/src/components/stepper/index.ts +4 -0
- package/src/components/switch/Switch.tsx +246 -0
- package/src/components/switch/index.ts +2 -0
- package/src/components/table/Table.css +39 -0
- package/src/components/table/Table.tsx +390 -0
- package/src/components/table/TableBody.tsx +25 -0
- package/src/components/table/TableCell.tsx +27 -0
- package/src/components/table/TableColumn.tsx +31 -0
- package/src/components/table/TableHeader.tsx +26 -0
- package/src/components/table/TableRow.tsx +24 -0
- package/src/components/table/index.ts +12 -0
- package/src/components/tabs/Tab.tsx +36 -0
- package/src/components/tabs/TabList.tsx +76 -0
- package/src/components/tabs/TabPanel.tsx +68 -0
- package/src/components/tabs/Tabs.tsx +136 -0
- package/src/components/tabs/context.ts +24 -0
- package/src/components/tabs/index.ts +8 -0
- package/src/components/text-input/TextInput.tsx +188 -0
- package/src/components/text-input/index.ts +2 -0
- package/src/components/textarea/Textarea.tsx +145 -0
- package/src/components/textarea/index.ts +2 -0
- package/src/components/toast/Toast.tsx +219 -0
- package/src/components/toast/ToastBody.tsx +64 -0
- package/src/components/toast/ToastFooter.tsx +47 -0
- package/src/components/toast/ToastHeader.tsx +104 -0
- package/src/components/toast/ToastIcon.tsx +21 -0
- package/src/components/toast/Toaster.tsx +87 -0
- package/src/components/toast/context.ts +14 -0
- package/src/components/toast/index.ts +18 -0
- package/src/components/toast/toastQueue.ts +56 -0
- package/src/components/tooltip/Tooltip.tsx +155 -0
- package/src/components/tooltip/index.ts +2 -0
- package/src/global.d.ts +2 -0
- package/src/hooks/index.ts +57 -0
- package/src/hooks/useAutoDismiss.ts +88 -0
- package/src/hooks/useButtonSemantics.ts +33 -0
- package/src/hooks/useControllableState.ts +24 -0
- package/src/hooks/useDialogElement.ts +216 -0
- package/src/hooks/useDisabledAnchorGuard.ts +22 -0
- package/src/hooks/useDismissibleTransition.ts +126 -0
- package/src/hooks/useDrawer.ts +9 -0
- package/src/hooks/useFloatingOverlay.ts +115 -0
- package/src/hooks/useForkedRef.ts +50 -0
- package/src/hooks/useFormField.ts +89 -0
- package/src/hooks/useIsomorphicLayoutEffect.ts +9 -0
- package/src/hooks/useModal.ts +9 -0
- package/src/hooks/useNotification.ts +10 -0
- package/src/hooks/useOverlayPlacement.ts +93 -0
- package/src/hooks/usePagination.ts +85 -0
- package/src/hooks/useToast.ts +9 -0
- package/src/hooks/useToastRegionQueue.ts +27 -0
- package/src/index.ts +276 -0
- package/src/types.ts +133 -0
- package/src/utils/breakpoints.ts +43 -0
- package/src/utils/comboboxCollection.tsx +152 -0
- package/src/utils/dateRangePresets.ts +6 -0
- package/src/utils/dialogTransition.ts +39 -0
- package/src/utils/focusRedirect.ts +29 -0
- package/src/utils/isWholeUnitDisabled.ts +17 -0
- package/src/utils/mergeIsDateUnavailable.ts +15 -0
- package/src/utils/overlayPlacement.ts +93 -0
- package/src/utils/pointerInteraction.ts +21 -0
- package/src/utils/polymorphic.ts +36 -0
- package/src/utils/renderMenuItemContent.tsx +62 -0
- package/src/utils/setVisibleRangeStart.ts +64 -0
- package/src/utils/spacingClassName.ts +14 -0
- package/src/utils/suppressFocusRingGlobally.ts +69 -0
- package/src/utils/validationClassName.ts +8 -0
- package/src/utils/virtualFocusStyle.ts +16 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
createPolymorphicComponent,
|
|
6
|
+
PolymorphicComponentProps,
|
|
7
|
+
PolymorphicRef
|
|
8
|
+
} from '../../utils/polymorphic'
|
|
9
|
+
|
|
10
|
+
type CardGroupOwnProps<C extends ElementType> = {
|
|
11
|
+
/**
|
|
12
|
+
* A string of all className you want applied to the base component.
|
|
13
|
+
*/
|
|
14
|
+
className?: string
|
|
15
|
+
/**
|
|
16
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
17
|
+
*/
|
|
18
|
+
component?: C
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CardGroupProps<C extends ElementType = 'div'> = PolymorphicComponentProps<
|
|
22
|
+
C,
|
|
23
|
+
CardGroupOwnProps<C>
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
type CardGroupComponent = (<C extends ElementType = 'div'>(
|
|
27
|
+
props: CardGroupProps<C> & { ref?: PolymorphicRef<C> }
|
|
28
|
+
) => ReactElement | null) & { displayName?: string }
|
|
29
|
+
|
|
30
|
+
// Arranges direct-child Cards as an equal-width row, joined edge-to-edge, once its container
|
|
31
|
+
// reaches the small container breakpoint — below that, cards stack vertically. Requires a
|
|
32
|
+
// `.contains-inline` ancestor (not applied by CardGroup itself, e.g. a wrapping
|
|
33
|
+
// `<div className="contains-inline">`) to establish the container query context.
|
|
34
|
+
function CardGroupRender<C extends ElementType = 'div'>(
|
|
35
|
+
{ children, className, component, ...rest }: CardGroupProps<C>,
|
|
36
|
+
ref: PolymorphicRef<C>
|
|
37
|
+
) {
|
|
38
|
+
const Component = component ?? 'div'
|
|
39
|
+
const _className = classNames('card-group', className)
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Component className={_className} {...rest} ref={ref}>
|
|
43
|
+
{children}
|
|
44
|
+
</Component>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const CardGroup = createPolymorphicComponent<CardGroupComponent>(
|
|
49
|
+
CardGroupRender as ForwardRefRenderFunction<Element, CardGroupProps<ElementType>>,
|
|
50
|
+
'CardGroup'
|
|
51
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
createPolymorphicComponent,
|
|
6
|
+
PolymorphicComponentProps,
|
|
7
|
+
PolymorphicRef
|
|
8
|
+
} from '../../utils/polymorphic'
|
|
9
|
+
|
|
10
|
+
type CardHeaderOwnProps<C extends ElementType> = {
|
|
11
|
+
/**
|
|
12
|
+
* A string of all className you want applied to the base component.
|
|
13
|
+
*/
|
|
14
|
+
className?: string
|
|
15
|
+
/**
|
|
16
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
17
|
+
*/
|
|
18
|
+
component?: C
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CardHeaderProps<C extends ElementType = 'div'> = PolymorphicComponentProps<
|
|
22
|
+
C,
|
|
23
|
+
CardHeaderOwnProps<C>
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
type CardHeaderComponent = (<C extends ElementType = 'div'>(
|
|
27
|
+
props: CardHeaderProps<C> & { ref?: PolymorphicRef<C> }
|
|
28
|
+
) => ReactElement | null) & { displayName?: string }
|
|
29
|
+
|
|
30
|
+
function CardHeaderRender<C extends ElementType = 'div'>(
|
|
31
|
+
{ children, className, component, ...rest }: CardHeaderProps<C>,
|
|
32
|
+
ref: PolymorphicRef<C>
|
|
33
|
+
) {
|
|
34
|
+
const Component = component ?? 'div'
|
|
35
|
+
const _className = classNames('card-header', className)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Component className={_className} {...rest} ref={ref}>
|
|
39
|
+
{children}
|
|
40
|
+
</Component>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const CardHeader = createPolymorphicComponent<CardHeaderComponent>(
|
|
45
|
+
CardHeaderRender as ForwardRefRenderFunction<Element, CardHeaderProps<ElementType>>,
|
|
46
|
+
'CardHeader'
|
|
47
|
+
)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
|
|
4
|
+
import { Breakpoint } from '../../types'
|
|
5
|
+
import { buildResponsiveClassNames } from '../../utils/breakpoints'
|
|
6
|
+
import {
|
|
7
|
+
createPolymorphicComponent,
|
|
8
|
+
PolymorphicComponentProps,
|
|
9
|
+
PolymorphicRef
|
|
10
|
+
} from '../../utils/polymorphic'
|
|
11
|
+
|
|
12
|
+
type CardImageOrientation = 'top' | 'bottom' | 'start' | 'end'
|
|
13
|
+
|
|
14
|
+
type CardImageOwnProps<C extends ElementType> = {
|
|
15
|
+
/**
|
|
16
|
+
* A string of all className you want applied to the base component.
|
|
17
|
+
*/
|
|
18
|
+
className?: string
|
|
19
|
+
/**
|
|
20
|
+
* Component used for the root node. Either a string to use a HTML element or a component —
|
|
21
|
+
* e.g. a framework's own `Image` component. Its own props (`src`, `fill`, `priority`, etc.)
|
|
22
|
+
* are type-checked at the call site once passed here.
|
|
23
|
+
*/
|
|
24
|
+
component?: C
|
|
25
|
+
/**
|
|
26
|
+
* Orientates the image to the top or bottom of the card as an "image cap", or to the start/end
|
|
27
|
+
* for a horizontal layout. Omit to round all four corners for use inside `CardBody`.
|
|
28
|
+
*/
|
|
29
|
+
orientation?: CardImageOrientation
|
|
30
|
+
/**
|
|
31
|
+
* Overrides `orientation` at one or more breakpoints — e.g. `{ large: 'start' }` to switch an
|
|
32
|
+
* image cap from `top` to `start` once the card lays out horizontally.
|
|
33
|
+
*/
|
|
34
|
+
responsive?: Partial<Record<Breakpoint, CardImageOrientation>>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type CardImageProps<C extends ElementType = 'img'> = PolymorphicComponentProps<
|
|
38
|
+
C,
|
|
39
|
+
CardImageOwnProps<C>
|
|
40
|
+
>
|
|
41
|
+
|
|
42
|
+
type CardImageComponent = (<C extends ElementType = 'img'>(
|
|
43
|
+
props: CardImageProps<C> & { ref?: PolymorphicRef<C> }
|
|
44
|
+
) => ReactElement | null) & { displayName?: string }
|
|
45
|
+
|
|
46
|
+
const layoutClassNames = (orientation: CardImageOrientation | undefined, prefix: string) => [
|
|
47
|
+
orientation ? `${prefix}card-image-${orientation}` : prefix === '' ? 'card-image' : null
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
function CardImageRender<C extends ElementType = 'img'>(
|
|
51
|
+
{ children, className, component, orientation, responsive, ...rest }: CardImageProps<C>,
|
|
52
|
+
ref: PolymorphicRef<C>
|
|
53
|
+
) {
|
|
54
|
+
const Component = component ?? 'img'
|
|
55
|
+
const _className = classNames(
|
|
56
|
+
buildResponsiveClassNames(layoutClassNames, orientation, responsive),
|
|
57
|
+
className
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Component className={_className} {...rest} ref={ref}>
|
|
62
|
+
{children}
|
|
63
|
+
</Component>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const CardImage = createPolymorphicComponent<CardImageComponent>(
|
|
68
|
+
CardImageRender as ForwardRefRenderFunction<Element, CardImageProps<ElementType>>,
|
|
69
|
+
'CardImage'
|
|
70
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
createPolymorphicComponent,
|
|
6
|
+
PolymorphicComponentProps,
|
|
7
|
+
PolymorphicRef
|
|
8
|
+
} from '../../utils/polymorphic'
|
|
9
|
+
|
|
10
|
+
type CardImageOverlayOwnProps<C extends ElementType> = {
|
|
11
|
+
/**
|
|
12
|
+
* A string of all className you want applied to the base component.
|
|
13
|
+
*/
|
|
14
|
+
className?: string
|
|
15
|
+
/**
|
|
16
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
17
|
+
*/
|
|
18
|
+
component?: C
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CardImageOverlayProps<C extends ElementType = 'div'> = PolymorphicComponentProps<
|
|
22
|
+
C,
|
|
23
|
+
CardImageOverlayOwnProps<C>
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
type CardImageOverlayComponent = (<C extends ElementType = 'div'>(
|
|
27
|
+
props: CardImageOverlayProps<C> & { ref?: PolymorphicRef<C> }
|
|
28
|
+
) => ReactElement | null) & { displayName?: string }
|
|
29
|
+
|
|
30
|
+
function CardImageOverlayRender<C extends ElementType = 'div'>(
|
|
31
|
+
{ children, className, component, ...rest }: CardImageOverlayProps<C>,
|
|
32
|
+
ref: PolymorphicRef<C>
|
|
33
|
+
) {
|
|
34
|
+
const Component = component ?? 'div'
|
|
35
|
+
const _className = classNames('card-overlay', className)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Component className={_className} {...rest} ref={ref}>
|
|
39
|
+
{children}
|
|
40
|
+
</Component>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const CardImageOverlay = createPolymorphicComponent<CardImageOverlayComponent>(
|
|
45
|
+
CardImageOverlayRender as ForwardRefRenderFunction<Element, CardImageOverlayProps<ElementType>>,
|
|
46
|
+
'CardImageOverlay'
|
|
47
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
|
|
4
|
+
import { createPolymorphicComponent, PolymorphicRef } from '../../utils/polymorphic'
|
|
5
|
+
import { Link, LinkProps } from '../link/Link'
|
|
6
|
+
|
|
7
|
+
type CardLinkOwnProps = {
|
|
8
|
+
/**
|
|
9
|
+
* A string of all className you want applied to the base component.
|
|
10
|
+
*/
|
|
11
|
+
className?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type CardLinkProps<C extends ElementType = 'a'> = LinkProps<C> & CardLinkOwnProps
|
|
15
|
+
|
|
16
|
+
type CardLinkComponent = (<C extends ElementType = 'a'>(
|
|
17
|
+
props: CardLinkProps<C> & { ref?: PolymorphicRef<C> }
|
|
18
|
+
) => ReactElement | null) & { displayName?: string }
|
|
19
|
+
|
|
20
|
+
function CardLinkRender<C extends ElementType = 'a'>(
|
|
21
|
+
{ children, className, ...rest }: CardLinkProps<C>,
|
|
22
|
+
ref: PolymorphicRef<C>
|
|
23
|
+
) {
|
|
24
|
+
const _className = classNames('card-link', className)
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Link
|
|
28
|
+
className={_className}
|
|
29
|
+
{...(rest as Record<string, unknown>)}
|
|
30
|
+
ref={ref as PolymorphicRef<ElementType>}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</Link>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const CardLink = createPolymorphicComponent<CardLinkComponent>(
|
|
38
|
+
CardLinkRender as ForwardRefRenderFunction<Element, CardLinkProps<ElementType>>,
|
|
39
|
+
'CardLink'
|
|
40
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
createPolymorphicComponent,
|
|
6
|
+
PolymorphicComponentProps,
|
|
7
|
+
PolymorphicRef
|
|
8
|
+
} from '../../utils/polymorphic'
|
|
9
|
+
|
|
10
|
+
type CardSubtitleOwnProps<C extends ElementType> = {
|
|
11
|
+
/**
|
|
12
|
+
* A string of all className you want applied to the component.
|
|
13
|
+
*/
|
|
14
|
+
className?: string
|
|
15
|
+
/**
|
|
16
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
17
|
+
*/
|
|
18
|
+
component?: C
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CardSubtitleProps<C extends ElementType = 'h6'> = PolymorphicComponentProps<
|
|
22
|
+
C,
|
|
23
|
+
CardSubtitleOwnProps<C>
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
type CardSubtitleComponent = (<C extends ElementType = 'h6'>(
|
|
27
|
+
props: CardSubtitleProps<C> & { ref?: PolymorphicRef<C> }
|
|
28
|
+
) => ReactElement | null) & { displayName?: string }
|
|
29
|
+
|
|
30
|
+
function CardSubtitleRender<C extends ElementType = 'h6'>(
|
|
31
|
+
{ children, component, className, ...rest }: CardSubtitleProps<C>,
|
|
32
|
+
ref: PolymorphicRef<C>
|
|
33
|
+
) {
|
|
34
|
+
const Component = component ?? 'h6'
|
|
35
|
+
const _className = classNames('card-subtitle', className)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Component className={_className} {...rest} ref={ref}>
|
|
39
|
+
{children}
|
|
40
|
+
</Component>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const CardSubtitle = createPolymorphicComponent<CardSubtitleComponent>(
|
|
45
|
+
CardSubtitleRender as ForwardRefRenderFunction<Element, CardSubtitleProps<ElementType>>,
|
|
46
|
+
'CardSubtitle'
|
|
47
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
createPolymorphicComponent,
|
|
6
|
+
PolymorphicComponentProps,
|
|
7
|
+
PolymorphicRef
|
|
8
|
+
} from '../../utils/polymorphic'
|
|
9
|
+
|
|
10
|
+
type CardTextOwnProps<C extends ElementType> = {
|
|
11
|
+
/**
|
|
12
|
+
* A string of all className you want applied to the component.
|
|
13
|
+
*/
|
|
14
|
+
className?: string
|
|
15
|
+
/**
|
|
16
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
17
|
+
*/
|
|
18
|
+
component?: C
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CardTextProps<C extends ElementType = 'p'> = PolymorphicComponentProps<
|
|
22
|
+
C,
|
|
23
|
+
CardTextOwnProps<C>
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
type CardTextComponent = (<C extends ElementType = 'p'>(
|
|
27
|
+
props: CardTextProps<C> & { ref?: PolymorphicRef<C> }
|
|
28
|
+
) => ReactElement | null) & { displayName?: string }
|
|
29
|
+
|
|
30
|
+
function CardTextRender<C extends ElementType = 'p'>(
|
|
31
|
+
{ children, component, className, ...rest }: CardTextProps<C>,
|
|
32
|
+
ref: PolymorphicRef<C>
|
|
33
|
+
) {
|
|
34
|
+
const Component = component ?? 'p'
|
|
35
|
+
const _className = classNames('card-text', className)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Component className={_className} {...rest} ref={ref}>
|
|
39
|
+
{children}
|
|
40
|
+
</Component>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const CardText = createPolymorphicComponent<CardTextComponent>(
|
|
45
|
+
CardTextRender as ForwardRefRenderFunction<Element, CardTextProps<ElementType>>,
|
|
46
|
+
'CardText'
|
|
47
|
+
)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
createPolymorphicComponent,
|
|
6
|
+
PolymorphicComponentProps,
|
|
7
|
+
PolymorphicRef
|
|
8
|
+
} from '../../utils/polymorphic'
|
|
9
|
+
|
|
10
|
+
type CardTitleOwnProps<C extends ElementType> = {
|
|
11
|
+
/**
|
|
12
|
+
* A string of all className you want applied to the component.
|
|
13
|
+
*/
|
|
14
|
+
className?: string
|
|
15
|
+
/**
|
|
16
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
17
|
+
*/
|
|
18
|
+
component?: C
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type CardTitleProps<C extends ElementType = 'h5'> = PolymorphicComponentProps<
|
|
22
|
+
C,
|
|
23
|
+
CardTitleOwnProps<C>
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
type CardTitleComponent = (<C extends ElementType = 'h5'>(
|
|
27
|
+
props: CardTitleProps<C> & { ref?: PolymorphicRef<C> }
|
|
28
|
+
) => ReactElement | null) & { displayName?: string }
|
|
29
|
+
|
|
30
|
+
function CardTitleRender<C extends ElementType = 'h5'>(
|
|
31
|
+
{ children, component, className, ...rest }: CardTitleProps<C>,
|
|
32
|
+
ref: PolymorphicRef<C>
|
|
33
|
+
) {
|
|
34
|
+
const Component = component ?? 'h5'
|
|
35
|
+
const _className = classNames('card-title', className)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Component className={_className} {...rest} ref={ref}>
|
|
39
|
+
{children}
|
|
40
|
+
</Component>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const CardTitle = createPolymorphicComponent<CardTitleComponent>(
|
|
45
|
+
CardTitleRender as ForwardRefRenderFunction<Element, CardTitleProps<ElementType>>,
|
|
46
|
+
'CardTitle'
|
|
47
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { Card } from './Card'
|
|
2
|
+
export type { CardProps } from './Card'
|
|
3
|
+
export { CardBody } from './CardBody'
|
|
4
|
+
export type { CardBodyProps } from './CardBody'
|
|
5
|
+
export { CardFooter } from './CardFooter'
|
|
6
|
+
export type { CardFooterProps } from './CardFooter'
|
|
7
|
+
export { CardGroup } from './CardGroup'
|
|
8
|
+
export type { CardGroupProps } from './CardGroup'
|
|
9
|
+
export { CardHeader } from './CardHeader'
|
|
10
|
+
export type { CardHeaderProps } from './CardHeader'
|
|
11
|
+
export { CardImage } from './CardImage'
|
|
12
|
+
export type { CardImageProps } from './CardImage'
|
|
13
|
+
export { CardImageOverlay } from './CardImageOverlay'
|
|
14
|
+
export type { CardImageOverlayProps } from './CardImageOverlay'
|
|
15
|
+
export { CardLink } from './CardLink'
|
|
16
|
+
export type { CardLinkProps } from './CardLink'
|
|
17
|
+
export { CardSubtitle } from './CardSubtitle'
|
|
18
|
+
export type { CardSubtitleProps } from './CardSubtitle'
|
|
19
|
+
export { CardText } from './CardText'
|
|
20
|
+
export type { CardTextProps } from './CardText'
|
|
21
|
+
export { CardTitle } from './CardTitle'
|
|
22
|
+
export type { CardTitleProps } from './CardTitle'
|