@particle-network/ui-react 0.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 +23 -0
- package/dist/components/ProgressWrapper/index.d.ts +34 -0
- package/dist/components/ProgressWrapper/index.js +102 -0
- package/dist/components/UXButton/button-group-context.d.ts +2 -0
- package/dist/components/UXButton/button-group-context.js +6 -0
- package/dist/components/UXButton/button-group.d.ts +4 -0
- package/dist/components/UXButton/button-group.js +22 -0
- package/dist/components/UXButton/button-theme.d.ts +236 -0
- package/dist/components/UXButton/button-theme.js +626 -0
- package/dist/components/UXButton/button.d.ts +4 -0
- package/dist/components/UXButton/button.js +31 -0
- package/dist/components/UXButton/index.d.ts +8 -0
- package/dist/components/UXButton/index.js +6 -0
- package/dist/components/UXButton/use-button-group.d.ts +37 -0
- package/dist/components/UXButton/use-button-group.js +55 -0
- package/dist/components/UXButton/use-button.d.ts +65 -0
- package/dist/components/UXButton/use-button.js +136 -0
- package/dist/components/UXCheckbox/checkbox.extend.d.ts +7 -0
- package/dist/components/UXCheckbox/checkbox.extend.js +151 -0
- package/dist/components/UXCheckbox/checkbox.icon.d.ts +6 -0
- package/dist/components/UXCheckbox/checkbox.icon.js +46 -0
- package/dist/components/UXCheckbox/index.d.ts +10 -0
- package/dist/components/UXCheckbox/index.js +17 -0
- package/dist/components/UXChip/chip.extend.d.ts +299 -0
- package/dist/components/UXChip/chip.extend.js +236 -0
- package/dist/components/UXChip/index.d.ts +302 -0
- package/dist/components/UXChip/index.js +10 -0
- package/dist/components/UXDivider/divider.extend.d.ts +286 -0
- package/dist/components/UXDivider/divider.extend.js +15 -0
- package/dist/components/UXDivider/index.d.ts +4 -0
- package/dist/components/UXDivider/index.js +10 -0
- package/dist/components/UXDropdown/dropdown-item.d.ts +3 -0
- package/dist/components/UXDropdown/dropdown-item.js +306 -0
- package/dist/components/UXDropdown/dropdown-menu.d.ts +3 -0
- package/dist/components/UXDropdown/dropdown-menu.js +25 -0
- package/dist/components/UXDropdown/dropdown-section.d.ts +1 -0
- package/dist/components/UXDropdown/dropdown-section.js +2 -0
- package/dist/components/UXDropdown/dropdown.d.ts +4 -0
- package/dist/components/UXDropdown/dropdown.js +21 -0
- package/dist/components/UXDropdown/index.d.ts +6 -0
- package/dist/components/UXDropdown/index.js +6 -0
- package/dist/components/UXHint/index.d.ts +8 -0
- package/dist/components/UXHint/index.js +22 -0
- package/dist/components/UXInput/index.d.ts +346 -0
- package/dist/components/UXInput/index.js +10 -0
- package/dist/components/UXInput/input.extend.d.ts +343 -0
- package/dist/components/UXInput/input.extend.js +6 -0
- package/dist/components/UXModal/index.d.ts +10 -0
- package/dist/components/UXModal/index.js +89 -0
- package/dist/components/UXNumberInput/index.d.ts +5 -0
- package/dist/components/UXNumberInput/index.js +10 -0
- package/dist/components/UXNumberInput/number-input.extend.d.ts +8 -0
- package/dist/components/UXNumberInput/number-input.extend.js +6 -0
- package/dist/components/UXPopover/index.d.ts +6 -0
- package/dist/components/UXPopover/index.js +10 -0
- package/dist/components/UXPopover/popover.extend.d.ts +7 -0
- package/dist/components/UXPopover/popover.extend.js +26 -0
- package/dist/components/UXRadio/index.d.ts +10 -0
- package/dist/components/UXRadio/index.js +12 -0
- package/dist/components/UXRadio/radio.extend.d.ts +7 -0
- package/dist/components/UXRadio/radio.extend.js +97 -0
- package/dist/components/UXSelect/index.d.ts +6 -0
- package/dist/components/UXSelect/index.js +51 -0
- package/dist/components/UXSwitch/index.d.ts +331 -0
- package/dist/components/UXSwitch/index.js +10 -0
- package/dist/components/UXSwitch/switch.extend.d.ts +328 -0
- package/dist/components/UXSwitch/switch.extend.js +117 -0
- package/dist/components/UXTabs/index.d.ts +9 -0
- package/dist/components/UXTabs/index.js +11 -0
- package/dist/components/UXTabs/tabs.classes.d.ts +210 -0
- package/dist/components/UXTabs/tabs.classes.js +530 -0
- package/dist/components/UXTabs/tabs.extend.d.ts +8 -0
- package/dist/components/UXTabs/tabs.extend.js +6 -0
- package/dist/components/UXTooltip/index.d.ts +5 -0
- package/dist/components/UXTooltip/index.js +23 -0
- package/dist/components/UXTooltip/tooltip.extend.d.ts +314 -0
- package/dist/components/UXTooltip/tooltip.extend.js +27 -0
- package/dist/components/index.d.ts +44 -0
- package/dist/components/index.js +31 -0
- package/dist/components/layout/Center.d.ts +4 -0
- package/dist/components/layout/Center.js +11 -0
- package/dist/components/layout/Circle.d.ts +6 -0
- package/dist/components/layout/Circle.js +12 -0
- package/dist/components/layout/Flex.d.ts +29 -0
- package/dist/components/layout/Flex.js +24 -0
- package/dist/components/layout/HStack.d.ts +4 -0
- package/dist/components/layout/HStack.js +12 -0
- package/dist/components/layout/Square.d.ts +8 -0
- package/dist/components/layout/Square.js +13 -0
- package/dist/components/layout/VStack.d.ts +4 -0
- package/dist/components/layout/VStack.js +12 -0
- package/dist/components/typography/Text.d.ts +3 -0
- package/dist/components/typography/Text.js +12 -0
- package/dist/components/typography/Text.type.d.ts +103 -0
- package/dist/components/typography/Text.type.js +47 -0
- package/dist/icons/index.d.ts +6 -0
- package/dist/icons/index.js +58 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/utils/classes.d.ts +35 -0
- package/dist/utils/classes.js +87 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/input-classes.d.ts +427 -0
- package/dist/utils/input-classes.js +568 -0
- package/dist/utils/variants.d.ts +91 -0
- package/dist/utils/variants.js +100 -0
- package/package.json +42 -0
- package/tailwind-preset.js +298 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactRef } from '@heroui/react-utils';
|
|
2
|
+
import { type HTMLHeroUIProps, type PropGetter } from '@heroui/system';
|
|
3
|
+
import type { ButtonProps } from './button';
|
|
4
|
+
import { type ButtonGroupVariantProps } from './button-theme';
|
|
5
|
+
interface Props extends HTMLHeroUIProps, ButtonGroupVariantProps {
|
|
6
|
+
/**
|
|
7
|
+
* Ref to the DOM node.
|
|
8
|
+
*/
|
|
9
|
+
ref?: ReactRef<HTMLDivElement | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the buttons are disabled.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
isDisabled?: ButtonProps['isDisabled'];
|
|
15
|
+
}
|
|
16
|
+
export interface ContextType {
|
|
17
|
+
size?: ButtonProps['size'];
|
|
18
|
+
color?: ButtonProps['color'];
|
|
19
|
+
variant?: ButtonProps['variant'];
|
|
20
|
+
radius?: ButtonProps['radius'];
|
|
21
|
+
isDisabled?: ButtonProps['isDisabled'];
|
|
22
|
+
disableAnimation?: ButtonProps['disableAnimation'];
|
|
23
|
+
disableRipple?: ButtonProps['disableRipple'];
|
|
24
|
+
isIconOnly?: ButtonProps['isIconOnly'];
|
|
25
|
+
fullWidth?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export type UseButtonGroupProps = Props & Partial<Pick<ButtonProps, 'size' | 'color' | 'radius' | 'variant' | 'isIconOnly' | 'disableAnimation' | 'disableRipple'>>;
|
|
28
|
+
export declare function useButtonGroup(originalProps: UseButtonGroupProps): {
|
|
29
|
+
Component: import("@heroui/system-rsc").As<any>;
|
|
30
|
+
children: import("react").ReactNode;
|
|
31
|
+
domRef: import("react").RefObject<HTMLDivElement>;
|
|
32
|
+
context: ContextType;
|
|
33
|
+
classNames: string;
|
|
34
|
+
getButtonGroupProps: PropGetter;
|
|
35
|
+
};
|
|
36
|
+
export type UseButtonGroupReturn = ReturnType<typeof useButtonGroup>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
import { useDOMRef } from "@heroui/react-utils";
|
|
3
|
+
import { objectToDeps } from "@heroui/shared-utils";
|
|
4
|
+
import { mapPropsVariants, useProviderContext } from "@heroui/system";
|
|
5
|
+
import { buttonGroup } from "./button-theme.js";
|
|
6
|
+
function useButtonGroup(originalProps) {
|
|
7
|
+
const globalContext = useProviderContext();
|
|
8
|
+
const [props, variantProps] = mapPropsVariants(originalProps, buttonGroup.variantKeys);
|
|
9
|
+
const { ref, as, children, color = 'default', size = 'md', variant = 'solid', radius, isDisabled = false, isIconOnly = false, disableRipple = globalContext?.disableRipple ?? false, disableAnimation = globalContext?.disableAnimation ?? false, className, ...otherProps } = props;
|
|
10
|
+
const Component = as || 'div';
|
|
11
|
+
const domRef = useDOMRef(ref);
|
|
12
|
+
const classNames = useMemo(()=>buttonGroup({
|
|
13
|
+
...variantProps,
|
|
14
|
+
className
|
|
15
|
+
}), [
|
|
16
|
+
objectToDeps(variantProps),
|
|
17
|
+
className
|
|
18
|
+
]);
|
|
19
|
+
const context = useMemo(()=>({
|
|
20
|
+
size,
|
|
21
|
+
color,
|
|
22
|
+
variant,
|
|
23
|
+
radius,
|
|
24
|
+
isIconOnly,
|
|
25
|
+
isDisabled,
|
|
26
|
+
disableAnimation,
|
|
27
|
+
disableRipple,
|
|
28
|
+
fullWidth: !!originalProps?.fullWidth
|
|
29
|
+
}), [
|
|
30
|
+
size,
|
|
31
|
+
color,
|
|
32
|
+
variant,
|
|
33
|
+
radius,
|
|
34
|
+
isDisabled,
|
|
35
|
+
isIconOnly,
|
|
36
|
+
disableAnimation,
|
|
37
|
+
disableRipple,
|
|
38
|
+
originalProps?.fullWidth
|
|
39
|
+
]);
|
|
40
|
+
const getButtonGroupProps = useCallback(()=>({
|
|
41
|
+
role: 'group',
|
|
42
|
+
...otherProps
|
|
43
|
+
}), [
|
|
44
|
+
otherProps
|
|
45
|
+
]);
|
|
46
|
+
return {
|
|
47
|
+
Component,
|
|
48
|
+
children,
|
|
49
|
+
domRef,
|
|
50
|
+
context,
|
|
51
|
+
classNames,
|
|
52
|
+
getButtonGroupProps
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export { useButtonGroup };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
import type { ReactRef } from '@heroui/react-utils';
|
|
3
|
+
import type { RippleProps } from '@heroui/ripple';
|
|
4
|
+
import type { HTMLHeroUIProps, PropGetter } from '@heroui/system';
|
|
5
|
+
import type { AriaButtonProps } from '@heroui/use-aria-button';
|
|
6
|
+
import type { ButtonVariantProps } from './button-theme';
|
|
7
|
+
interface Props extends HTMLHeroUIProps<'button'> {
|
|
8
|
+
/**
|
|
9
|
+
* Ref to the DOM node.
|
|
10
|
+
*/
|
|
11
|
+
ref?: ReactRef<HTMLButtonElement | null>;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the button should display a ripple effect on press.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
disableRipple?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The button start content.
|
|
19
|
+
*/
|
|
20
|
+
startContent?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* The button end content.
|
|
23
|
+
*/
|
|
24
|
+
endContent?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Spinner to display when loading.
|
|
27
|
+
* @see https://heroui.com/components/spinner
|
|
28
|
+
*/
|
|
29
|
+
spinner?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* The spinner placement.
|
|
32
|
+
* @default "start"
|
|
33
|
+
*/
|
|
34
|
+
spinnerPlacement?: 'start' | 'end';
|
|
35
|
+
/**
|
|
36
|
+
* Whether the button should display a loading spinner.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
isLoading?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The native button click event handler.
|
|
42
|
+
* use `onPress` instead.
|
|
43
|
+
* @deprecated
|
|
44
|
+
*/
|
|
45
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
46
|
+
}
|
|
47
|
+
export type UseButtonProps = Props & Omit<AriaButtonProps, keyof ButtonVariantProps> & Omit<ButtonVariantProps, 'isInGroup'>;
|
|
48
|
+
export declare function useButton(props: UseButtonProps): {
|
|
49
|
+
Component: import("@heroui/system-rsc").As<any>;
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
domRef: import("react").RefObject<HTMLButtonElement>;
|
|
52
|
+
spinner: ReactNode;
|
|
53
|
+
styles: string;
|
|
54
|
+
startContent: import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<HTMLElement>, HTMLElement> | null;
|
|
55
|
+
endContent: import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<HTMLElement>, HTMLElement> | null;
|
|
56
|
+
isLoading: boolean;
|
|
57
|
+
spinnerPlacement: "start" | "end";
|
|
58
|
+
spinnerSize: "sm" | "md" | "lg" | undefined;
|
|
59
|
+
disableRipple: boolean;
|
|
60
|
+
getButtonProps: PropGetter;
|
|
61
|
+
getRippleProps: () => RippleProps;
|
|
62
|
+
isIconOnly: boolean;
|
|
63
|
+
};
|
|
64
|
+
export type UseButtonReturn = ReturnType<typeof useButton>;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { cloneElement, isValidElement, useCallback, useMemo } from "react";
|
|
2
|
+
import { filterDOMProps, useDOMRef } from "@heroui/react-utils";
|
|
3
|
+
import { useRipple } from "@heroui/ripple";
|
|
4
|
+
import { dataAttr } from "@heroui/shared-utils";
|
|
5
|
+
import { useProviderContext } from "@heroui/system";
|
|
6
|
+
import { useAriaButton } from "@heroui/use-aria-button";
|
|
7
|
+
import { useFocusRing } from "@react-aria/focus";
|
|
8
|
+
import { useHover } from "@react-aria/interactions";
|
|
9
|
+
import { chain, mergeProps } from "@react-aria/utils";
|
|
10
|
+
import { useButtonGroupContext } from "./button-group-context.js";
|
|
11
|
+
import { button as external_button_theme_js_button } from "./button-theme.js";
|
|
12
|
+
function useButton(props) {
|
|
13
|
+
const groupContext = useButtonGroupContext();
|
|
14
|
+
const globalContext = useProviderContext();
|
|
15
|
+
const isInGroup = !!groupContext;
|
|
16
|
+
const { ref, as, children, startContent: startContentProp, endContent: endContentProp, autoFocus, className, spinner, isLoading = false, isSelected = false, disableRipple: disableRippleProp = false, fullWidth = groupContext?.fullWidth ?? false, radius = groupContext?.radius, size = groupContext?.size ?? 'md', color = groupContext?.color ?? 'default', variant = groupContext?.variant ?? 'solid', disableAnimation = groupContext?.disableAnimation ?? globalContext?.disableAnimation ?? false, isDisabled: isDisabledProp = groupContext?.isDisabled ?? false, isIconOnly = groupContext?.isIconOnly ?? false, spinnerPlacement = 'start', onPress, onClick, ...otherProps } = props;
|
|
17
|
+
const Component = as || 'button';
|
|
18
|
+
const shouldFilterDOMProps = 'string' == typeof Component;
|
|
19
|
+
const domRef = useDOMRef(ref);
|
|
20
|
+
const disableRipple = (disableRippleProp || globalContext?.disableRipple) ?? disableAnimation;
|
|
21
|
+
const { isFocusVisible, isFocused, focusProps } = useFocusRing({
|
|
22
|
+
autoFocus
|
|
23
|
+
});
|
|
24
|
+
const isDisabled = isDisabledProp || isLoading;
|
|
25
|
+
const styles = useMemo(()=>external_button_theme_js_button({
|
|
26
|
+
size,
|
|
27
|
+
color,
|
|
28
|
+
variant,
|
|
29
|
+
radius,
|
|
30
|
+
fullWidth,
|
|
31
|
+
isDisabled,
|
|
32
|
+
isInGroup,
|
|
33
|
+
disableAnimation,
|
|
34
|
+
isIconOnly,
|
|
35
|
+
isSelected,
|
|
36
|
+
className
|
|
37
|
+
}), [
|
|
38
|
+
size,
|
|
39
|
+
color,
|
|
40
|
+
variant,
|
|
41
|
+
radius,
|
|
42
|
+
fullWidth,
|
|
43
|
+
isDisabled,
|
|
44
|
+
isInGroup,
|
|
45
|
+
isIconOnly,
|
|
46
|
+
disableAnimation,
|
|
47
|
+
className,
|
|
48
|
+
isSelected
|
|
49
|
+
]);
|
|
50
|
+
const { onPress: onRipplePressHandler, onClear: onClearRipple, ripples } = useRipple();
|
|
51
|
+
const handlePress = useCallback((e)=>{
|
|
52
|
+
if (disableRipple || isDisabled || disableAnimation) return;
|
|
53
|
+
if (domRef.current) onRipplePressHandler(e);
|
|
54
|
+
}, [
|
|
55
|
+
disableRipple,
|
|
56
|
+
isDisabled,
|
|
57
|
+
disableAnimation,
|
|
58
|
+
domRef,
|
|
59
|
+
onRipplePressHandler
|
|
60
|
+
]);
|
|
61
|
+
const { buttonProps: ariaButtonProps, isPressed } = useAriaButton({
|
|
62
|
+
elementType: as,
|
|
63
|
+
isDisabled,
|
|
64
|
+
onPress: chain(onPress, handlePress),
|
|
65
|
+
onClick,
|
|
66
|
+
...otherProps
|
|
67
|
+
}, domRef);
|
|
68
|
+
const { isHovered, hoverProps } = useHover({
|
|
69
|
+
isDisabled
|
|
70
|
+
});
|
|
71
|
+
const getButtonProps = useCallback((props = {})=>({
|
|
72
|
+
'data-disabled': dataAttr(isDisabled),
|
|
73
|
+
'data-focus': dataAttr(isFocused),
|
|
74
|
+
'data-pressed': dataAttr(isPressed),
|
|
75
|
+
'data-focus-visible': dataAttr(isFocusVisible),
|
|
76
|
+
'data-hover': dataAttr(isHovered),
|
|
77
|
+
'data-loading': dataAttr(isLoading),
|
|
78
|
+
...mergeProps(ariaButtonProps, focusProps, hoverProps, filterDOMProps(otherProps, {
|
|
79
|
+
enabled: shouldFilterDOMProps
|
|
80
|
+
}), filterDOMProps(props)),
|
|
81
|
+
className: styles
|
|
82
|
+
}), [
|
|
83
|
+
isLoading,
|
|
84
|
+
isDisabled,
|
|
85
|
+
isFocused,
|
|
86
|
+
isPressed,
|
|
87
|
+
shouldFilterDOMProps,
|
|
88
|
+
isFocusVisible,
|
|
89
|
+
isHovered,
|
|
90
|
+
ariaButtonProps,
|
|
91
|
+
focusProps,
|
|
92
|
+
hoverProps,
|
|
93
|
+
otherProps,
|
|
94
|
+
styles
|
|
95
|
+
]);
|
|
96
|
+
const getIconClone = (icon)=>isValidElement(icon) ? cloneElement(icon, {
|
|
97
|
+
'aria-hidden': true,
|
|
98
|
+
focusable: false
|
|
99
|
+
}) : null;
|
|
100
|
+
const startContent = getIconClone(startContentProp);
|
|
101
|
+
const endContent = getIconClone(endContentProp);
|
|
102
|
+
const spinnerSize = useMemo(()=>{
|
|
103
|
+
const buttonSpinnerSizeMap = {
|
|
104
|
+
sm: 'sm',
|
|
105
|
+
md: 'sm',
|
|
106
|
+
lg: 'md'
|
|
107
|
+
};
|
|
108
|
+
return buttonSpinnerSizeMap[size];
|
|
109
|
+
}, [
|
|
110
|
+
size
|
|
111
|
+
]);
|
|
112
|
+
const getRippleProps = useCallback(()=>({
|
|
113
|
+
ripples,
|
|
114
|
+
onClear: onClearRipple
|
|
115
|
+
}), [
|
|
116
|
+
ripples,
|
|
117
|
+
onClearRipple
|
|
118
|
+
]);
|
|
119
|
+
return {
|
|
120
|
+
Component,
|
|
121
|
+
children,
|
|
122
|
+
domRef,
|
|
123
|
+
spinner,
|
|
124
|
+
styles,
|
|
125
|
+
startContent,
|
|
126
|
+
endContent,
|
|
127
|
+
isLoading,
|
|
128
|
+
spinnerPlacement,
|
|
129
|
+
spinnerSize,
|
|
130
|
+
disableRipple,
|
|
131
|
+
getButtonProps,
|
|
132
|
+
getRippleProps,
|
|
133
|
+
isIconOnly
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export { useButton };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type CheckboxProps } from '@heroui/checkbox';
|
|
3
|
+
type ExtendedCheckboxProps = Omit<CheckboxProps, 'color'> & {
|
|
4
|
+
color?: 'primary' | 'success' | 'warning' | 'danger' | 'bullish' | 'bearish';
|
|
5
|
+
};
|
|
6
|
+
declare const ExtendedCheckbox: React.ForwardRefExoticComponent<ExtendedCheckboxProps>;
|
|
7
|
+
export default ExtendedCheckbox;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Checkbox } from "@heroui/checkbox";
|
|
2
|
+
import { extendVariants } from "@heroui/system-rsc";
|
|
3
|
+
const ExtendedCheckbox = extendVariants(Checkbox, {
|
|
4
|
+
variants: {
|
|
5
|
+
color: {
|
|
6
|
+
primary: {
|
|
7
|
+
wrapper: 'after:bg-primary after:text-primary-foreground text-primary-foreground'
|
|
8
|
+
},
|
|
9
|
+
success: {
|
|
10
|
+
wrapper: 'after:bg-success after:text-success-foreground text-success-foreground'
|
|
11
|
+
},
|
|
12
|
+
warning: {
|
|
13
|
+
wrapper: 'after:bg-warning after:text-warning-foreground text-warning-foreground'
|
|
14
|
+
},
|
|
15
|
+
danger: {
|
|
16
|
+
wrapper: 'after:bg-danger after:text-danger-foreground text-danger-foreground'
|
|
17
|
+
},
|
|
18
|
+
bullish: {
|
|
19
|
+
wrapper: 'after:bg-bullish after:text-bullish-foreground text-bullish-foreground'
|
|
20
|
+
},
|
|
21
|
+
bearish: {
|
|
22
|
+
wrapper: 'after:bg-bearish after:text-bearish-foreground text-bearish-foreground'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
sm: {
|
|
27
|
+
wrapper: [
|
|
28
|
+
'w-3.5 h-3.5 me-sm',
|
|
29
|
+
'rounded-[calc(theme(borderRadius.medium)*0.2)]',
|
|
30
|
+
'before:rounded-[calc(theme(borderRadius.medium)*0.2)] before:border-foreground-300 before:border-1.5',
|
|
31
|
+
'after:rounded-[calc(theme(borderRadius.medium)*0.2)]'
|
|
32
|
+
],
|
|
33
|
+
label: '!text-body3 font-medium',
|
|
34
|
+
icon: 'h-2.5'
|
|
35
|
+
},
|
|
36
|
+
md: {
|
|
37
|
+
wrapper: [
|
|
38
|
+
'w-4 h-4 me-2',
|
|
39
|
+
'rounded-[calc(theme(borderRadius.medium)*0.2)]',
|
|
40
|
+
'before:rounded-[calc(theme(borderRadius.medium)*0.2)] before:border-foreground-300 before:border-2',
|
|
41
|
+
'after:rounded-[calc(theme(borderRadius.medium)*0.2)]'
|
|
42
|
+
],
|
|
43
|
+
label: '!text-body2 font-medium',
|
|
44
|
+
icon: 'h-3'
|
|
45
|
+
},
|
|
46
|
+
lg: {
|
|
47
|
+
wrapper: [
|
|
48
|
+
'w-5 h-5 me-2',
|
|
49
|
+
'rounded-[calc(theme(borderRadius.medium)*0.3)]',
|
|
50
|
+
'before:rounded-[calc(theme(borderRadius.medium)*0.3)] before:border-foreground-300 before:border-2',
|
|
51
|
+
'after:rounded-[calc(theme(borderRadius.medium)*0.3)]'
|
|
52
|
+
],
|
|
53
|
+
label: '!text-body1 font-medium',
|
|
54
|
+
icon: 'h-3.5'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
radius: {
|
|
58
|
+
none: {
|
|
59
|
+
wrapper: 'rounded-none before:rounded-none after:rounded-none'
|
|
60
|
+
},
|
|
61
|
+
sm: {
|
|
62
|
+
wrapper: [
|
|
63
|
+
'rounded-[calc(theme(borderRadius.medium)*0.5)]',
|
|
64
|
+
'before:rounded-[calc(theme(borderRadius.medium)*0.5)]',
|
|
65
|
+
'after:rounded-[calc(theme(borderRadius.medium)*0.5)]'
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
md: {
|
|
69
|
+
wrapper: [
|
|
70
|
+
'rounded-[calc(theme(borderRadius.medium)*0.6)]',
|
|
71
|
+
'before:rounded-[calc(theme(borderRadius.medium)*0.6)]',
|
|
72
|
+
'after:rounded-[calc(theme(borderRadius.medium)*0.6)]'
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
lg: {
|
|
76
|
+
wrapper: [
|
|
77
|
+
'rounded-[calc(theme(borderRadius.medium)*0.7)]',
|
|
78
|
+
'before:rounded-[calc(theme(borderRadius.medium)*0.7)]',
|
|
79
|
+
'after:rounded-[calc(theme(borderRadius.medium)*0.7)]'
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
full: {
|
|
83
|
+
wrapper: 'rounded-full before:rounded-full after:rounded-full'
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
lineThrough: {
|
|
87
|
+
true: {
|
|
88
|
+
label: [
|
|
89
|
+
'inline-flex',
|
|
90
|
+
'items-center',
|
|
91
|
+
'justify-center',
|
|
92
|
+
"before:content-['']",
|
|
93
|
+
'before:absolute',
|
|
94
|
+
'before:bg-foreground',
|
|
95
|
+
'before:w-0',
|
|
96
|
+
'before:h-0.5',
|
|
97
|
+
'group-data-[selected=true]:opacity-60',
|
|
98
|
+
'group-data-[selected=true]:before:w-full'
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
isDisabled: {
|
|
103
|
+
true: {
|
|
104
|
+
base: 'opacity-disabled pointer-events-none'
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
isInvalid: {
|
|
108
|
+
true: {
|
|
109
|
+
wrapper: 'before:border-danger',
|
|
110
|
+
label: 'text-danger'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
isRadio: {
|
|
114
|
+
true: {
|
|
115
|
+
wrapper: [
|
|
116
|
+
'group-data-[selected=true]:after:bg-transparent',
|
|
117
|
+
'group-data-[selected=true]:before:border-primary'
|
|
118
|
+
],
|
|
119
|
+
icon: 'w-2 h-2'
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
disableAnimation: {
|
|
123
|
+
true: {
|
|
124
|
+
wrapper: 'transition-none',
|
|
125
|
+
icon: 'transition-none',
|
|
126
|
+
label: 'transition-none'
|
|
127
|
+
},
|
|
128
|
+
false: {
|
|
129
|
+
wrapper: [
|
|
130
|
+
'before:transition-colors',
|
|
131
|
+
'group-data-[pressed=true]:scale-95',
|
|
132
|
+
'transition-transform',
|
|
133
|
+
'after:transition-transform-opacity',
|
|
134
|
+
'after:!ease-linear',
|
|
135
|
+
'after:!duration-200',
|
|
136
|
+
'motion-reduce:transition-none'
|
|
137
|
+
],
|
|
138
|
+
icon: 'transition-opacity motion-reduce:transition-none',
|
|
139
|
+
label: 'transition-colors-opacity before:transition-width motion-reduce:transition-none'
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
defaultVariants: {
|
|
144
|
+
color: 'primary',
|
|
145
|
+
size: 'md',
|
|
146
|
+
isDisabled: false,
|
|
147
|
+
lineThrough: false
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
const checkbox_extend = ExtendedCheckbox;
|
|
151
|
+
export { checkbox_extend as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CheckboxIconProps } from '@heroui/checkbox';
|
|
2
|
+
/**
|
|
3
|
+
* CheckboxIcon is used to visually indicate the checked or indeterminate
|
|
4
|
+
* state of a checkbox.
|
|
5
|
+
*/
|
|
6
|
+
export declare function CheckboxIcon(props: Partial<CheckboxIconProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function CheckIcon(props) {
|
|
3
|
+
const { isSelected, disableAnimation, ...otherProps } = props;
|
|
4
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
5
|
+
"aria-hidden": "true",
|
|
6
|
+
fill: "none",
|
|
7
|
+
role: "presentation",
|
|
8
|
+
stroke: "currentColor",
|
|
9
|
+
strokeDasharray: 22,
|
|
10
|
+
strokeDashoffset: isSelected ? 44 : 66,
|
|
11
|
+
strokeLinecap: "round",
|
|
12
|
+
strokeLinejoin: "round",
|
|
13
|
+
strokeWidth: 3,
|
|
14
|
+
style: !disableAnimation && isSelected ? {
|
|
15
|
+
transition: 'stroke-dashoffset 250ms linear 0.2s'
|
|
16
|
+
} : {},
|
|
17
|
+
viewBox: "0 0 17 18",
|
|
18
|
+
...otherProps,
|
|
19
|
+
children: /*#__PURE__*/ jsx("polyline", {
|
|
20
|
+
points: "1 9 7 14 15 4"
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function IndeterminateIcon(props) {
|
|
25
|
+
const { isSelected, disableAnimation, ...otherProps } = props;
|
|
26
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
27
|
+
stroke: "currentColor",
|
|
28
|
+
strokeWidth: 3,
|
|
29
|
+
viewBox: "0 0 24 24",
|
|
30
|
+
...otherProps,
|
|
31
|
+
children: /*#__PURE__*/ jsx("line", {
|
|
32
|
+
x1: "21",
|
|
33
|
+
x2: "3",
|
|
34
|
+
y1: "12",
|
|
35
|
+
y2: "12"
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function CheckboxIcon(props) {
|
|
40
|
+
const { isIndeterminate, ...otherProps } = props;
|
|
41
|
+
const BaseIcon = isIndeterminate ? IndeterminateIcon : CheckIcon;
|
|
42
|
+
return /*#__PURE__*/ jsx(BaseIcon, {
|
|
43
|
+
...otherProps
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export { CheckboxIcon };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type CheckboxGroupProps } from '@heroui/checkbox';
|
|
3
|
+
import ExtendedCheckbox from './checkbox.extend';
|
|
4
|
+
export type UXCheckboxProps = React.ComponentPropsWithRef<typeof ExtendedCheckbox>;
|
|
5
|
+
declare const UXCheckbox: React.ForwardRefExoticComponent<Omit<Omit<import("@heroui/checkbox").CheckboxProps, "color"> & {
|
|
6
|
+
color?: "primary" | "success" | "warning" | "danger" | "bullish" | "bearish";
|
|
7
|
+
}, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
8
|
+
export default UXCheckbox;
|
|
9
|
+
export declare const UXCheckboxGroup: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"div", CheckboxGroupProps, never>;
|
|
10
|
+
export type UXCheckboxGroupProps = CheckboxGroupProps;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { CheckboxGroup } from "@heroui/checkbox";
|
|
4
|
+
import checkbox_extend from "./checkbox.extend.js";
|
|
5
|
+
import { CheckboxIcon } from "./checkbox.icon.js";
|
|
6
|
+
const UXCheckbox = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
7
|
+
const { icon = /*#__PURE__*/ jsx(CheckboxIcon, {}), ...otherProps } = props;
|
|
8
|
+
return /*#__PURE__*/ jsx(checkbox_extend, {
|
|
9
|
+
ref: ref,
|
|
10
|
+
icon: icon,
|
|
11
|
+
...otherProps
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
UXCheckbox.displayName = 'UX.Checkbox';
|
|
15
|
+
const components_UXCheckbox = UXCheckbox;
|
|
16
|
+
const UXCheckboxGroup = CheckboxGroup;
|
|
17
|
+
export { UXCheckboxGroup, components_UXCheckbox as default };
|