@arobo/react 1.0.1
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/README.md +27 -0
- package/dist/components/button/button.d.ts +10 -0
- package/dist/components/button/button.js +48 -0
- package/dist/components/button/index.d.ts +15 -0
- package/dist/components/button/index.js +12 -0
- package/dist/components/button-group/button-group.d.ts +19 -0
- package/dist/components/button-group/button-group.js +52 -0
- package/dist/components/button-group/index.d.ts +14 -0
- package/dist/components/button-group/index.js +9 -0
- package/dist/components/calendar/calendar.d.ts +17 -0
- package/dist/components/calendar/calendar.js +98 -0
- package/dist/components/calendar/index.d.ts +13 -0
- package/dist/components/calendar/index.js +12 -0
- package/dist/components/card/card.d.ts +22 -0
- package/dist/components/card/card.js +140 -0
- package/dist/components/card/index.d.ts +23 -0
- package/dist/components/card/index.js +16 -0
- package/dist/components/checkbox/checkbox.d.ts +22 -0
- package/dist/components/checkbox/checkbox.js +123 -0
- package/dist/components/checkbox/index.d.ts +19 -0
- package/dist/components/checkbox/index.js +14 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +14 -0
- package/dist/components/checkbox-group/checkbox-group.js +32 -0
- package/dist/components/checkbox-group/index.d.ts +3 -0
- package/dist/components/checkbox-group/index.js +2 -0
- package/dist/components/close-button/close-button.d.ts +8 -0
- package/dist/components/close-button/close-button.js +32 -0
- package/dist/components/close-button/index.d.ts +13 -0
- package/dist/components/close-button/index.js +11 -0
- package/dist/components/combobox/combobox.d.ts +23 -0
- package/dist/components/combobox/combobox.js +113 -0
- package/dist/components/combobox/index.d.ts +19 -0
- package/dist/components/combobox/index.js +14 -0
- package/dist/components/date-field/date-field.d.ts +9 -0
- package/dist/components/date-field/date-field.js +28 -0
- package/dist/components/date-field/index.d.ts +13 -0
- package/dist/components/date-field/index.js +11 -0
- package/dist/components/date-input-group/date-input-group.d.ts +25 -0
- package/dist/components/date-input-group/date-input-group.js +140 -0
- package/dist/components/date-input-group/index.d.ts +23 -0
- package/dist/components/date-input-group/index.js +16 -0
- package/dist/components/date-picker/date-picker.d.ts +11 -0
- package/dist/components/date-picker/date-picker.js +67 -0
- package/dist/components/date-picker/index.d.ts +13 -0
- package/dist/components/date-picker/index.js +11 -0
- package/dist/components/date-range-picker/date-range-picker.d.ts +11 -0
- package/dist/components/date-range-picker/date-range-picker.js +70 -0
- package/dist/components/date-range-picker/index.d.ts +13 -0
- package/dist/components/date-range-picker/index.js +11 -0
- package/dist/components/description/description.d.ts +9 -0
- package/dist/components/description/description.js +21 -0
- package/dist/components/description/index.d.ts +13 -0
- package/dist/components/description/index.js +11 -0
- package/dist/components/error-message/error-message.d.ts +9 -0
- package/dist/components/error-message/error-message.js +21 -0
- package/dist/components/error-message/index.d.ts +13 -0
- package/dist/components/error-message/index.js +11 -0
- package/dist/components/field-error/field-error.d.ts +8 -0
- package/dist/components/field-error/field-error.js +20 -0
- package/dist/components/field-error/index.d.ts +13 -0
- package/dist/components/field-error/index.js +11 -0
- package/dist/components/field-group/field-group.d.ts +11 -0
- package/dist/components/field-group/field-group.js +18 -0
- package/dist/components/field-group/index.d.ts +13 -0
- package/dist/components/field-group/index.js +11 -0
- package/dist/components/icons.d.ts +16 -0
- package/dist/components/icons.js +36 -0
- package/dist/components/index.d.ts +21 -0
- package/dist/components/input/index.d.ts +13 -0
- package/dist/components/input/index.js +11 -0
- package/dist/components/input/input.d.ts +8 -0
- package/dist/components/input/input.js +27 -0
- package/dist/components/label/index.d.ts +13 -0
- package/dist/components/label/index.js +11 -0
- package/dist/components/label/label.d.ts +8 -0
- package/dist/components/label/label.js +26 -0
- package/dist/components/popover/index.d.ts +23 -0
- package/dist/components/popover/index.js +16 -0
- package/dist/components/popover/popover.d.ts +26 -0
- package/dist/components/popover/popover.js +154 -0
- package/dist/components/range-calendar/index.d.ts +13 -0
- package/dist/components/range-calendar/index.js +11 -0
- package/dist/components/range-calendar/range-calendar.d.ts +7 -0
- package/dist/components/range-calendar/range-calendar.js +44 -0
- package/dist/components/surface/index.d.ts +14 -0
- package/dist/components/surface/index.js +12 -0
- package/dist/components/surface/surface.d.ts +12 -0
- package/dist/components/surface/surface.js +35 -0
- package/dist/components/text-field/index.d.ts +14 -0
- package/dist/components/text-field/index.js +12 -0
- package/dist/components/text-field/text-field.d.ts +18 -0
- package/dist/components/text-field/text-field.js +38 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +62 -0
- package/dist/styles/src/components/button/button.styles.js +36 -0
- package/dist/styles/src/components/button-group/button-group.styles.js +16 -0
- package/dist/styles/src/components/calendar/calendar.styles.js +25 -0
- package/dist/styles/src/components/card/card.styles.js +33 -0
- package/dist/styles/src/components/checkbox/checkbox.styles.js +25 -0
- package/dist/styles/src/components/checkbox-group/checkbox-group.styles.js +22 -0
- package/dist/styles/src/components/close-button/close-button.styles.js +15 -0
- package/dist/styles/src/components/combobox/combobox.styles.js +24 -0
- package/dist/styles/src/components/date-field/date-field.styles.js +16 -0
- package/dist/styles/src/components/date-input-group/date-input-group.styles.js +24 -0
- package/dist/styles/src/components/date-picker/date-picker.styles.js +11 -0
- package/dist/styles/src/components/date-range-picker/date-range-picker.styles.js +28 -0
- package/dist/styles/src/components/description/description.styles.js +7 -0
- package/dist/styles/src/components/error-message/error-message.styles.js +7 -0
- package/dist/styles/src/components/field-error/field-error.styles.js +7 -0
- package/dist/styles/src/components/field-group/field-group.styles.js +25 -0
- package/dist/styles/src/components/input/input.styles.js +21 -0
- package/dist/styles/src/components/label/label.styles.js +23 -0
- package/dist/styles/src/components/popover/popover.styles.js +12 -0
- package/dist/styles/src/components/range-calendar/range-calendar.styles.js +26 -0
- package/dist/styles/src/components/surface/surface.styles.js +32 -0
- package/dist/styles/src/components/text-field/text-field.styles.js +16 -0
- package/dist/styles/src/utils/state.js +13 -0
- package/dist/utils/assertion.d.ts +9 -0
- package/dist/utils/assertion.js +3 -0
- package/dist/utils/compose.d.ts +6 -0
- package/dist/utils/compose.js +18 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/styles.d.ts +16 -0
- package/dist/utils/styles.js +13 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
AroboUI is the internal UI library built to help Arobid Development Team move fast, stay consistent, and deliver delightful user experiences.
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
To get started with AroboUI in your React project, follow these steps:
|
|
6
|
+
|
|
7
|
+
1. **Install the package**:
|
|
8
|
+
```bash
|
|
9
|
+
npm install @arobo/react @arobo/styles
|
|
10
|
+
```
|
|
11
|
+
or using Yarn:
|
|
12
|
+
```bash
|
|
13
|
+
yarn add @arobo/react @arobo/styles
|
|
14
|
+
```
|
|
15
|
+
2. **Import styles into Tailwind CSS V4**:
|
|
16
|
+
```css
|
|
17
|
+
@import "@arobo/styles/tailwind.css";
|
|
18
|
+
```
|
|
19
|
+
3. **Use components in your React application**:
|
|
20
|
+
```jsx
|
|
21
|
+
import { Button } from "@arobo/react";
|
|
22
|
+
function App() {
|
|
23
|
+
return <Button>Click Me</Button>;
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Big respect to the HeroUI for making this possible
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ButtonVariants } from "@arobo/styles";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import { Button as ButtonPrimitive } from "react-aria-components";
|
|
4
|
+
import { BUTTON_GROUP_CHILD } from "../button-group";
|
|
5
|
+
interface ButtonRootProps extends ComponentPropsWithRef<typeof ButtonPrimitive>, ButtonVariants {
|
|
6
|
+
[BUTTON_GROUP_CHILD]?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const ButtonRoot: ({ children, className, fullWidth, isDisabled, isIconOnly, size, slot, style, variant, [BUTTON_GROUP_CHILD]: isButtonGroupChild, ...rest }: ButtonRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { ButtonRoot };
|
|
10
|
+
export type { ButtonRootProps };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { Button } from 'react-aria-components';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { ButtonGroupContext, BUTTON_GROUP_CHILD } from '../button-group/button-group.js';
|
|
5
|
+
import { buttonVariants } from '../../styles/src/components/button/button.styles.js';
|
|
6
|
+
import { composeTwRenderProps } from '../../utils/compose.js';
|
|
7
|
+
|
|
8
|
+
const ButtonRoot = ({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
fullWidth,
|
|
12
|
+
isDisabled,
|
|
13
|
+
isIconOnly,
|
|
14
|
+
size,
|
|
15
|
+
slot,
|
|
16
|
+
style,
|
|
17
|
+
variant,
|
|
18
|
+
[BUTTON_GROUP_CHILD]: isButtonGroupChild,
|
|
19
|
+
...rest
|
|
20
|
+
}) => {
|
|
21
|
+
const buttonGroupContext = useContext(ButtonGroupContext);
|
|
22
|
+
|
|
23
|
+
// Only use context if this button is a direct child of ButtonGroup
|
|
24
|
+
const shouldUseContext = isButtonGroupChild === true;
|
|
25
|
+
|
|
26
|
+
// Merge props with precedence: direct props > context props
|
|
27
|
+
const finalSize = size ?? (shouldUseContext ? buttonGroupContext?.size : undefined);
|
|
28
|
+
const finalVariant = variant ?? (shouldUseContext ? buttonGroupContext?.variant : undefined);
|
|
29
|
+
const finalIsDisabled = isDisabled ?? (shouldUseContext ? buttonGroupContext?.isDisabled : undefined);
|
|
30
|
+
const finalFullWidth = fullWidth ?? (shouldUseContext ? buttonGroupContext?.fullWidth : undefined);
|
|
31
|
+
const styles = buttonVariants({
|
|
32
|
+
fullWidth: finalFullWidth,
|
|
33
|
+
isIconOnly,
|
|
34
|
+
size: finalSize,
|
|
35
|
+
variant: finalVariant
|
|
36
|
+
});
|
|
37
|
+
return /*#__PURE__*/jsx(Button, {
|
|
38
|
+
className: composeTwRenderProps(className, styles),
|
|
39
|
+
"data-slot": "button",
|
|
40
|
+
isDisabled: finalIsDisabled,
|
|
41
|
+
slot: slot,
|
|
42
|
+
style: style,
|
|
43
|
+
...rest,
|
|
44
|
+
children: renderProps => typeof children === "function" ? children(renderProps) : children
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { ButtonRoot };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { BUTTON_GROUP_CHILD } from "../button-group";
|
|
3
|
+
import { ButtonRoot } from "./button";
|
|
4
|
+
export declare const Button: (({ children, className, fullWidth, isDisabled, isIconOnly, size, slot, style, variant, [BUTTON_GROUP_CHILD]: isButtonGroupChild, ...rest }: import("./button").ButtonRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
5
|
+
Root: ({ children, className, fullWidth, isDisabled, isIconOnly, size, slot, style, variant, [BUTTON_GROUP_CHILD]: isButtonGroupChild, ...rest }: import("./button").ButtonRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
};
|
|
7
|
+
export type Button = {
|
|
8
|
+
Props: ComponentProps<typeof ButtonRoot>;
|
|
9
|
+
RootProps: ComponentProps<typeof ButtonRoot>;
|
|
10
|
+
};
|
|
11
|
+
export { ButtonRoot };
|
|
12
|
+
export type { ButtonRootProps, ButtonRootProps as ButtonProps } from "./button";
|
|
13
|
+
export { BUTTON_GROUP_CHILD };
|
|
14
|
+
export { buttonVariants } from "@arobo/styles";
|
|
15
|
+
export type { ButtonVariants } from "@arobo/styles";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ButtonRoot } from './button.js';
|
|
2
|
+
export { BUTTON_GROUP_CHILD } from '../button-group/button-group.js';
|
|
3
|
+
export { buttonVariants } from '../../styles/src/components/button/button.styles.js';
|
|
4
|
+
|
|
5
|
+
/* -------------------------------------------------------------------------------------------------
|
|
6
|
+
* Compound Component
|
|
7
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
8
|
+
const Button = Object.assign(ButtonRoot, {
|
|
9
|
+
Root: ButtonRoot
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { Button, ButtonRoot };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import type { ButtonProps } from "../button";
|
|
4
|
+
import { type ButtonGroupVariants } from "@arobo/styles";
|
|
5
|
+
type ButtonGroupContext = {
|
|
6
|
+
size?: ButtonProps["size"];
|
|
7
|
+
variant?: ButtonProps["variant"];
|
|
8
|
+
isDisabled?: ButtonProps["isDisabled"];
|
|
9
|
+
fullWidth?: ButtonProps["fullWidth"];
|
|
10
|
+
hideSeparator?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const ButtonGroupContext: React.Context<ButtonGroupContext>;
|
|
13
|
+
export declare const BUTTON_GROUP_CHILD = "__button_group_child";
|
|
14
|
+
interface ButtonGroupRootProps extends ComponentPropsWithRef<"div">, Pick<ButtonProps, "size" | "variant" | "isDisabled">, ButtonGroupVariants {
|
|
15
|
+
hideSeparator?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const ButtonGroupRoot: ({ size, variant, isDisabled, fullWidth, hideSeparator, className, children, ...rest }: ButtonGroupRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { ButtonGroupRoot, ButtonGroupContext };
|
|
19
|
+
export type { ButtonGroupRootProps };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { Children, isValidElement, createContext } from 'react';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { buttonGroupVariants } from '../../styles/src/components/button-group/button-group.styles.js';
|
|
4
|
+
|
|
5
|
+
const ButtonGroupContext = /*#__PURE__*/createContext({});
|
|
6
|
+
|
|
7
|
+
// Property name to mark direct children of ButtonGroup
|
|
8
|
+
const BUTTON_GROUP_CHILD = "__button_group_child";
|
|
9
|
+
|
|
10
|
+
/* -------------------------------------------------------------------------------------------------
|
|
11
|
+
* ButtonGroup Root
|
|
12
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
13
|
+
|
|
14
|
+
const ButtonGroupRoot = ({
|
|
15
|
+
size,
|
|
16
|
+
variant,
|
|
17
|
+
isDisabled,
|
|
18
|
+
fullWidth,
|
|
19
|
+
hideSeparator = false,
|
|
20
|
+
className,
|
|
21
|
+
children,
|
|
22
|
+
...rest
|
|
23
|
+
}) => {
|
|
24
|
+
const wrappedChildren = Children.map(children, child => {
|
|
25
|
+
if (! /*#__PURE__*/isValidElement(child)) {
|
|
26
|
+
return child;
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
29
|
+
[BUTTON_GROUP_CHILD]: true
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return /*#__PURE__*/jsx(ButtonGroupContext, {
|
|
33
|
+
value: {
|
|
34
|
+
size,
|
|
35
|
+
variant,
|
|
36
|
+
fullWidth,
|
|
37
|
+
hideSeparator
|
|
38
|
+
},
|
|
39
|
+
children: /*#__PURE__*/jsx("div", {
|
|
40
|
+
className: buttonGroupVariants({
|
|
41
|
+
className,
|
|
42
|
+
fullWidth
|
|
43
|
+
}),
|
|
44
|
+
"data-hide-separator": hideSeparator ? "true" : undefined,
|
|
45
|
+
"data-slot": "button-group",
|
|
46
|
+
...rest,
|
|
47
|
+
children: wrappedChildren
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { BUTTON_GROUP_CHILD, ButtonGroupContext, ButtonGroupRoot };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { ButtonGroupRoot } from "./button-group";
|
|
3
|
+
export declare const ButtonGroup: (({ size, variant, isDisabled, fullWidth, hideSeparator, className, children, ...rest }: import("./button-group").ButtonGroupRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Root: ({ size, variant, isDisabled, fullWidth, hideSeparator, className, children, ...rest }: import("./button-group").ButtonGroupRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
};
|
|
6
|
+
export type ButtonGroup = {
|
|
7
|
+
Props: ComponentProps<typeof ButtonGroupRoot>;
|
|
8
|
+
RootProps: ComponentProps<typeof ButtonGroupRoot>;
|
|
9
|
+
};
|
|
10
|
+
export { ButtonGroupRoot };
|
|
11
|
+
export type { ButtonGroupRootProps, ButtonGroupRootProps as ButtonGroupProps, } from "./button-group";
|
|
12
|
+
export { ButtonGroupContext, BUTTON_GROUP_CHILD } from "./button-group";
|
|
13
|
+
export { buttonGroupVariants } from "@arobo/styles";
|
|
14
|
+
export type { ButtonGroupVariants } from "@arobo/styles";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonGroupRoot } from './button-group.js';
|
|
2
|
+
export { BUTTON_GROUP_CHILD, ButtonGroupContext } from './button-group.js';
|
|
3
|
+
export { buttonGroupVariants } from '../../styles/src/components/button-group/button-group.styles.js';
|
|
4
|
+
|
|
5
|
+
const ButtonGroup = Object.assign(ButtonGroupRoot, {
|
|
6
|
+
Root: ButtonGroupRoot
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export { ButtonGroup, ButtonGroupRoot };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import type { CalendarProps as CalendarPrimitiveProps, DateValue } from "react-aria-components";
|
|
3
|
+
import { CalendarCell as CalendarCellPrimitive, CalendarGrid as CalendarGridPrimitive } from "react-aria-components";
|
|
4
|
+
interface CalendarRootProps<T extends DateValue> extends Omit<CalendarPrimitiveProps<T>, "visibleDuration"> {
|
|
5
|
+
errorMessage?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const CalendarRoot: <T extends DateValue>({ errorMessage, ...props }: CalendarRootProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare const CalendarHeader: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const CalendarGridHeader: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
interface CalendarGridProps extends ComponentProps<typeof CalendarGridPrimitive> {
|
|
11
|
+
}
|
|
12
|
+
export declare const CalendarGrid: (props: CalendarGridProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
interface CalendarCellProps extends ComponentProps<typeof CalendarCellPrimitive> {
|
|
14
|
+
}
|
|
15
|
+
export declare const CalendarCell: (props: CalendarCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export { CalendarGridHeader, CalendarHeader, CalendarRoot };
|
|
17
|
+
export type { CalendarCellProps, CalendarGridProps, CalendarRootProps };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ChevronRight, ChevronLeft } from 'lucide-react';
|
|
2
|
+
import { Calendar, CalendarGrid as CalendarGrid$1, CalendarGridBody, CalendarCell as CalendarCell$1, Text, useLocale, Heading, CalendarGridHeader as CalendarGridHeader$1, CalendarHeaderCell } from 'react-aria-components';
|
|
3
|
+
import { tv } from 'tailwind-variants';
|
|
4
|
+
import { Button } from '../button/index.js';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { calendarVariants } from '../../styles/src/components/calendar/calendar.styles.js';
|
|
7
|
+
import { focusRing } from '../../utils/styles.js';
|
|
8
|
+
import { composeTwRenderProps } from '../../utils/compose.js';
|
|
9
|
+
|
|
10
|
+
const cellStyles = tv({
|
|
11
|
+
extend: focusRing,
|
|
12
|
+
base: "w-[calc(100cqw/7)] aspect-square text-sm cursor-default rounded-full flex items-center justify-center forced-color-adjust-none no-highlight",
|
|
13
|
+
variants: {
|
|
14
|
+
isSelected: {
|
|
15
|
+
false: "text-neutral-900 dark:text-neutral-200 hover:bg-neutral-200 dark:hover:bg-neutral-700 pressed:bg-neutral-300 dark:pressed:bg-neutral-600",
|
|
16
|
+
true: "bg-blue-600 invalid:bg-red-600 text-white forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"
|
|
17
|
+
},
|
|
18
|
+
isDisabled: {
|
|
19
|
+
true: "text-neutral-300 dark:text-neutral-600 forced-colors:text-[GrayText]"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const CalendarRoot = ({
|
|
24
|
+
errorMessage,
|
|
25
|
+
...props
|
|
26
|
+
}) => {
|
|
27
|
+
return /*#__PURE__*/jsxs(Calendar, {
|
|
28
|
+
...props,
|
|
29
|
+
className: composeTwRenderProps(props.className, "flex flex-col font-sans w-[calc(9*var(--spacing)*7)] max-w-full @container"),
|
|
30
|
+
children: [/*#__PURE__*/jsx(CalendarHeader, {}), /*#__PURE__*/jsxs(CalendarGrid$1, {
|
|
31
|
+
className: "border-spacing-0",
|
|
32
|
+
children: [/*#__PURE__*/jsx(CalendarGridHeader, {}), /*#__PURE__*/jsx(CalendarGridBody, {
|
|
33
|
+
children: date => /*#__PURE__*/jsx(CalendarCell$1, {
|
|
34
|
+
date: date,
|
|
35
|
+
className: composeTwRenderProps(calendarVariants.slots.cell)
|
|
36
|
+
})
|
|
37
|
+
})]
|
|
38
|
+
}), errorMessage && /*#__PURE__*/jsx(Text, {
|
|
39
|
+
slot: "errorMessage",
|
|
40
|
+
className: "text-sm text-red-600",
|
|
41
|
+
children: errorMessage
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const CalendarHeader = () => {
|
|
46
|
+
let {
|
|
47
|
+
direction
|
|
48
|
+
} = useLocale();
|
|
49
|
+
return /*#__PURE__*/jsxs("header", {
|
|
50
|
+
className: "flex items-center gap-1 pb-4 px-1 border-box",
|
|
51
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
52
|
+
isIconOnly: true,
|
|
53
|
+
variant: "ghost",
|
|
54
|
+
slot: "previous",
|
|
55
|
+
children: direction === "rtl" ? /*#__PURE__*/jsx(ChevronRight, {
|
|
56
|
+
"aria-hidden": true,
|
|
57
|
+
size: 18
|
|
58
|
+
}) : /*#__PURE__*/jsx(ChevronLeft, {
|
|
59
|
+
"aria-hidden": true,
|
|
60
|
+
size: 18
|
|
61
|
+
})
|
|
62
|
+
}), /*#__PURE__*/jsx(Heading, {
|
|
63
|
+
className: "flex-1 font-sans font-semibold [font-variation-settings:normal] text-base text-center mx-2 my-0 text-neutral-900 dark:text-neutral-200"
|
|
64
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
65
|
+
isIconOnly: true,
|
|
66
|
+
variant: "ghost",
|
|
67
|
+
slot: "next",
|
|
68
|
+
children: direction === "rtl" ? /*#__PURE__*/jsx(ChevronLeft, {
|
|
69
|
+
"aria-hidden": true,
|
|
70
|
+
size: 18
|
|
71
|
+
}) : /*#__PURE__*/jsx(ChevronRight, {
|
|
72
|
+
"aria-hidden": true,
|
|
73
|
+
size: 18
|
|
74
|
+
})
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const CalendarGridHeader = () => {
|
|
79
|
+
return /*#__PURE__*/jsx(CalendarGridHeader$1, {
|
|
80
|
+
children: day => /*#__PURE__*/jsx(CalendarHeaderCell, {
|
|
81
|
+
className: "text-xs text-neutral-500 font-semibold",
|
|
82
|
+
children: day
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const CalendarGrid = props => {
|
|
87
|
+
return /*#__PURE__*/jsx(CalendarGrid$1, {
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const CalendarCell = props => {
|
|
92
|
+
return /*#__PURE__*/jsx(CalendarCell$1, {
|
|
93
|
+
...props,
|
|
94
|
+
className: cellStyles
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { CalendarCell, CalendarGrid, CalendarGridHeader, CalendarHeader, CalendarRoot };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { CalendarRoot } from "./calendar";
|
|
3
|
+
export declare const Calendar: (<T extends import("react-aria-components").DateValue>({ errorMessage, ...props }: import("./calendar").CalendarRootProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Root: <T extends import("react-aria-components").DateValue>({ errorMessage, ...props }: import("./calendar").CalendarRootProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
};
|
|
6
|
+
export type Calendar = {
|
|
7
|
+
Props: ComponentProps<typeof CalendarRoot>;
|
|
8
|
+
RootProps: ComponentProps<typeof CalendarRoot>;
|
|
9
|
+
};
|
|
10
|
+
export { CalendarRoot, CalendarHeader, CalendarGridHeader, CalendarCell, CalendarGrid, } from "./calendar";
|
|
11
|
+
export type { CalendarRootProps, CalendarRootProps as CalendarProps, CalendarCellProps, CalendarGridProps, } from "./calendar";
|
|
12
|
+
export { calendarVariants } from "@arobo/styles";
|
|
13
|
+
export type { CalendarVariants } from "@arobo/styles";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CalendarRoot } from './calendar.js';
|
|
2
|
+
export { CalendarCell, CalendarGrid, CalendarGridHeader, CalendarHeader } from './calendar.js';
|
|
3
|
+
export { calendarVariants } from '../../styles/src/components/calendar/calendar.styles.js';
|
|
4
|
+
|
|
5
|
+
/* -------------------------------------------------------------------------------------------------
|
|
6
|
+
* Compound Component
|
|
7
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
8
|
+
const Calendar = Object.assign(CalendarRoot, {
|
|
9
|
+
Root: CalendarRoot
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { Calendar, CalendarRoot };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CardVariants } from "@arobo/styles";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
interface CardRootProps extends ComponentPropsWithRef<"div">, CardVariants {
|
|
4
|
+
}
|
|
5
|
+
declare const CardRoot: ({ children, className, variant, ...props }: CardRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
interface CardHeaderProps extends ComponentPropsWithRef<"div"> {
|
|
7
|
+
}
|
|
8
|
+
declare const CardHeader: ({ className, ...props }: CardHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
interface CardTitleProps extends ComponentPropsWithRef<"h3"> {
|
|
10
|
+
}
|
|
11
|
+
declare const CardTitle: ({ children, className, ...props }: CardTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
interface CardDescriptionProps extends ComponentPropsWithRef<"p"> {
|
|
13
|
+
}
|
|
14
|
+
declare const CardDescription: ({ children, className, ...props }: CardDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
interface CardContentProps extends ComponentPropsWithRef<"div"> {
|
|
16
|
+
}
|
|
17
|
+
declare const CardContent: ({ className, ...props }: CardContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
interface CardFooterProps extends ComponentPropsWithRef<"div"> {
|
|
19
|
+
}
|
|
20
|
+
declare const CardFooter: ({ className, ...props }: CardFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export { CardRoot, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, };
|
|
22
|
+
export type { CardRootProps, CardHeaderProps, CardTitleProps, CardDescriptionProps, CardContentProps, CardFooterProps, };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
import { composeSlotClassName } from '../../utils/compose.js';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { cardVariants } from '../../styles/src/components/card/card.styles.js';
|
|
5
|
+
import { SurfaceContext } from '../surface/surface.js';
|
|
6
|
+
|
|
7
|
+
const CardContext = /*#__PURE__*/createContext({});
|
|
8
|
+
|
|
9
|
+
/* -------------------------------------------------------------------------------------------------
|
|
10
|
+
* Card Root
|
|
11
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
12
|
+
|
|
13
|
+
const CardRoot = ({
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
variant = "default",
|
|
17
|
+
...props
|
|
18
|
+
}) => {
|
|
19
|
+
const slots = React.useMemo(() => cardVariants({
|
|
20
|
+
variant
|
|
21
|
+
}), [variant]);
|
|
22
|
+
const content = /*#__PURE__*/jsx("div", {
|
|
23
|
+
className: slots.base({
|
|
24
|
+
className
|
|
25
|
+
}),
|
|
26
|
+
"data-slot": "card",
|
|
27
|
+
...props,
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
30
|
+
return /*#__PURE__*/jsx(CardContext, {
|
|
31
|
+
value: {
|
|
32
|
+
slots
|
|
33
|
+
},
|
|
34
|
+
children: variant === "transparent" ? content :
|
|
35
|
+
/*#__PURE__*/
|
|
36
|
+
// Allows inner components to apply "on-surface" colors for proper contrast
|
|
37
|
+
jsx(SurfaceContext, {
|
|
38
|
+
value: {
|
|
39
|
+
variant: variant
|
|
40
|
+
},
|
|
41
|
+
children: content
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/* -------------------------------------------------------------------------------------------------
|
|
47
|
+
* Card Header
|
|
48
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
49
|
+
|
|
50
|
+
const CardHeader = ({
|
|
51
|
+
className,
|
|
52
|
+
...props
|
|
53
|
+
}) => {
|
|
54
|
+
const {
|
|
55
|
+
slots
|
|
56
|
+
} = useContext(CardContext);
|
|
57
|
+
return /*#__PURE__*/jsx("div", {
|
|
58
|
+
className: composeSlotClassName(slots?.header, className),
|
|
59
|
+
"data-slot": "card-header",
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/* -------------------------------------------------------------------------------------------------
|
|
65
|
+
* Card Title
|
|
66
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
67
|
+
|
|
68
|
+
const CardTitle = ({
|
|
69
|
+
children,
|
|
70
|
+
className,
|
|
71
|
+
...props
|
|
72
|
+
}) => {
|
|
73
|
+
const {
|
|
74
|
+
slots
|
|
75
|
+
} = useContext(CardContext);
|
|
76
|
+
return /*#__PURE__*/jsx("h3", {
|
|
77
|
+
className: composeSlotClassName(slots?.title, className),
|
|
78
|
+
"data-slot": "card-title",
|
|
79
|
+
...props,
|
|
80
|
+
children: children
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/* -------------------------------------------------------------------------------------------------
|
|
85
|
+
* Card Description
|
|
86
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
87
|
+
|
|
88
|
+
const CardDescription = ({
|
|
89
|
+
children,
|
|
90
|
+
className,
|
|
91
|
+
...props
|
|
92
|
+
}) => {
|
|
93
|
+
const {
|
|
94
|
+
slots
|
|
95
|
+
} = useContext(CardContext);
|
|
96
|
+
return /*#__PURE__*/jsx("p", {
|
|
97
|
+
className: composeSlotClassName(slots?.description, className),
|
|
98
|
+
"data-slot": "card-description",
|
|
99
|
+
...props,
|
|
100
|
+
children: children
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/* -------------------------------------------------------------------------------------------------
|
|
105
|
+
* Card Content
|
|
106
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
107
|
+
|
|
108
|
+
const CardContent = ({
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}) => {
|
|
112
|
+
const {
|
|
113
|
+
slots
|
|
114
|
+
} = useContext(CardContext);
|
|
115
|
+
return /*#__PURE__*/jsx("div", {
|
|
116
|
+
className: composeSlotClassName(slots?.content, className),
|
|
117
|
+
"data-slot": "card-content",
|
|
118
|
+
...props
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/* -------------------------------------------------------------------------------------------------
|
|
123
|
+
* Card Footer
|
|
124
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
125
|
+
|
|
126
|
+
const CardFooter = ({
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}) => {
|
|
130
|
+
const {
|
|
131
|
+
slots
|
|
132
|
+
} = useContext(CardContext);
|
|
133
|
+
return /*#__PURE__*/jsx("div", {
|
|
134
|
+
className: composeSlotClassName(slots?.footer, className),
|
|
135
|
+
"data-slot": "card-footer",
|
|
136
|
+
...props
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export { CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from "./card";
|
|
3
|
+
export declare const Card: (({ children, className, variant, ...props }: import("./card").CardRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Root: ({ children, className, variant, ...props }: import("./card").CardRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Header: ({ className, ...props }: import("./card").CardHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Title: ({ children, className, ...props }: import("./card").CardTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Description: ({ children, className, ...props }: import("./card").CardDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
Content: ({ className, ...props }: import("./card").CardContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
Footer: ({ className, ...props }: import("./card").CardFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
};
|
|
11
|
+
export type Card = {
|
|
12
|
+
Props: ComponentProps<typeof CardRoot>;
|
|
13
|
+
RootProps: ComponentProps<typeof CardRoot>;
|
|
14
|
+
HeaderProps: ComponentProps<typeof CardHeader>;
|
|
15
|
+
TitleProps: ComponentProps<typeof CardTitle>;
|
|
16
|
+
DescriptionProps: ComponentProps<typeof CardDescription>;
|
|
17
|
+
ContentProps: ComponentProps<typeof CardContent>;
|
|
18
|
+
FooterProps: ComponentProps<typeof CardFooter>;
|
|
19
|
+
};
|
|
20
|
+
export { CardRoot, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, };
|
|
21
|
+
export type { CardRootProps, CardRootProps as CardProps, CardHeaderProps, CardTitleProps, CardDescriptionProps, CardContentProps, CardFooterProps, } from "./card";
|
|
22
|
+
export { cardVariants } from "@arobo/styles";
|
|
23
|
+
export type { CardVariants } from "@arobo/styles";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CardRoot, CardFooter, CardContent, CardDescription, CardTitle, CardHeader } from './card.js';
|
|
2
|
+
export { cardVariants } from '../../styles/src/components/card/card.styles.js';
|
|
3
|
+
|
|
4
|
+
/* -------------------------------------------------------------------------------------------------
|
|
5
|
+
* Compound Component
|
|
6
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
7
|
+
const Card = Object.assign(CardRoot, {
|
|
8
|
+
Root: CardRoot,
|
|
9
|
+
Header: CardHeader,
|
|
10
|
+
Title: CardTitle,
|
|
11
|
+
Description: CardDescription,
|
|
12
|
+
Content: CardContent,
|
|
13
|
+
Footer: CardFooter
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CheckboxVariants } from "@arobo/styles";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import type { CheckboxRenderProps } from "react-aria-components";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Checkbox as CheckboxPrimitive } from "react-aria-components";
|
|
6
|
+
interface CheckboxRootProps extends ComponentPropsWithRef<typeof CheckboxPrimitive>, CheckboxVariants {
|
|
7
|
+
/** The name of the checkbox, used when submitting an HTML form. */
|
|
8
|
+
name?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const CheckboxRoot: ({ children, className, variant, ...props }: CheckboxRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
interface CheckboxControlProps extends ComponentPropsWithRef<"span"> {
|
|
12
|
+
}
|
|
13
|
+
declare const CheckboxControl: ({ children, className, ...props }: CheckboxControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
interface CheckboxIndicatorProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
|
|
15
|
+
children?: React.ReactNode | ((props: CheckboxRenderProps) => React.ReactNode);
|
|
16
|
+
}
|
|
17
|
+
declare const CheckboxIndicator: ({ children, className, ...props }: CheckboxIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
interface CheckboxContentProps extends ComponentPropsWithRef<"div"> {
|
|
19
|
+
}
|
|
20
|
+
declare const CheckboxContent: ({ children, className, ...props }: CheckboxContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export { CheckboxRoot, CheckboxControl, CheckboxIndicator, CheckboxContent };
|
|
22
|
+
export type { CheckboxRootProps, CheckboxControlProps, CheckboxIndicatorProps, CheckboxContentProps, };
|