@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
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { useContext, createContext } from 'react';
|
|
2
|
+
import { Checkbox } from 'react-aria-components';
|
|
3
|
+
import { composeTwRenderProps, composeSlotClassName } from '../../utils/compose.js';
|
|
4
|
+
import { CheckboxGroupContext } from '../checkbox-group/checkbox-group.js';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { checkboxVariants } from '../../styles/src/components/checkbox/checkbox.styles.js';
|
|
7
|
+
|
|
8
|
+
const CheckboxContext = /*#__PURE__*/createContext({});
|
|
9
|
+
const CheckboxRoot = ({
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
variant,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
16
|
+
const effectiveVariant = variant ?? checkboxGroupContext.variant;
|
|
17
|
+
const slots = React.useMemo(() => checkboxVariants({
|
|
18
|
+
variant: effectiveVariant
|
|
19
|
+
}), [effectiveVariant]);
|
|
20
|
+
return /*#__PURE__*/jsx(Checkbox, {
|
|
21
|
+
"data-slot": "checkbox",
|
|
22
|
+
...props,
|
|
23
|
+
className: composeTwRenderProps(className, slots.base()),
|
|
24
|
+
children: values => /*#__PURE__*/jsx(CheckboxContext, {
|
|
25
|
+
value: {
|
|
26
|
+
slots,
|
|
27
|
+
state: values
|
|
28
|
+
},
|
|
29
|
+
children: typeof children === "function" ? children(values) : children
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/* -----------------------------------------------------------------------------------------------*/
|
|
35
|
+
|
|
36
|
+
const CheckboxControl = ({
|
|
37
|
+
children,
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}) => {
|
|
41
|
+
const {
|
|
42
|
+
slots
|
|
43
|
+
} = useContext(CheckboxContext);
|
|
44
|
+
return /*#__PURE__*/jsx("span", {
|
|
45
|
+
className: composeSlotClassName(slots?.control, className),
|
|
46
|
+
"data-slot": "checkbox-control",
|
|
47
|
+
...props,
|
|
48
|
+
children: children
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/* -----------------------------------------------------------------------------------------------*/
|
|
53
|
+
|
|
54
|
+
const CheckboxIndicator = ({
|
|
55
|
+
children,
|
|
56
|
+
className,
|
|
57
|
+
...props
|
|
58
|
+
}) => {
|
|
59
|
+
const {
|
|
60
|
+
slots,
|
|
61
|
+
state
|
|
62
|
+
} = useContext(CheckboxContext);
|
|
63
|
+
const isSelected = state?.isSelected;
|
|
64
|
+
const isIndeterminate = state?.isIndeterminate;
|
|
65
|
+
const content = typeof children === "function" ? children(state ?? {}) : children ? children : isIndeterminate ? /*#__PURE__*/jsx("svg", {
|
|
66
|
+
"aria-hidden": "true",
|
|
67
|
+
"data-slot": "checkbox-default-indicator--indeterminate",
|
|
68
|
+
fill: "none",
|
|
69
|
+
role: "presentation",
|
|
70
|
+
stroke: "currentColor",
|
|
71
|
+
strokeLinecap: "round",
|
|
72
|
+
strokeWidth: 3,
|
|
73
|
+
viewBox: "0 0 24 24",
|
|
74
|
+
children: /*#__PURE__*/jsx("line", {
|
|
75
|
+
x1: "21",
|
|
76
|
+
x2: "3",
|
|
77
|
+
y1: "12",
|
|
78
|
+
y2: "12"
|
|
79
|
+
})
|
|
80
|
+
}) : /*#__PURE__*/jsx("svg", {
|
|
81
|
+
"aria-hidden": "true",
|
|
82
|
+
"data-slot": "checkbox-default-indicator--checkmark",
|
|
83
|
+
fill: "none",
|
|
84
|
+
role: "presentation",
|
|
85
|
+
stroke: "currentColor",
|
|
86
|
+
strokeDasharray: 22,
|
|
87
|
+
strokeDashoffset: isSelected ? 44 : 66,
|
|
88
|
+
strokeLinecap: "round",
|
|
89
|
+
strokeLinejoin: "round",
|
|
90
|
+
strokeWidth: 2,
|
|
91
|
+
viewBox: "0 0 17 18",
|
|
92
|
+
children: /*#__PURE__*/jsx("polyline", {
|
|
93
|
+
points: "1 9 7 14 15 4"
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
return /*#__PURE__*/jsx("span", {
|
|
97
|
+
"aria-hidden": "true",
|
|
98
|
+
className: composeSlotClassName(slots?.indicator, className),
|
|
99
|
+
"data-slot": "checkbox-indicator",
|
|
100
|
+
...props,
|
|
101
|
+
children: content
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/* -----------------------------------------------------------------------------------------------*/
|
|
106
|
+
|
|
107
|
+
const CheckboxContent = ({
|
|
108
|
+
children,
|
|
109
|
+
className,
|
|
110
|
+
...props
|
|
111
|
+
}) => {
|
|
112
|
+
const {
|
|
113
|
+
slots
|
|
114
|
+
} = useContext(CheckboxContext);
|
|
115
|
+
return /*#__PURE__*/jsx("div", {
|
|
116
|
+
className: composeSlotClassName(slots?.content, className),
|
|
117
|
+
"data-slot": "checkbox-content",
|
|
118
|
+
...props,
|
|
119
|
+
children: children
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export { CheckboxContent, CheckboxControl, CheckboxIndicator, CheckboxRoot };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { CheckboxContent, CheckboxControl, CheckboxIndicator, CheckboxRoot } from "./checkbox";
|
|
3
|
+
export declare const Checkbox: (({ children, className, variant, ...props }: import("./checkbox").CheckboxRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Root: ({ children, className, variant, ...props }: import("./checkbox").CheckboxRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Control: ({ children, className, ...props }: import("./checkbox").CheckboxControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Indicator: ({ children, className, ...props }: import("./checkbox").CheckboxIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Content: ({ children, className, ...props }: import("./checkbox").CheckboxContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export type Checkbox = {
|
|
10
|
+
Props: ComponentProps<typeof CheckboxRoot>;
|
|
11
|
+
RootProps: ComponentProps<typeof CheckboxRoot>;
|
|
12
|
+
ControlProps: ComponentProps<typeof CheckboxControl>;
|
|
13
|
+
IndicatorProps: ComponentProps<typeof CheckboxIndicator>;
|
|
14
|
+
ContentProps: ComponentProps<typeof CheckboxContent>;
|
|
15
|
+
};
|
|
16
|
+
export { CheckboxRoot, CheckboxControl, CheckboxIndicator, CheckboxContent, } from "./checkbox";
|
|
17
|
+
export type { CheckboxRootProps, CheckboxRootProps as CheckboxProps, CheckboxControlProps, CheckboxIndicatorProps, CheckboxContentProps, } from "./checkbox";
|
|
18
|
+
export { checkboxVariants } from "@arobo/styles";
|
|
19
|
+
export type { CheckboxVariants } from "@arobo/styles";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CheckboxRoot, CheckboxContent, CheckboxIndicator, CheckboxControl } from './checkbox.js';
|
|
2
|
+
export { checkboxVariants } from '../../styles/src/components/checkbox/checkbox.styles.js';
|
|
3
|
+
|
|
4
|
+
/* -------------------------------------------------------------------------------------------------
|
|
5
|
+
* Compound Component
|
|
6
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
7
|
+
const Checkbox = Object.assign(CheckboxRoot, {
|
|
8
|
+
Root: CheckboxRoot,
|
|
9
|
+
Control: CheckboxControl,
|
|
10
|
+
Indicator: CheckboxIndicator,
|
|
11
|
+
Content: CheckboxContent
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { Checkbox, CheckboxContent, CheckboxControl, CheckboxIndicator, CheckboxRoot };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CheckboxVariants } from "../checkbox";
|
|
2
|
+
import type { CheckboxGroupVariants } from "@arobo/styles";
|
|
3
|
+
import type { ComponentPropsWithRef } from "react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { CheckboxGroup as CheckboxGroupPrimitive } from "react-aria-components";
|
|
6
|
+
interface CheckboxGroupContext {
|
|
7
|
+
variant?: CheckboxVariants["variant"];
|
|
8
|
+
}
|
|
9
|
+
declare const CheckboxGroupContext: React.Context<CheckboxGroupContext>;
|
|
10
|
+
interface CheckboxGroupProps extends ComponentPropsWithRef<typeof CheckboxGroupPrimitive>, CheckboxGroupVariants {
|
|
11
|
+
}
|
|
12
|
+
declare const CheckboxGroup: ({ children, className, variant, ...props }: CheckboxGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { CheckboxGroup, CheckboxGroupContext };
|
|
14
|
+
export type { CheckboxGroupProps };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { createContext } from 'react';
|
|
2
|
+
import { CheckboxGroup as CheckboxGroup$1 } from 'react-aria-components';
|
|
3
|
+
import { composeTwRenderProps } from '../../utils/compose.js';
|
|
4
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
import { checkboxGroupVariants } from '../../styles/src/components/checkbox-group/checkbox-group.styles.js';
|
|
6
|
+
|
|
7
|
+
const CheckboxGroupContext = /*#__PURE__*/createContext({});
|
|
8
|
+
const CheckboxGroup = ({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
variant,
|
|
12
|
+
...props
|
|
13
|
+
}) => {
|
|
14
|
+
const styles = React.useMemo(() => checkboxGroupVariants({
|
|
15
|
+
variant
|
|
16
|
+
}), [variant]);
|
|
17
|
+
return /*#__PURE__*/jsx(CheckboxGroupContext.Provider, {
|
|
18
|
+
value: {
|
|
19
|
+
variant
|
|
20
|
+
},
|
|
21
|
+
children: /*#__PURE__*/jsx(CheckboxGroup$1, {
|
|
22
|
+
className: composeTwRenderProps(className, styles),
|
|
23
|
+
"data-slot": "checkbox-group",
|
|
24
|
+
...props,
|
|
25
|
+
children: values => /*#__PURE__*/jsx(Fragment, {
|
|
26
|
+
children: typeof children === "function" ? children(values) : children
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { CheckboxGroup, CheckboxGroupContext };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CloseButtonVariants } from "@arobo/styles";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import { Button as ButtonPrimitive } from "react-aria-components";
|
|
4
|
+
interface CloseButtonRootProps extends ComponentPropsWithRef<typeof ButtonPrimitive>, CloseButtonVariants {
|
|
5
|
+
}
|
|
6
|
+
declare const CloseButtonRoot: ({ children, className, slot, style, variant, ...rest }: CloseButtonRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { CloseButtonRoot };
|
|
8
|
+
export type { CloseButtonRootProps };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { Button } from 'react-aria-components';
|
|
3
|
+
import { CloseIcon } from '../icons.js';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { closeButtonVariants } from '../../styles/src/components/close-button/close-button.styles.js';
|
|
6
|
+
import { composeTwRenderProps } from '../../utils/compose.js';
|
|
7
|
+
|
|
8
|
+
const CloseButtonRoot = ({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
slot,
|
|
12
|
+
style,
|
|
13
|
+
variant,
|
|
14
|
+
...rest
|
|
15
|
+
}) => {
|
|
16
|
+
const styles = useMemo(() => closeButtonVariants({
|
|
17
|
+
variant
|
|
18
|
+
}), [variant]);
|
|
19
|
+
return /*#__PURE__*/jsx(Button, {
|
|
20
|
+
"aria-label": "Close",
|
|
21
|
+
className: composeTwRenderProps(className, styles),
|
|
22
|
+
"data-slot": "close-button",
|
|
23
|
+
slot: slot,
|
|
24
|
+
style: style,
|
|
25
|
+
...rest,
|
|
26
|
+
children: renderProps => typeof children === "function" ? children(renderProps) : children ?? /*#__PURE__*/jsx(CloseIcon, {
|
|
27
|
+
"data-slot": "close-button-icon"
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { CloseButtonRoot };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { CloseButtonRoot } from "./close-button";
|
|
3
|
+
export declare const CloseButton: (({ children, className, slot, style, variant, ...rest }: import("./close-button").CloseButtonRootProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Root: ({ children, className, slot, style, variant, ...rest }: import("./close-button").CloseButtonRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
};
|
|
6
|
+
export type CloseButton = {
|
|
7
|
+
Props: ComponentProps<typeof CloseButtonRoot>;
|
|
8
|
+
RootProps: ComponentProps<typeof CloseButtonRoot>;
|
|
9
|
+
};
|
|
10
|
+
export { CloseButtonRoot };
|
|
11
|
+
export type { CloseButtonRootProps, CloseButtonRootProps as CloseButtonProps, } from "./close-button";
|
|
12
|
+
export { closeButtonVariants } from "@arobo/styles";
|
|
13
|
+
export type { CloseButtonVariants } from "@arobo/styles";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CloseButtonRoot } from './close-button.js';
|
|
2
|
+
export { closeButtonVariants } from '../../styles/src/components/close-button/close-button.styles.js';
|
|
3
|
+
|
|
4
|
+
/* -------------------------------------------------------------------------------------------------
|
|
5
|
+
* Compound Component
|
|
6
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
7
|
+
const CloseButton = Object.assign(CloseButtonRoot, {
|
|
8
|
+
Root: CloseButtonRoot
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { CloseButton, CloseButtonRoot };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComboBoxVariants } from "@arobo/styles";
|
|
2
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
import type { ButtonProps } from "react-aria-components";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { ComboBox as ComboBoxPrimitive, Popover as PopoverPrimitive } from "react-aria-components";
|
|
6
|
+
interface ComboBoxRootProps<T extends object> extends ComponentPropsWithRef<typeof ComboBoxPrimitive<T>>, ComboBoxVariants {
|
|
7
|
+
items?: Iterable<T>;
|
|
8
|
+
}
|
|
9
|
+
declare const ComboBoxRoot: <T extends object = object>({ children, className, fullWidth, menuTrigger, ...props }: ComboBoxRootProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
interface ComboBoxInputGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
}
|
|
12
|
+
declare const ComboBoxInputGroup: ({ children, className, ...props }: ComboBoxInputGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
interface ComboBoxTriggerProps extends ButtonProps {
|
|
14
|
+
className?: string;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
declare const ComboBoxTrigger: ({ children, className, ...rest }: ComboBoxTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
interface ComboBoxPopoverProps extends Omit<ComponentPropsWithRef<typeof PopoverPrimitive>, "children"> {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
declare const ComboBoxPopover: ({ children, className, placement, ...props }: ComboBoxPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export { ComboBoxRoot, ComboBoxInputGroup, ComboBoxTrigger, ComboBoxPopover };
|
|
23
|
+
export type { ComboBoxRootProps, ComboBoxInputGroupProps, ComboBoxTriggerProps, ComboBoxPopoverProps, };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
import { ComboBox, Popover, ComboBoxStateContext, Button } from 'react-aria-components';
|
|
3
|
+
import { dataAttr } from '../../utils/assertion.js';
|
|
4
|
+
import { composeTwRenderProps, composeSlotClassName } from '../../utils/compose.js';
|
|
5
|
+
import { IconChevronDown } from '../icons.js';
|
|
6
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
import { comboboxVariants } from '../../styles/src/components/combobox/combobox.styles.js';
|
|
8
|
+
import { SurfaceContext } from '../surface/surface.js';
|
|
9
|
+
|
|
10
|
+
const ComboBoxContext = /*#__PURE__*/createContext({});
|
|
11
|
+
|
|
12
|
+
/* -------------------------------------------------------------------------------------------------
|
|
13
|
+
* ComboBox Root
|
|
14
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
15
|
+
|
|
16
|
+
const ComboBoxRoot = ({
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
fullWidth,
|
|
20
|
+
menuTrigger = "focus",
|
|
21
|
+
...props
|
|
22
|
+
}) => {
|
|
23
|
+
const slots = React.useMemo(() => comboboxVariants({
|
|
24
|
+
fullWidth
|
|
25
|
+
}), [fullWidth]);
|
|
26
|
+
return /*#__PURE__*/jsx(ComboBoxContext, {
|
|
27
|
+
value: {
|
|
28
|
+
slots
|
|
29
|
+
},
|
|
30
|
+
children: /*#__PURE__*/jsx(ComboBox, {
|
|
31
|
+
"data-slot": "combobox",
|
|
32
|
+
menuTrigger: menuTrigger,
|
|
33
|
+
...props,
|
|
34
|
+
className: composeTwRenderProps(className, slots?.base()),
|
|
35
|
+
children: values => /*#__PURE__*/jsx(Fragment, {
|
|
36
|
+
children: typeof children === "function" ? children(values) : children
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/* -------------------------------------------------------------------------------------------------
|
|
43
|
+
* ComboBox InputGroup
|
|
44
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
45
|
+
|
|
46
|
+
const ComboBoxInputGroup = ({
|
|
47
|
+
children,
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}) => {
|
|
51
|
+
const {
|
|
52
|
+
slots
|
|
53
|
+
} = useContext(ComboBoxContext);
|
|
54
|
+
const inputGroupClassName = composeSlotClassName(slots?.inputGroup, className);
|
|
55
|
+
return /*#__PURE__*/jsx("div", {
|
|
56
|
+
className: inputGroupClassName,
|
|
57
|
+
"data-slot": "combobox-input-group",
|
|
58
|
+
...props,
|
|
59
|
+
children: children
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/* -------------------------------------------------------------------------------------------------
|
|
64
|
+
* ComboBox Trigger
|
|
65
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
66
|
+
|
|
67
|
+
const ComboBoxTrigger = ({
|
|
68
|
+
children,
|
|
69
|
+
className,
|
|
70
|
+
...rest
|
|
71
|
+
}) => {
|
|
72
|
+
const {
|
|
73
|
+
slots
|
|
74
|
+
} = useContext(ComboBoxContext);
|
|
75
|
+
const state = useContext(ComboBoxStateContext);
|
|
76
|
+
return /*#__PURE__*/jsx(Button, {
|
|
77
|
+
className: composeTwRenderProps(className, slots?.trigger()),
|
|
78
|
+
"data-open": dataAttr(state?.isOpen),
|
|
79
|
+
"data-slot": "combobox-trigger",
|
|
80
|
+
...rest,
|
|
81
|
+
children: children ?? /*#__PURE__*/jsx(IconChevronDown, {
|
|
82
|
+
"data-slot": "combobox-trigger-default-icon"
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/* -------------------------------------------------------------------------------------------------
|
|
88
|
+
* ComboBox Popover
|
|
89
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
90
|
+
|
|
91
|
+
const ComboBoxPopover = ({
|
|
92
|
+
children,
|
|
93
|
+
className,
|
|
94
|
+
placement = "bottom",
|
|
95
|
+
...props
|
|
96
|
+
}) => {
|
|
97
|
+
const {
|
|
98
|
+
slots
|
|
99
|
+
} = useContext(ComboBoxContext);
|
|
100
|
+
return /*#__PURE__*/jsx(SurfaceContext, {
|
|
101
|
+
value: {
|
|
102
|
+
variant: "default"
|
|
103
|
+
},
|
|
104
|
+
children: /*#__PURE__*/jsx(Popover, {
|
|
105
|
+
...props,
|
|
106
|
+
className: composeTwRenderProps(className, slots?.popover()),
|
|
107
|
+
placement: placement,
|
|
108
|
+
children: children
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export { ComboBoxInputGroup, ComboBoxPopover, ComboBoxRoot, ComboBoxTrigger };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { ComboBoxInputGroup, ComboBoxPopover, ComboBoxRoot, ComboBoxTrigger } from "./combobox";
|
|
3
|
+
export declare const ComboBox: (<T extends object = object>({ children, className, fullWidth, menuTrigger, ...props }: import("./combobox").ComboBoxRootProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
+
Root: <T extends object = object>({ children, className, fullWidth, menuTrigger, ...props }: import("./combobox").ComboBoxRootProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
InputGroup: ({ children, className, ...props }: import("./combobox").ComboBoxInputGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Trigger: ({ children, className, ...rest }: import("./combobox").ComboBoxTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Popover: ({ children, className, placement, ...props }: import("./combobox").ComboBoxPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export type ComboBox<T extends object = object> = {
|
|
10
|
+
Props: ComponentProps<typeof ComboBoxRoot<T>>;
|
|
11
|
+
RootProps: ComponentProps<typeof ComboBoxRoot<T>>;
|
|
12
|
+
InputGroupProps: ComponentProps<typeof ComboBoxInputGroup>;
|
|
13
|
+
TriggerProps: ComponentProps<typeof ComboBoxTrigger>;
|
|
14
|
+
PopoverProps: ComponentProps<typeof ComboBoxPopover>;
|
|
15
|
+
};
|
|
16
|
+
export { ComboBoxInputGroup, ComboBoxPopover, ComboBoxRoot, ComboBoxTrigger };
|
|
17
|
+
export type { ComboBoxRootProps, ComboBoxRootProps as ComboBoxProps, ComboBoxInputGroupProps, ComboBoxTriggerProps, ComboBoxPopoverProps, } from "./combobox";
|
|
18
|
+
export { comboboxVariants } from "@arobo/styles";
|
|
19
|
+
export type { ComboBoxVariants } from "@arobo/styles";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComboBoxRoot, ComboBoxPopover, ComboBoxTrigger, ComboBoxInputGroup } from './combobox.js';
|
|
2
|
+
export { comboboxVariants } from '../../styles/src/components/combobox/combobox.styles.js';
|
|
3
|
+
|
|
4
|
+
/* -------------------------------------------------------------------------------------------------
|
|
5
|
+
* Compound Component
|
|
6
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
7
|
+
const ComboBox = Object.assign(ComboBoxRoot, {
|
|
8
|
+
Root: ComboBoxRoot,
|
|
9
|
+
InputGroup: ComboBoxInputGroup,
|
|
10
|
+
Trigger: ComboBoxTrigger,
|
|
11
|
+
Popover: ComboBoxPopover
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { ComboBox, ComboBoxInputGroup, ComboBoxPopover, ComboBoxRoot, ComboBoxTrigger };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DateFieldVariants } from "@arobo/styles";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import type { DateValue } from "react-aria-components";
|
|
4
|
+
import { DateField as DateFieldPrimitive } from "react-aria-components";
|
|
5
|
+
interface DateFieldRootProps<T extends DateValue> extends ComponentPropsWithRef<typeof DateFieldPrimitive<T>>, DateFieldVariants {
|
|
6
|
+
}
|
|
7
|
+
declare function DateFieldRoot<T extends DateValue>({ children, className, fullWidth, ...props }: DateFieldRootProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export { DateFieldRoot };
|
|
9
|
+
export type { DateFieldRootProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DateField } from 'react-aria-components';
|
|
3
|
+
import { dataAttr } from '../../utils/assertion.js';
|
|
4
|
+
import { composeTwRenderProps } from '../../utils/compose.js';
|
|
5
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
import { dateFieldVariants } from '../../styles/src/components/date-field/date-field.styles.js';
|
|
7
|
+
|
|
8
|
+
function DateFieldRoot({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
fullWidth,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
14
|
+
const styles = React.useMemo(() => dateFieldVariants({
|
|
15
|
+
fullWidth
|
|
16
|
+
}), [fullWidth]);
|
|
17
|
+
return /*#__PURE__*/jsx(DateField, {
|
|
18
|
+
"data-required": dataAttr(props.isRequired),
|
|
19
|
+
"data-slot": "date-field",
|
|
20
|
+
...props,
|
|
21
|
+
className: composeTwRenderProps(className, styles),
|
|
22
|
+
children: values => /*#__PURE__*/jsx(Fragment, {
|
|
23
|
+
children: typeof children === "function" ? children(values) : children
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { DateFieldRoot };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { DateFieldRoot } from "./date-field";
|
|
3
|
+
export declare const DateField: typeof DateFieldRoot & {
|
|
4
|
+
Root: typeof DateFieldRoot;
|
|
5
|
+
};
|
|
6
|
+
export type DateField = {
|
|
7
|
+
Props: ComponentProps<typeof DateFieldRoot>;
|
|
8
|
+
RootProps: ComponentProps<typeof DateFieldRoot>;
|
|
9
|
+
};
|
|
10
|
+
export { DateFieldRoot };
|
|
11
|
+
export type { DateFieldRootProps, DateFieldRootProps as DateFieldProps, } from "./date-field";
|
|
12
|
+
export { dateFieldVariants } from "@arobo/styles";
|
|
13
|
+
export type { DateFieldVariants } from "@arobo/styles";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DateFieldRoot } from './date-field.js';
|
|
2
|
+
export { dateFieldVariants } from '../../styles/src/components/date-field/date-field.styles.js';
|
|
3
|
+
|
|
4
|
+
/* -------------------------------------------------------------------------------------------------
|
|
5
|
+
* Compound Component
|
|
6
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
7
|
+
const DateField = Object.assign(DateFieldRoot, {
|
|
8
|
+
Root: DateFieldRoot
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { DateField, DateFieldRoot };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DateInputGroupVariants } from "@arobo/styles";
|
|
2
|
+
import type { ComponentPropsWithRef } from "react";
|
|
3
|
+
import type { DateInputProps as DateInputPrimitiveProps, DateSegmentProps as DateSegmentPrimitiveProps, DateInputProps as TimeInputPrimitiveProps, DateSegmentProps as TimeSegmentPrimitiveProps } from "react-aria-components";
|
|
4
|
+
import { DateInput as DateInputPrimitive, Group as GroupPrimitive } from "react-aria-components";
|
|
5
|
+
interface DateInputGroupRootProps extends ComponentPropsWithRef<typeof GroupPrimitive>, DateInputGroupVariants {
|
|
6
|
+
}
|
|
7
|
+
declare const DateInputGroupRoot: ({ children, className, fullWidth, ...props }: DateInputGroupRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
interface DateInputGroupPrefixProps extends ComponentPropsWithRef<"div"> {
|
|
9
|
+
}
|
|
10
|
+
declare const DateInputGroupPrefix: ({ children, className, ...props }: DateInputGroupPrefixProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
interface DateInputGroupInputProps extends DateInputPrimitiveProps, Partial<Omit<TimeInputPrimitiveProps, keyof DateInputPrimitiveProps>> {
|
|
12
|
+
}
|
|
13
|
+
declare const DateInputGroupInput: ({ className, ...props }: DateInputGroupInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
interface DateInputGroupSegmentProps extends DateSegmentPrimitiveProps, Partial<Omit<TimeSegmentPrimitiveProps, keyof DateSegmentPrimitiveProps>> {
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const DateInputGroupSegment: ({ className, segment, ...props }: DateInputGroupSegmentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
interface DateInputGroupInputCompoundProps extends Omit<ComponentPropsWithRef<typeof DateInputPrimitive>, "children"> {
|
|
19
|
+
}
|
|
20
|
+
declare const DateInputGroupInputCompound: ({ className, ...props }: DateInputGroupInputCompoundProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
interface DateInputGroupSuffixProps extends ComponentPropsWithRef<"div"> {
|
|
22
|
+
}
|
|
23
|
+
declare const DateInputGroupSuffix: ({ children, className, ...props }: DateInputGroupSuffixProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export { DateInputGroupRoot, DateInputGroupInput, DateInputGroupSegment, DateInputGroupPrefix, DateInputGroupSuffix, DateInputGroupInputCompound, };
|
|
25
|
+
export type { DateInputGroupRootProps, DateInputGroupInputProps, DateInputGroupSegmentProps, DateInputGroupPrefixProps, DateInputGroupSuffixProps, DateInputGroupInputCompoundProps, };
|