x-ui-design 0.2.55 → 0.2.56

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.
@@ -1,23 +1,30 @@
1
- import { prefixClsCheckbox } from '@/utils';
2
- import { CheckboxProps } from '../../types/checkbox';
3
- import React, { Dispatch, ForwardedRef, forwardRef, MouseEvent, ReactElement, SetStateAction } from 'react';
4
- import { clsx } from '../../helpers';
5
- import { SyntheticBaseEvent } from '../../types';
1
+ 'use client';
6
2
 
3
+ import {
4
+ ForwardedRef,
5
+ forwardRef,
6
+ MouseEvent,
7
+ ReactElement,
8
+ useEffect,
9
+ useState
10
+ } from 'react';
11
+ import { clsx } from '../../../lib/helpers';
12
+ import { SyntheticBaseEvent } from '../../types';
13
+ import { CheckboxProps } from '../../types/checkbox';
14
+ import { prefixClsCheckbox } from '../../../lib/utils';
7
15
  import './style.css';
8
16
 
9
- const Checkbox = forwardRef<HTMLDivElement, CheckboxProps & {
10
- internalChecked: boolean,
11
- setInternalChecked?: Dispatch<SetStateAction<boolean>>
12
- }>(
17
+ const Checkbox = forwardRef<HTMLDivElement, CheckboxProps>(
13
18
  (
14
19
  {
15
20
  prefixCls = prefixClsCheckbox,
16
21
  className = '',
22
+ defaultChecked = false,
23
+ checked,
17
24
  style,
18
25
  disabled = false,
19
- onClick,
20
26
  onChange,
27
+ onClick,
21
28
  onMouseEnter,
22
29
  onMouseLeave,
23
30
  onKeyPress,
@@ -28,35 +35,43 @@ const Checkbox = forwardRef<HTMLDivElement, CheckboxProps & {
28
35
  id,
29
36
  autoFocus,
30
37
  type = 'checkbox',
31
- internalChecked,
38
+ value = false,
32
39
  required = false,
33
- noStyle,
34
- setInternalChecked
40
+ noStyle
35
41
  },
36
42
  ref: ForwardedRef<HTMLDivElement>
37
43
  ): ReactElement => {
44
+ const isChecked = checked !== undefined ? checked : defaultChecked || value;
45
+ const [internalChecked, setInternalChecked] = useState(isChecked);
46
+
38
47
  const handleClick = (
39
- e: MouseEvent<HTMLInputElement> & SyntheticBaseEvent
40
- ) => {
41
- e.stopPropagation();
42
-
43
- if (disabled) {
44
- return;
45
- }
46
-
47
- setInternalChecked?.(!internalChecked);
48
- e.target.value = !internalChecked;
49
-
50
- onClick?.(e);
51
- onChange?.(e);
52
- };
48
+ e: MouseEvent<HTMLInputElement> & SyntheticBaseEvent
49
+ ) => {
50
+ e.stopPropagation();
51
+
52
+ if (disabled) {
53
+ return;
54
+ }
55
+
56
+ setInternalChecked(!internalChecked);
57
+ e.target.value = !internalChecked;
58
+
59
+ onClick?.(e);
60
+ onChange?.(e);
61
+ };
62
+
63
+ useEffect(() => {
64
+ if (checked !== undefined) {
65
+ setInternalChecked(checked);
66
+ }
67
+ }, [checked]);
53
68
 
54
- return (
55
- <div className={`${prefixCls}-wrapper`}>
69
+ return (
70
+ <div className={`${prefixCls}-wrapper`}>
56
71
  <div
57
72
  ref={ref}
58
73
  style={style}
59
- onClick={(e) => handleClick(e as MouseEvent<HTMLInputElement> & SyntheticBaseEvent)}
74
+ onClick={handleClick}
60
75
  className={clsx([
61
76
  prefixCls,
62
77
  className,
@@ -91,9 +106,10 @@ const Checkbox = forwardRef<HTMLDivElement, CheckboxProps & {
91
106
 
92
107
  {children && <span className={`${prefixCls}-label`}>{children}</span>}
93
108
  </div>
94
- )
95
- })
109
+ );
110
+ }
111
+ );
96
112
 
97
- Checkbox.displayName = "Checkbox";
113
+ Checkbox.displayName = 'Checkbox';
98
114
 
99
115
  export default Checkbox;
@@ -1 +1 @@
1
- export { default as Checkbox } from '@/components/Checkbox/Checkbox'
1
+ export { default as Checkbox } from './Checkbox'
@@ -0,0 +1,98 @@
1
+ import { prefixClsCheckbox } from '@/utils';
2
+ import { CheckboxProps } from '../../types/checkbox';
3
+ import React, { Dispatch, ForwardedRef, forwardRef, MouseEvent, ReactElement, SetStateAction } from 'react';
4
+ import { clsx } from '../../helpers';
5
+ import { SyntheticBaseEvent } from '../../types';
6
+ import './style.css';
7
+
8
+ const Checkbox = forwardRef<HTMLDivElement, CheckboxProps & {
9
+ internalChecked: boolean,
10
+ setInternalChecked?: Dispatch<SetStateAction<boolean>>
11
+ }>(
12
+ (
13
+ {
14
+ prefixCls = prefixClsCheckbox,
15
+ className = '',
16
+ style,
17
+ disabled = false,
18
+ onClick,
19
+ onChange,
20
+ onMouseEnter,
21
+ onMouseLeave,
22
+ onKeyPress,
23
+ onKeyDown,
24
+ tabIndex,
25
+ name,
26
+ children,
27
+ id,
28
+ autoFocus,
29
+ type = 'checkbox',
30
+ internalChecked,
31
+ required = false,
32
+ noStyle,
33
+ setInternalChecked
34
+ },
35
+ ref: ForwardedRef<HTMLDivElement>
36
+ ): ReactElement => {
37
+ const handleClick = (
38
+ e: MouseEvent<HTMLInputElement> & SyntheticBaseEvent
39
+ ) => {
40
+ e.stopPropagation();
41
+
42
+ if (disabled) {
43
+ return;
44
+ }
45
+
46
+ setInternalChecked?.(!internalChecked);
47
+ e.target.value = !internalChecked;
48
+
49
+ onClick?.(e);
50
+ onChange?.(e);
51
+ };
52
+
53
+ return (
54
+ <div className={`${prefixCls}-wrapper`}>
55
+ <div
56
+ ref={ref}
57
+ style={style}
58
+ onClick={(e) => handleClick(e as MouseEvent<HTMLInputElement> & SyntheticBaseEvent)}
59
+ className={clsx([
60
+ prefixCls,
61
+ className,
62
+ {
63
+ noStyle: noStyle,
64
+ [`${prefixCls}-disabled`]: disabled,
65
+ [`${prefixCls}-checked`]: internalChecked
66
+ }
67
+ ])}
68
+ >
69
+ <input
70
+ id={id}
71
+ type={type}
72
+ name={name}
73
+ disabled={disabled}
74
+ tabIndex={tabIndex}
75
+ required={required}
76
+ autoFocus={autoFocus}
77
+ onKeyDown={onKeyDown}
78
+ onKeyPress={onKeyPress}
79
+ onMouseEnter={onMouseEnter}
80
+ onMouseLeave={onMouseLeave}
81
+ />
82
+
83
+ <span className={`${prefixCls}-box`}>
84
+ <span
85
+ className={`${prefixCls}-check`}
86
+ style={{ opacity: Number(internalChecked) }}
87
+ />
88
+ </span>
89
+ </div>
90
+
91
+ {children && <span className={`${prefixCls}-label`}>{children}</span>}
92
+ </div>
93
+ )
94
+ })
95
+
96
+ Checkbox.displayName = "Checkbox";
97
+
98
+ export default Checkbox;
@@ -0,0 +1 @@
1
+ export { default as Checkbox } from '@/components/Checkbox copy/Checkbox'
@@ -0,0 +1,91 @@
1
+ .xUi-checkbox-wrapper {
2
+ cursor: pointer;
3
+ font-size: var(--xui-font-size-md);
4
+ align-items: center;
5
+ display: inline-flex;
6
+ color: var(--xui-main-color);
7
+ margin: 16px 0;
8
+ }
9
+
10
+ .xUi-checkbox {
11
+ width: 14px;
12
+ height: 14px;
13
+ position: relative;
14
+ border-radius: var(--xui-border-radius-sm);
15
+ transition: all 0.3s;
16
+ display: inline-block;
17
+ background-color: transparent;
18
+ border: 1px solid var(--xui-border-color);
19
+ }
20
+
21
+ .xUi-checkbox.xUi-checkbox-checked {
22
+ border-color: var(--xui-primary-color);
23
+ background-color: #f0f5ff;
24
+ }
25
+
26
+ .xUi-checkbox input {
27
+ inset: 0;
28
+ opacity: 0;
29
+ cursor: pointer;
30
+ position: absolute;
31
+ }
32
+
33
+ .xUi-checkbox-inner {
34
+ top: 50%;
35
+ left: 50%;
36
+ width: 10px;
37
+ height: 6px;
38
+ border-top: 0;
39
+ border-left: 0;
40
+ position: absolute;
41
+ border: 2px solid var(--xui-background-color);
42
+ transform: rotate(45deg) scale(0);
43
+ transition: transform 0.2s ease-in-out;
44
+ }
45
+
46
+ .xUi-checkbox-check {
47
+ width: 100%;
48
+ height: 100%;
49
+ display: block;
50
+ position: relative;
51
+ transition: 0.1s ease;
52
+ border-color: var(--xui-primary-color);
53
+ background-color: var(--xui-primary-color);
54
+ }
55
+
56
+ .xUi-checkbox-check::after {
57
+ top: 1px;
58
+ left: 3px;
59
+ width: 5px;
60
+ height: 8px;
61
+ content: "";
62
+ position: absolute;
63
+ border: solid white;
64
+ transform: rotate(45deg);
65
+ border-width: 0 2px 2px 0;
66
+ }
67
+
68
+ .xUi-checkbox-disabled,
69
+ .xUi-checkbox-disabled .xUi-checkbox-check {
70
+ opacity: 0.5;
71
+ cursor: not-allowed;
72
+ background-color: var(--xui-color-disabled);
73
+ border-color: var(--xui-border-color) !important;
74
+ }
75
+
76
+ .xUi-checkbox-label {
77
+ margin-left: 8px;
78
+ user-select: none;
79
+ font-size: 14px;
80
+ }
81
+
82
+ .xUi-checkbox:hover:not(.disabled),
83
+ .xUi-checkbox:focus:not(.disabled) {
84
+ border-color: var(--xui-primary-color);
85
+ cursor: pointer;
86
+ }
87
+
88
+ .xUi-checkbox.disabled {
89
+ opacity: 0.5;
90
+ cursor: not-allowed;
91
+ }
package/lib/index.ts CHANGED
@@ -1,6 +1,20 @@
1
1
  // Styles
2
+ import dynamic from 'next/dynamic';
2
3
  import './styles/global.css';
3
4
 
5
+ const Button = dynamic(() => import('@/components/Button/Button'), {
6
+ ssr: false,
7
+ });
8
+
9
+ const Checkbox = dynamic(() => import('@/components/Checkbox/Checkbox'), {
10
+ ssr: false,
11
+ });
12
+
13
+ export {
14
+ Button,
15
+ Checkbox
16
+ }
17
+
4
18
  // Components
5
- export { default as Button } from "@/components/Button/Button";
6
- export { default as Checkbox } from '@/components/Checkbox/Checkbox';
19
+ // export { default as Button } from "@/components/Button/Button";
20
+ // export { default as Checkbox } from '@/components/Checkbox/Checkbox';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-ui-design",
3
- "version": "0.2.55",
3
+ "version": "0.2.56",
4
4
  "license": "ISC",
5
5
  "author": "Gabriel Boyajyan",
6
6
  "main": "dist/index.js",
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { ButtonProps } from '../../types/button';
3
- declare const ButtonClient: (props: ButtonProps) => React.JSX.Element;
4
- export default ButtonClient;
@@ -1,8 +0,0 @@
1
- import { ReactElement, ReactNode } from 'react';
2
- import { ButtonProps } from '../../types/button';
3
- import './style.css';
4
- declare const Button: ({ type, variant, color, shape, size, htmlType, className, rootClassName, classNames: customClassNames, styles, prefixCls, iconPosition, disabled, ghost, danger, block, children, href, iconNode, isLoading, ...restProps }: ButtonProps & {
5
- iconNode?: ReactNode;
6
- isLoading?: boolean;
7
- }) => ReactElement;
8
- export default Button;
@@ -1 +0,0 @@
1
- export { default as Button } from './Button';
@@ -1,2 +0,0 @@
1
- import Checkbox from './Checkbox';
2
- export default Checkbox;
@@ -1,26 +0,0 @@
1
- import React, { Dispatch, MouseEvent, SetStateAction } from 'react';
2
- import './style.css';
3
- declare const Checkbox: React.ForwardRefExoticComponent<import("../../types").DefaultProps & {
4
- disabled?: boolean;
5
- onChange?: (e: MouseEvent<HTMLInputElement> & import("../../types").TargetProps) => void;
6
- onClick?: React.MouseEventHandler<HTMLElement>;
7
- onMouseEnter?: React.MouseEventHandler<HTMLElement>;
8
- onMouseLeave?: React.MouseEventHandler<HTMLElement>;
9
- onKeyPress?: React.KeyboardEventHandler<HTMLElement>;
10
- onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
11
- value?: boolean;
12
- tabIndex?: number;
13
- name?: string;
14
- children?: React.ReactNode;
15
- id?: string;
16
- autoFocus?: boolean;
17
- type?: string;
18
- skipGroup?: boolean;
19
- required?: boolean;
20
- defaultChecked?: boolean;
21
- checked?: boolean;
22
- } & {
23
- internalChecked: boolean;
24
- setInternalChecked?: Dispatch<SetStateAction<boolean>>;
25
- } & React.RefAttributes<HTMLDivElement>>;
26
- export default Checkbox;
@@ -1 +0,0 @@
1
- export { default as Checkbox } from '@/components/Checkbox/Checkbox';
@@ -1,4 +0,0 @@
1
- import { RuleType } from '../types';
2
- export declare const parseValue: (value: RuleType) => RuleType;
3
- export declare function createArray(length: number): number[];
4
- export declare function clsx(...args: RuleType[]): string;
@@ -1,3 +0,0 @@
1
- import './styles/global.css';
2
- export { default as Button } from "@/components/Button/Button";
3
- export { default as Checkbox } from '@/components/Checkbox/Checkbox';
@@ -1,42 +0,0 @@
1
- import { ButtonHTMLAttributes, CSSProperties, ReactNode } from 'react';
2
- export declare const ButtonTypes: readonly ["default", "primary", "dashed", "link", "text", "ghost"];
3
- export declare const ButtonShapes: readonly ["default", "circle", "round"];
4
- export declare const ButtonVariantTypes: readonly ["outlined", "dashed", "solid", "filled", "text", "link"];
5
- export declare const ButtonColorTypes: readonly ["default", "primary", "danger", "blue", "purple", "cyan", "green", "magenta", "pink", "red", "orange", "yellow", "volcano", "geekblue", "lime", "gold"];
6
- export type ButtonType = (typeof ButtonTypes)[number];
7
- export type ButtonShape = (typeof ButtonShapes)[number];
8
- export type ButtonVariantType = (typeof ButtonVariantTypes)[number];
9
- export type ButtonColorType = (typeof ButtonColorTypes)[number];
10
- export type SizeType = 'small' | 'middle' | 'large' | undefined;
11
- export type ButtonHTMLType = 'button' | 'submit' | 'reset';
12
- export interface BaseButtonProps {
13
- type?: ButtonType;
14
- color?: ButtonColorType;
15
- variant?: ButtonVariantType;
16
- icon?: ReactNode;
17
- iconPosition?: 'start' | 'end';
18
- shape?: ButtonShape;
19
- size?: SizeType;
20
- disabled?: boolean;
21
- loading?: boolean | {
22
- delay?: number;
23
- icon?: ReactNode;
24
- };
25
- prefixCls?: string;
26
- className?: string;
27
- rootClassName?: string;
28
- ghost?: boolean;
29
- danger?: boolean;
30
- block?: boolean;
31
- children?: ReactNode;
32
- classNames?: {
33
- icon?: string;
34
- };
35
- styles?: {
36
- icon?: CSSProperties;
37
- };
38
- }
39
- export interface ButtonProps extends BaseButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'type'> {
40
- href?: string;
41
- htmlType?: ButtonHTMLType;
42
- }
@@ -1,22 +0,0 @@
1
- import { KeyboardEventHandler, MouseEvent, MouseEventHandler, ReactNode } from 'react';
2
- import { DefaultProps, TargetProps } from '.';
3
- export type CheckboxProps = DefaultProps & {
4
- disabled?: boolean;
5
- onChange?: (e: MouseEvent<HTMLInputElement> & TargetProps) => void;
6
- onClick?: MouseEventHandler<HTMLElement>;
7
- onMouseEnter?: MouseEventHandler<HTMLElement>;
8
- onMouseLeave?: MouseEventHandler<HTMLElement>;
9
- onKeyPress?: KeyboardEventHandler<HTMLElement>;
10
- onKeyDown?: KeyboardEventHandler<HTMLElement>;
11
- value?: boolean;
12
- tabIndex?: number;
13
- name?: string;
14
- children?: ReactNode;
15
- id?: string;
16
- autoFocus?: boolean;
17
- type?: string;
18
- skipGroup?: boolean;
19
- required?: boolean;
20
- defaultChecked?: boolean;
21
- checked?: boolean;
22
- };
@@ -1,25 +0,0 @@
1
- import { CSSProperties, MouseEvent } from 'react';
2
- export type RuleType = any;
3
- export type RuleTypes = RuleType | RuleType[];
4
- export type SizeType = 'small' | 'middle' | 'large';
5
- export type MouseEventHandlerSelect = MouseEvent<HTMLDivElement> & TargetProps;
6
- export interface DefaultProps {
7
- prefixCls?: string;
8
- className?: string;
9
- style?: CSSProperties;
10
- noStyle?: boolean;
11
- }
12
- export type TargetProps = {
13
- target: {
14
- value: RuleType;
15
- };
16
- };
17
- export type SyntheticBaseEvent = {
18
- target: EventTarget & {
19
- value: RuleType;
20
- };
21
- nativeEvent?: Event & {
22
- data?: string | null;
23
- };
24
- currentTarget: EventTarget;
25
- };
@@ -1,14 +0,0 @@
1
- export declare const prefixClsForm = "xUi-form";
2
- export declare const prefixClsFormItem = "xUi-form-item";
3
- export declare const prefixClsEmpty = "xUi-empty";
4
- export declare const prefixClsInput = "xUi-input";
5
- export declare const prefixClsSelect = "xUi-select";
6
- export declare const prefixClsCheckbox = "xUi-checkbox";
7
- export declare const prefixClsRadio = "xUi-radio";
8
- export declare const prefixClsTextArea = "xUi-textarea";
9
- export declare const prefixClsUpload = "xUi-upload";
10
- export declare const prefixClsDatePicker = "xUi-datepicker";
11
- export declare const prefixClsRangePicker = "xUi-rangepicker";
12
- export declare const prefixClsTimePicker = "xUi-timepicker";
13
- export declare const prefixClsButton = "xUi-button";
14
- export declare const prefixClsSkeleton = "xUi-skeleton";
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { default as Button } from '@/components/Button/Button';
2
- export { default as Checkbox } from '@/components/Checkbox/Checkbox';
package/dist/index.esm.js DELETED
@@ -1,194 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
-
3
- function styleInject(css, ref) {
4
- if (ref === void 0) ref = {};
5
- var insertAt = ref.insertAt;
6
- if (!css || typeof document === 'undefined') {
7
- return;
8
- }
9
- var head = document.head || document.getElementsByTagName('head')[0];
10
- var style = document.createElement('style');
11
- style.type = 'text/css';
12
- if (insertAt === 'top') {
13
- if (head.firstChild) {
14
- head.insertBefore(style, head.firstChild);
15
- } else {
16
- head.appendChild(style);
17
- }
18
- } else {
19
- head.appendChild(style);
20
- }
21
- if (style.styleSheet) {
22
- style.styleSheet.cssText = css;
23
- } else {
24
- style.appendChild(document.createTextNode(css));
25
- }
26
- }
27
-
28
- var css_248z$2 = ":root{--xui-color-hover:#f5f5f5;--xui-color-disabled:#e6e6e6;--xui-primary-color:#1677ff;--xui-primary-color-light:#40a9ff;--xui-text-color:rgba(0,0,0,.88);--xui-text-color-light:rgba(0,0,0,.5);--xui-error-color:#ff4d4f;--xui-error-color-light:#ff6668;--xui-success-color:#52c41a;--xui-background-color:#fff;--xui-font-size-xs:12px;--xui-font-size-sm:14px;--xui-font-size-md:14px;--xui-font-size-lg:16px;--xui-border-radius-sm:4px;--xui-border-radius-md:4px;--xui-border-radius-lg:6px;--xui-border-color:#d9d9d9;--xui-select-primary-color:var(--xui-primary-color);--xui-select-background-color:var(--xui-background-color)}html{font-family:sans-serif}.globalEllipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
29
- styleInject(css_248z$2);
30
-
31
- function _extends() {
32
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
33
- for (var e = 1; e < arguments.length; e++) {
34
- var t = arguments[e];
35
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
36
- }
37
- return n;
38
- }, _extends.apply(null, arguments);
39
- }
40
-
41
- function clsx(...args) {
42
- return args.flatMap(arg => {
43
- if (!arg) {
44
- return [];
45
- }
46
- if (typeof arg === 'string') {
47
- return [arg];
48
- }
49
- if (typeof arg === 'number') {
50
- return [String(arg)];
51
- }
52
- if (Array.isArray(arg)) {
53
- return clsx(...arg).split(' ');
54
- }
55
- if (typeof arg === 'object') {
56
- return Object.entries(arg).filter(([, value]) => Boolean(value)).map(([key]) => key);
57
- }
58
- return [];
59
- }).filter(Boolean).join(' ');
60
- }
61
-
62
- const prefixClsCheckbox = 'xUi-checkbox';
63
- const prefixClsButton = 'xUi-button';
64
-
65
- var css_248z$1 = ".xUi-button{border:1px solid transparent;border-radius:6px;cursor:pointer;font-weight:400;line-height:1.5715;transition:all .3s ease;user-select:none;vertical-align:middle;white-space:nowrap}.xUi-button,.xUi-button-content,.xUi-button-icon{align-items:center;display:inline-flex;justify-content:center}.xUi-button-icon{line-height:0;margin-right:.5em}.xUi-button-icon:last-child{margin-left:.5em;margin-right:0}.xUi-button-spinner{animation:xUi-spin 1s linear infinite;border:1px solid transparent;border-radius:50%;border-top:1px solid var(--xui-text-color);height:1em;width:1em}@keyframes xUi-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.xUi-button-size-small{font-size:12px;height:24px;padding:4px 12px}.xUi-button-size-middle{font-size:14px;height:32px;padding:0 16px}.xUi-button-size-large{font-size:16px;height:40px;padding:8px 20px}.xUi-button-circle{border-radius:50%;justify-content:center;padding:0}.xUi-button-circle.xUi-button-size-small{height:24px;width:24px}.xUi-button-circle.xUi-button-size-large{height:40px;width:40px}.xUi-button-round{border-radius:9999px}.xUi-button-default{background-color:#fff;border-color:var(--xui-border-color);color:rgba(0,0,0,.85)}.xUi-button-default:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-primary{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);color:#fff}.xUi-button-primary:hover{background-color:var(--xui-primary-color-light);border-color:var(--xui-primary-color-light);color:#fff}.xUi-button-dashed{background-color:#fff;border-color:var(--xui-border-color);border-style:dashed;color:rgba(0,0,0,.85)}.xUi-button-dashed:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-text{background-color:transparent;border-color:transparent!important;color:rgba(0,0,0,.88)}.xUi-button-text:hover{background-color:rgba(0,0,0,.04);border-color:transparent;color:rgba(0,0,0,.88)}.xUi-button-link{background-color:transparent;border-color:transparent!important;color:var(--xui-primary-color)}.xUi-button-link:hover{border-color:transparent;color:var(--xui-primary-color-light)}.xUi-button-outlined{color:#fff}.xUi-button-filled,.xUi-button-outlined{background-color:transparent;border-color:var(--xui-border-color)}.xUi-button-filled{color:var(--xui-text-color)}.xUi-button-danger{background-color:transparent;border-color:var(--xui-error-color);color:var(--xui-error-color)}.xUi-button-danger:hover{border-color:var(--xui-error-color-light);color:var(--xui-error-color-light)}.xUi-button-ghost{opacity:0}.xUi-button-ghost:hover{opacity:1}.xUi-button-block{display:flex;width:100%}.xUi-button-disabled,.xUi-button-loading{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color);color:var(--xui-text-color);cursor:not-allowed;opacity:.5;pointer-events:none}.xUi-button-loading{background-color:transparent}";
66
- styleInject(css_248z$1);
67
-
68
- const Button = ({
69
- type = 'default',
70
- variant = 'solid',
71
- color = 'default',
72
- shape = 'default',
73
- size = 'middle',
74
- htmlType = 'button',
75
- className,
76
- rootClassName,
77
- classNames: customClassNames = {},
78
- styles = {},
79
- prefixCls = prefixClsButton,
80
- iconPosition = 'start',
81
- disabled = false,
82
- ghost = false,
83
- danger = false,
84
- block = false,
85
- children,
86
- href,
87
- iconNode,
88
- isLoading = false,
89
- ...restProps
90
- }) => {
91
- const classes = clsx(prefixCls, rootClassName, `${prefixCls}-${type}`, `${prefixCls}-${variant}`, `${prefixCls}-${color}`, `${prefixCls}-${shape}`, `${prefixCls}-size-${size}`, {
92
- [`${prefixCls}-block`]: block,
93
- [`${prefixCls}-ghost`]: ghost,
94
- [`${prefixCls}-danger`]: danger,
95
- [`${prefixCls}-loading`]: isLoading,
96
- [`${prefixCls}-disabled`]: disabled
97
- }, className);
98
- const mergedDisabled = disabled || isLoading;
99
- const content = /*#__PURE__*/React.createElement(React.Fragment, null, iconNode && iconPosition === 'start' && /*#__PURE__*/React.createElement("span", {
100
- className: clsx(`${prefixCls}-icon`, customClassNames.icon),
101
- style: styles.icon
102
- }, iconNode), /*#__PURE__*/React.createElement("span", {
103
- className: `${prefixCls}-content`
104
- }, children), iconNode && iconPosition === 'end' && /*#__PURE__*/React.createElement("span", {
105
- className: clsx(`${prefixCls}-icon`, customClassNames.icon),
106
- style: styles.icon
107
- }, iconNode));
108
- if (href) {
109
- return /*#__PURE__*/React.createElement("a", {
110
- className: classes,
111
- href: mergedDisabled ? undefined : href,
112
- "aria-disabled": mergedDisabled
113
- }, content);
114
- }
115
- return /*#__PURE__*/React.createElement("button", _extends({
116
- type: htmlType,
117
- className: classes,
118
- disabled: mergedDisabled
119
- }, restProps), content);
120
- };
121
-
122
- var css_248z = ".xUi-checkbox-wrapper{align-items:center;color:var(--xui-main-color);cursor:pointer;display:inline-flex;font-size:var(--xui-font-size-md);margin:16px 0}.xUi-checkbox{background-color:transparent;border:1px solid var(--xui-border-color);border-radius:var(--xui-border-radius-sm);display:inline-block;height:14px;position:relative;transition:all .3s;width:14px}.xUi-checkbox.xUi-checkbox-checked{background-color:#f0f5ff;border-color:var(--xui-primary-color)}.xUi-checkbox input{cursor:pointer;inset:0;opacity:0;position:absolute}.xUi-checkbox-inner{border-left:0;border-top:0;border:2px solid var(--xui-background-color);height:6px;left:50%;position:absolute;top:50%;transform:rotate(45deg) scale(0);transition:transform .2s ease-in-out;width:10px}.xUi-checkbox-check{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);display:block;height:100%;position:relative;transition:.1s ease;width:100%}.xUi-checkbox-check:after{border:solid #fff;border-width:0 2px 2px 0;content:\"\";height:8px;left:3px;position:absolute;top:1px;transform:rotate(45deg);width:5px}.xUi-checkbox-disabled,.xUi-checkbox-disabled .xUi-checkbox-check{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color)!important;cursor:not-allowed;opacity:.5}.xUi-checkbox-label{font-size:14px;margin-left:8px;user-select:none}.xUi-checkbox:focus:not(.disabled),.xUi-checkbox:hover:not(.disabled){border-color:var(--xui-primary-color);cursor:pointer}.xUi-checkbox.disabled{cursor:not-allowed;opacity:.5}";
123
- styleInject(css_248z);
124
-
125
- const Checkbox = /*#__PURE__*/forwardRef(({
126
- prefixCls = prefixClsCheckbox,
127
- className = '',
128
- style,
129
- disabled = false,
130
- onClick,
131
- onChange,
132
- onMouseEnter,
133
- onMouseLeave,
134
- onKeyPress,
135
- onKeyDown,
136
- tabIndex,
137
- name,
138
- children,
139
- id,
140
- autoFocus,
141
- type = 'checkbox',
142
- internalChecked,
143
- required = false,
144
- noStyle,
145
- setInternalChecked
146
- }, ref) => {
147
- const handleClick = e => {
148
- e.stopPropagation();
149
- if (disabled) {
150
- return;
151
- }
152
- setInternalChecked?.(!internalChecked);
153
- e.target.value = !internalChecked;
154
- onClick?.(e);
155
- onChange?.(e);
156
- };
157
- return /*#__PURE__*/React.createElement("div", {
158
- className: `${prefixCls}-wrapper`
159
- }, /*#__PURE__*/React.createElement("div", {
160
- ref: ref,
161
- style: style,
162
- onClick: e => handleClick(e),
163
- className: clsx([prefixCls, className, {
164
- noStyle: noStyle,
165
- [`${prefixCls}-disabled`]: disabled,
166
- [`${prefixCls}-checked`]: internalChecked
167
- }])
168
- }, /*#__PURE__*/React.createElement("input", {
169
- id: id,
170
- type: type,
171
- name: name,
172
- disabled: disabled,
173
- tabIndex: tabIndex,
174
- required: required,
175
- autoFocus: autoFocus,
176
- onKeyDown: onKeyDown,
177
- onKeyPress: onKeyPress,
178
- onMouseEnter: onMouseEnter,
179
- onMouseLeave: onMouseLeave
180
- }), /*#__PURE__*/React.createElement("span", {
181
- className: `${prefixCls}-box`
182
- }, /*#__PURE__*/React.createElement("span", {
183
- className: `${prefixCls}-check`,
184
- style: {
185
- opacity: Number(internalChecked)
186
- }
187
- }))), children && /*#__PURE__*/React.createElement("span", {
188
- className: `${prefixCls}-label`
189
- }, children));
190
- });
191
- Checkbox.displayName = "Checkbox";
192
-
193
- export { Button, Checkbox };
194
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../lib/helpers/index.ts","../lib/utils/index.ts","../lib/components/Button/Button.tsx","../lib/components/Checkbox/Checkbox.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import { RuleType } from '../types';\n\nexport const parseValue = (value: RuleType): RuleType => {\n if (value === 'true') {\n return true;\n }\n\n if (value === 'false') {\n return false;\n }\n\n if (!isNaN(Number(value))) {\n return Number(value);\n }\n\n return value;\n};\n\nexport function createArray(length: number): number[] {\n return Array.from({ length }, (_, index) => index);\n}\n\nexport function clsx(...args: RuleType[]): string {\n return args\n .flatMap(arg => {\n if (!arg) {\n return [];\n }\n\n if (typeof arg === 'string') {\n return [arg];\n }\n\n if (typeof arg === 'number') {\n return [String(arg)];\n }\n\n if (Array.isArray(arg)) {\n return clsx(...arg).split(' ');\n }\n\n if (typeof arg === 'object') {\n return Object.entries(arg)\n .filter(([, value]) => Boolean(value))\n .map(([key]) => key);\n }\n\n return [];\n })\n .filter(Boolean)\n .join(' ');\n}\n","export const prefixClsForm = 'xUi-form';\nexport const prefixClsFormItem = 'xUi-form-item';\nexport const prefixClsEmpty = 'xUi-empty';\nexport const prefixClsInput = 'xUi-input';\nexport const prefixClsSelect = 'xUi-select';\nexport const prefixClsCheckbox = 'xUi-checkbox';\nexport const prefixClsRadio = 'xUi-radio';\nexport const prefixClsTextArea = 'xUi-textarea';\nexport const prefixClsUpload = 'xUi-upload';\nexport const prefixClsDatePicker = 'xUi-datepicker';\nexport const prefixClsRangePicker = 'xUi-rangepicker';\nexport const prefixClsTimePicker = 'xUi-timepicker';\nexport const prefixClsButton = 'xUi-button';\nexport const prefixClsSkeleton = 'xUi-skeleton';\n","import React, { ReactElement, ReactNode } from 'react';\nimport { clsx } from '../../helpers';\nimport { ButtonProps } from '../../types/button';\nimport { prefixClsButton } from '../../utils';\nimport './style.css';\n\nconst Button = ({\n type = 'default',\n variant = 'solid',\n color = 'default',\n shape = 'default',\n size = 'middle',\n htmlType = 'button',\n className,\n rootClassName,\n classNames: customClassNames = {},\n styles = {},\n prefixCls = prefixClsButton,\n iconPosition = 'start',\n disabled = false,\n ghost = false,\n danger = false,\n block = false,\n children,\n href,\n iconNode,\n isLoading = false,\n ...restProps\n}: ButtonProps & {\n iconNode?: ReactNode;\n isLoading?: boolean;\n}): ReactElement => {\n const classes = clsx(\n prefixCls,\n rootClassName,\n `${prefixCls}-${type}`,\n `${prefixCls}-${variant}`,\n `${prefixCls}-${color}`,\n `${prefixCls}-${shape}`,\n `${prefixCls}-size-${size}`,\n {\n [`${prefixCls}-block`]: block,\n [`${prefixCls}-ghost`]: ghost,\n [`${prefixCls}-danger`]: danger,\n [`${prefixCls}-loading`]: isLoading,\n [`${prefixCls}-disabled`]: disabled\n },\n className\n );\n\n const mergedDisabled = disabled || isLoading;\n\n const content = (\n <>\n {iconNode && iconPosition === 'start' && (\n <span\n className={clsx(`${prefixCls}-icon`, customClassNames.icon)}\n style={styles.icon}\n >\n {iconNode}\n </span>\n )}\n <span className={`${prefixCls}-content`}>{children}</span>\n {iconNode && iconPosition === 'end' && (\n <span\n className={clsx(`${prefixCls}-icon`, customClassNames.icon)}\n style={styles.icon}\n >\n {iconNode}\n </span>\n )}\n </>\n );\n\n if (href) {\n return (\n <a\n className={classes}\n href={mergedDisabled ? undefined : href}\n aria-disabled={mergedDisabled}\n >\n {content}\n </a>\n );\n }\n\n return (\n <button\n type={htmlType}\n className={classes}\n disabled={mergedDisabled}\n {...restProps}\n >\n {content}\n </button>\n );\n};\n\nexport default Button;\n","import { prefixClsCheckbox } from '@/utils';\nimport { CheckboxProps } from '../../types/checkbox';\nimport React, { Dispatch, ForwardedRef, forwardRef, MouseEvent, ReactElement, SetStateAction } from 'react';\nimport { clsx } from '../../helpers';\nimport { SyntheticBaseEvent } from '../../types';\n\nimport './style.css';\n\nconst Checkbox = forwardRef<HTMLDivElement, CheckboxProps & {\n internalChecked: boolean,\n setInternalChecked?: Dispatch<SetStateAction<boolean>>\n}>(\n (\n {\n prefixCls = prefixClsCheckbox,\n className = '',\n style,\n disabled = false,\n onClick,\n onChange,\n onMouseEnter,\n onMouseLeave,\n onKeyPress,\n onKeyDown,\n tabIndex,\n name,\n children,\n id,\n autoFocus,\n type = 'checkbox',\n internalChecked,\n required = false,\n noStyle,\n setInternalChecked\n },\n ref: ForwardedRef<HTMLDivElement>\n ): ReactElement => {\n const handleClick = (\n e: MouseEvent<HTMLInputElement> & SyntheticBaseEvent\n ) => {\n e.stopPropagation();\n \n if (disabled) {\n return;\n }\n \n setInternalChecked?.(!internalChecked);\n e.target.value = !internalChecked;\n \n onClick?.(e);\n onChange?.(e);\n };\n\n return (\n <div className={`${prefixCls}-wrapper`}>\n <div\n ref={ref}\n style={style}\n onClick={(e) => handleClick(e as MouseEvent<HTMLInputElement> & SyntheticBaseEvent)}\n className={clsx([\n prefixCls,\n className,\n {\n noStyle: noStyle,\n [`${prefixCls}-disabled`]: disabled,\n [`${prefixCls}-checked`]: internalChecked\n }\n ])}\n >\n <input\n id={id}\n type={type}\n name={name}\n disabled={disabled}\n tabIndex={tabIndex}\n required={required}\n autoFocus={autoFocus}\n onKeyDown={onKeyDown}\n onKeyPress={onKeyPress}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n />\n\n <span className={`${prefixCls}-box`}>\n <span\n className={`${prefixCls}-check`}\n style={{ opacity: Number(internalChecked) }}\n />\n </span>\n </div>\n\n {children && <span className={`${prefixCls}-label`}>{children}</span>}\n </div>\n )\n})\n\nCheckbox.displayName = \"Checkbox\";\n\nexport default Checkbox;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","clsx","args","flatMap","arg","String","Array","isArray","split","Object","entries","filter","value","Boolean","map","key","join","prefixClsCheckbox","prefixClsButton","Button","variant","color","shape","size","htmlType","className","rootClassName","classNames","customClassNames","styles","prefixCls","iconPosition","disabled","ghost","danger","block","children","href","iconNode","isLoading","restProps","classes","mergedDisabled","content","React","Fragment","icon","undefined","_extends","Checkbox","forwardRef","onClick","onChange","onMouseEnter","onMouseLeave","onKeyPress","onKeyDown","tabIndex","name","id","autoFocus","internalChecked","required","noStyle","setInternalChecked","handleClick","e","stopPropagation","target","opacity","Number","displayName"],"mappings":";;AAAA,SAASA,WAAWA,CAACC,GAAG,EAAEC,GAAG,EAAE;EAC7B,IAAKA,GAAG,KAAK,KAAK,CAAC,EAAGA,GAAG,GAAG,EAAE,CAAA;AAC9B,EAAA,IAAIC,QAAQ,GAAGD,GAAG,CAACC,QAAQ,CAAA;AAE3B,EAAA,IAAI,CAACF,GAAG,IAAI,OAAOG,QAAQ,KAAK,WAAW,EAAE;AAAE,IAAA,OAAA;AAAQ,GAAA;AAEvD,EAAA,IAAIC,IAAI,GAAGD,QAAQ,CAACC,IAAI,IAAID,QAAQ,CAACE,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;AACpE,EAAA,IAAIC,KAAK,GAAGH,QAAQ,CAACI,aAAa,CAAC,OAAO,CAAC,CAAA;EAC3CD,KAAK,CAACE,IAAI,GAAG,UAAU,CAAA;EAEvB,IAAIN,QAAQ,KAAK,KAAK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;IACEgC,SAAS,EAAE,CAAGK,EAAAA,SAAS,CAAS,MAAA,CAAA;AAChCtC,IAAAA,KAAK,EAAE;MAAE6E,OAAO,EAAEC,MAAM,CAACT,eAAe,CAAA;AAAG,KAAA;GAE/C,CAAM,CACH,CAEL,EAACzB,QAAQ,iBAAIQ,KAAA,CAAAnD,aAAA,CAAA,MAAA,EAAA;IAAMgC,SAAS,EAAE,GAAGK,SAAS,CAAA,MAAA,CAAA;GAAWM,EAAAA,QAAe,CACjE,CAAC,CAAA;AAEZ,CAAC,EAAC;AAEFa,QAAQ,CAACsB,WAAW,GAAG,UAAU;;;;","x_google_ignoreList":[0]}
package/dist/index.js DELETED
@@ -1,197 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
-
5
- function styleInject(css, ref) {
6
- if (ref === void 0) ref = {};
7
- var insertAt = ref.insertAt;
8
- if (!css || typeof document === 'undefined') {
9
- return;
10
- }
11
- var head = document.head || document.getElementsByTagName('head')[0];
12
- var style = document.createElement('style');
13
- style.type = 'text/css';
14
- if (insertAt === 'top') {
15
- if (head.firstChild) {
16
- head.insertBefore(style, head.firstChild);
17
- } else {
18
- head.appendChild(style);
19
- }
20
- } else {
21
- head.appendChild(style);
22
- }
23
- if (style.styleSheet) {
24
- style.styleSheet.cssText = css;
25
- } else {
26
- style.appendChild(document.createTextNode(css));
27
- }
28
- }
29
-
30
- var css_248z$2 = ":root{--xui-color-hover:#f5f5f5;--xui-color-disabled:#e6e6e6;--xui-primary-color:#1677ff;--xui-primary-color-light:#40a9ff;--xui-text-color:rgba(0,0,0,.88);--xui-text-color-light:rgba(0,0,0,.5);--xui-error-color:#ff4d4f;--xui-error-color-light:#ff6668;--xui-success-color:#52c41a;--xui-background-color:#fff;--xui-font-size-xs:12px;--xui-font-size-sm:14px;--xui-font-size-md:14px;--xui-font-size-lg:16px;--xui-border-radius-sm:4px;--xui-border-radius-md:4px;--xui-border-radius-lg:6px;--xui-border-color:#d9d9d9;--xui-select-primary-color:var(--xui-primary-color);--xui-select-background-color:var(--xui-background-color)}html{font-family:sans-serif}.globalEllipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
31
- styleInject(css_248z$2);
32
-
33
- function _extends() {
34
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
35
- for (var e = 1; e < arguments.length; e++) {
36
- var t = arguments[e];
37
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
38
- }
39
- return n;
40
- }, _extends.apply(null, arguments);
41
- }
42
-
43
- function clsx(...args) {
44
- return args.flatMap(arg => {
45
- if (!arg) {
46
- return [];
47
- }
48
- if (typeof arg === 'string') {
49
- return [arg];
50
- }
51
- if (typeof arg === 'number') {
52
- return [String(arg)];
53
- }
54
- if (Array.isArray(arg)) {
55
- return clsx(...arg).split(' ');
56
- }
57
- if (typeof arg === 'object') {
58
- return Object.entries(arg).filter(([, value]) => Boolean(value)).map(([key]) => key);
59
- }
60
- return [];
61
- }).filter(Boolean).join(' ');
62
- }
63
-
64
- const prefixClsCheckbox = 'xUi-checkbox';
65
- const prefixClsButton = 'xUi-button';
66
-
67
- var css_248z$1 = ".xUi-button{border:1px solid transparent;border-radius:6px;cursor:pointer;font-weight:400;line-height:1.5715;transition:all .3s ease;user-select:none;vertical-align:middle;white-space:nowrap}.xUi-button,.xUi-button-content,.xUi-button-icon{align-items:center;display:inline-flex;justify-content:center}.xUi-button-icon{line-height:0;margin-right:.5em}.xUi-button-icon:last-child{margin-left:.5em;margin-right:0}.xUi-button-spinner{animation:xUi-spin 1s linear infinite;border:1px solid transparent;border-radius:50%;border-top:1px solid var(--xui-text-color);height:1em;width:1em}@keyframes xUi-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.xUi-button-size-small{font-size:12px;height:24px;padding:4px 12px}.xUi-button-size-middle{font-size:14px;height:32px;padding:0 16px}.xUi-button-size-large{font-size:16px;height:40px;padding:8px 20px}.xUi-button-circle{border-radius:50%;justify-content:center;padding:0}.xUi-button-circle.xUi-button-size-small{height:24px;width:24px}.xUi-button-circle.xUi-button-size-large{height:40px;width:40px}.xUi-button-round{border-radius:9999px}.xUi-button-default{background-color:#fff;border-color:var(--xui-border-color);color:rgba(0,0,0,.85)}.xUi-button-default:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-primary{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);color:#fff}.xUi-button-primary:hover{background-color:var(--xui-primary-color-light);border-color:var(--xui-primary-color-light);color:#fff}.xUi-button-dashed{background-color:#fff;border-color:var(--xui-border-color);border-style:dashed;color:rgba(0,0,0,.85)}.xUi-button-dashed:hover{border-color:var(--xui-primary-color);color:var(--xui-primary-color)}.xUi-button-text{background-color:transparent;border-color:transparent!important;color:rgba(0,0,0,.88)}.xUi-button-text:hover{background-color:rgba(0,0,0,.04);border-color:transparent;color:rgba(0,0,0,.88)}.xUi-button-link{background-color:transparent;border-color:transparent!important;color:var(--xui-primary-color)}.xUi-button-link:hover{border-color:transparent;color:var(--xui-primary-color-light)}.xUi-button-outlined{color:#fff}.xUi-button-filled,.xUi-button-outlined{background-color:transparent;border-color:var(--xui-border-color)}.xUi-button-filled{color:var(--xui-text-color)}.xUi-button-danger{background-color:transparent;border-color:var(--xui-error-color);color:var(--xui-error-color)}.xUi-button-danger:hover{border-color:var(--xui-error-color-light);color:var(--xui-error-color-light)}.xUi-button-ghost{opacity:0}.xUi-button-ghost:hover{opacity:1}.xUi-button-block{display:flex;width:100%}.xUi-button-disabled,.xUi-button-loading{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color);color:var(--xui-text-color);cursor:not-allowed;opacity:.5;pointer-events:none}.xUi-button-loading{background-color:transparent}";
68
- styleInject(css_248z$1);
69
-
70
- const Button = ({
71
- type = 'default',
72
- variant = 'solid',
73
- color = 'default',
74
- shape = 'default',
75
- size = 'middle',
76
- htmlType = 'button',
77
- className,
78
- rootClassName,
79
- classNames: customClassNames = {},
80
- styles = {},
81
- prefixCls = prefixClsButton,
82
- iconPosition = 'start',
83
- disabled = false,
84
- ghost = false,
85
- danger = false,
86
- block = false,
87
- children,
88
- href,
89
- iconNode,
90
- isLoading = false,
91
- ...restProps
92
- }) => {
93
- const classes = clsx(prefixCls, rootClassName, `${prefixCls}-${type}`, `${prefixCls}-${variant}`, `${prefixCls}-${color}`, `${prefixCls}-${shape}`, `${prefixCls}-size-${size}`, {
94
- [`${prefixCls}-block`]: block,
95
- [`${prefixCls}-ghost`]: ghost,
96
- [`${prefixCls}-danger`]: danger,
97
- [`${prefixCls}-loading`]: isLoading,
98
- [`${prefixCls}-disabled`]: disabled
99
- }, className);
100
- const mergedDisabled = disabled || isLoading;
101
- const content = /*#__PURE__*/React.createElement(React.Fragment, null, iconNode && iconPosition === 'start' && /*#__PURE__*/React.createElement("span", {
102
- className: clsx(`${prefixCls}-icon`, customClassNames.icon),
103
- style: styles.icon
104
- }, iconNode), /*#__PURE__*/React.createElement("span", {
105
- className: `${prefixCls}-content`
106
- }, children), iconNode && iconPosition === 'end' && /*#__PURE__*/React.createElement("span", {
107
- className: clsx(`${prefixCls}-icon`, customClassNames.icon),
108
- style: styles.icon
109
- }, iconNode));
110
- if (href) {
111
- return /*#__PURE__*/React.createElement("a", {
112
- className: classes,
113
- href: mergedDisabled ? undefined : href,
114
- "aria-disabled": mergedDisabled
115
- }, content);
116
- }
117
- return /*#__PURE__*/React.createElement("button", _extends({
118
- type: htmlType,
119
- className: classes,
120
- disabled: mergedDisabled
121
- }, restProps), content);
122
- };
123
-
124
- var css_248z = ".xUi-checkbox-wrapper{align-items:center;color:var(--xui-main-color);cursor:pointer;display:inline-flex;font-size:var(--xui-font-size-md);margin:16px 0}.xUi-checkbox{background-color:transparent;border:1px solid var(--xui-border-color);border-radius:var(--xui-border-radius-sm);display:inline-block;height:14px;position:relative;transition:all .3s;width:14px}.xUi-checkbox.xUi-checkbox-checked{background-color:#f0f5ff;border-color:var(--xui-primary-color)}.xUi-checkbox input{cursor:pointer;inset:0;opacity:0;position:absolute}.xUi-checkbox-inner{border-left:0;border-top:0;border:2px solid var(--xui-background-color);height:6px;left:50%;position:absolute;top:50%;transform:rotate(45deg) scale(0);transition:transform .2s ease-in-out;width:10px}.xUi-checkbox-check{background-color:var(--xui-primary-color);border-color:var(--xui-primary-color);display:block;height:100%;position:relative;transition:.1s ease;width:100%}.xUi-checkbox-check:after{border:solid #fff;border-width:0 2px 2px 0;content:\"\";height:8px;left:3px;position:absolute;top:1px;transform:rotate(45deg);width:5px}.xUi-checkbox-disabled,.xUi-checkbox-disabled .xUi-checkbox-check{background-color:var(--xui-color-disabled);border-color:var(--xui-border-color)!important;cursor:not-allowed;opacity:.5}.xUi-checkbox-label{font-size:14px;margin-left:8px;user-select:none}.xUi-checkbox:focus:not(.disabled),.xUi-checkbox:hover:not(.disabled){border-color:var(--xui-primary-color);cursor:pointer}.xUi-checkbox.disabled{cursor:not-allowed;opacity:.5}";
125
- styleInject(css_248z);
126
-
127
- const Checkbox = /*#__PURE__*/React.forwardRef(({
128
- prefixCls = prefixClsCheckbox,
129
- className = '',
130
- style,
131
- disabled = false,
132
- onClick,
133
- onChange,
134
- onMouseEnter,
135
- onMouseLeave,
136
- onKeyPress,
137
- onKeyDown,
138
- tabIndex,
139
- name,
140
- children,
141
- id,
142
- autoFocus,
143
- type = 'checkbox',
144
- internalChecked,
145
- required = false,
146
- noStyle,
147
- setInternalChecked
148
- }, ref) => {
149
- const handleClick = e => {
150
- e.stopPropagation();
151
- if (disabled) {
152
- return;
153
- }
154
- setInternalChecked?.(!internalChecked);
155
- e.target.value = !internalChecked;
156
- onClick?.(e);
157
- onChange?.(e);
158
- };
159
- return /*#__PURE__*/React.createElement("div", {
160
- className: `${prefixCls}-wrapper`
161
- }, /*#__PURE__*/React.createElement("div", {
162
- ref: ref,
163
- style: style,
164
- onClick: e => handleClick(e),
165
- className: clsx([prefixCls, className, {
166
- noStyle: noStyle,
167
- [`${prefixCls}-disabled`]: disabled,
168
- [`${prefixCls}-checked`]: internalChecked
169
- }])
170
- }, /*#__PURE__*/React.createElement("input", {
171
- id: id,
172
- type: type,
173
- name: name,
174
- disabled: disabled,
175
- tabIndex: tabIndex,
176
- required: required,
177
- autoFocus: autoFocus,
178
- onKeyDown: onKeyDown,
179
- onKeyPress: onKeyPress,
180
- onMouseEnter: onMouseEnter,
181
- onMouseLeave: onMouseLeave
182
- }), /*#__PURE__*/React.createElement("span", {
183
- className: `${prefixCls}-box`
184
- }, /*#__PURE__*/React.createElement("span", {
185
- className: `${prefixCls}-check`,
186
- style: {
187
- opacity: Number(internalChecked)
188
- }
189
- }))), children && /*#__PURE__*/React.createElement("span", {
190
- className: `${prefixCls}-label`
191
- }, children));
192
- });
193
- Checkbox.displayName = "Checkbox";
194
-
195
- exports.Button = Button;
196
- exports.Checkbox = Checkbox;
197
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../lib/helpers/index.ts","../lib/utils/index.ts","../lib/components/Button/Button.tsx","../lib/components/Checkbox/Checkbox.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import { RuleType } from '../types';\n\nexport const parseValue = (value: RuleType): RuleType => {\n if (value === 'true') {\n return true;\n }\n\n if (value === 'false') {\n return false;\n }\n\n if (!isNaN(Number(value))) {\n return Number(value);\n }\n\n return value;\n};\n\nexport function createArray(length: number): number[] {\n return Array.from({ length }, (_, index) => index);\n}\n\nexport function clsx(...args: RuleType[]): string {\n return args\n .flatMap(arg => {\n if (!arg) {\n return [];\n }\n\n if (typeof arg === 'string') {\n return [arg];\n }\n\n if (typeof arg === 'number') {\n return [String(arg)];\n }\n\n if (Array.isArray(arg)) {\n return clsx(...arg).split(' ');\n }\n\n if (typeof arg === 'object') {\n return Object.entries(arg)\n .filter(([, value]) => Boolean(value))\n .map(([key]) => key);\n }\n\n return [];\n })\n .filter(Boolean)\n .join(' ');\n}\n","export const prefixClsForm = 'xUi-form';\nexport const prefixClsFormItem = 'xUi-form-item';\nexport const prefixClsEmpty = 'xUi-empty';\nexport const prefixClsInput = 'xUi-input';\nexport const prefixClsSelect = 'xUi-select';\nexport const prefixClsCheckbox = 'xUi-checkbox';\nexport const prefixClsRadio = 'xUi-radio';\nexport const prefixClsTextArea = 'xUi-textarea';\nexport const prefixClsUpload = 'xUi-upload';\nexport const prefixClsDatePicker = 'xUi-datepicker';\nexport const prefixClsRangePicker = 'xUi-rangepicker';\nexport const prefixClsTimePicker = 'xUi-timepicker';\nexport const prefixClsButton = 'xUi-button';\nexport const prefixClsSkeleton = 'xUi-skeleton';\n","import React, { ReactElement, ReactNode } from 'react';\nimport { clsx } from '../../helpers';\nimport { ButtonProps } from '../../types/button';\nimport { prefixClsButton } from '../../utils';\nimport './style.css';\n\nconst Button = ({\n type = 'default',\n variant = 'solid',\n color = 'default',\n shape = 'default',\n size = 'middle',\n htmlType = 'button',\n className,\n rootClassName,\n classNames: customClassNames = {},\n styles = {},\n prefixCls = prefixClsButton,\n iconPosition = 'start',\n disabled = false,\n ghost = false,\n danger = false,\n block = false,\n children,\n href,\n iconNode,\n isLoading = false,\n ...restProps\n}: ButtonProps & {\n iconNode?: ReactNode;\n isLoading?: boolean;\n}): ReactElement => {\n const classes = clsx(\n prefixCls,\n rootClassName,\n `${prefixCls}-${type}`,\n `${prefixCls}-${variant}`,\n `${prefixCls}-${color}`,\n `${prefixCls}-${shape}`,\n `${prefixCls}-size-${size}`,\n {\n [`${prefixCls}-block`]: block,\n [`${prefixCls}-ghost`]: ghost,\n [`${prefixCls}-danger`]: danger,\n [`${prefixCls}-loading`]: isLoading,\n [`${prefixCls}-disabled`]: disabled\n },\n className\n );\n\n const mergedDisabled = disabled || isLoading;\n\n const content = (\n <>\n {iconNode && iconPosition === 'start' && (\n <span\n className={clsx(`${prefixCls}-icon`, customClassNames.icon)}\n style={styles.icon}\n >\n {iconNode}\n </span>\n )}\n <span className={`${prefixCls}-content`}>{children}</span>\n {iconNode && iconPosition === 'end' && (\n <span\n className={clsx(`${prefixCls}-icon`, customClassNames.icon)}\n style={styles.icon}\n >\n {iconNode}\n </span>\n )}\n </>\n );\n\n if (href) {\n return (\n <a\n className={classes}\n href={mergedDisabled ? undefined : href}\n aria-disabled={mergedDisabled}\n >\n {content}\n </a>\n );\n }\n\n return (\n <button\n type={htmlType}\n className={classes}\n disabled={mergedDisabled}\n {...restProps}\n >\n {content}\n </button>\n );\n};\n\nexport default Button;\n","import { prefixClsCheckbox } from '@/utils';\nimport { CheckboxProps } from '../../types/checkbox';\nimport React, { Dispatch, ForwardedRef, forwardRef, MouseEvent, ReactElement, SetStateAction } from 'react';\nimport { clsx } from '../../helpers';\nimport { SyntheticBaseEvent } from '../../types';\n\nimport './style.css';\n\nconst Checkbox = forwardRef<HTMLDivElement, CheckboxProps & {\n internalChecked: boolean,\n setInternalChecked?: Dispatch<SetStateAction<boolean>>\n}>(\n (\n {\n prefixCls = prefixClsCheckbox,\n className = '',\n style,\n disabled = false,\n onClick,\n onChange,\n onMouseEnter,\n onMouseLeave,\n onKeyPress,\n onKeyDown,\n tabIndex,\n name,\n children,\n id,\n autoFocus,\n type = 'checkbox',\n internalChecked,\n required = false,\n noStyle,\n setInternalChecked\n },\n ref: ForwardedRef<HTMLDivElement>\n ): ReactElement => {\n const handleClick = (\n e: MouseEvent<HTMLInputElement> & SyntheticBaseEvent\n ) => {\n e.stopPropagation();\n \n if (disabled) {\n return;\n }\n \n setInternalChecked?.(!internalChecked);\n e.target.value = !internalChecked;\n \n onClick?.(e);\n onChange?.(e);\n };\n\n return (\n <div className={`${prefixCls}-wrapper`}>\n <div\n ref={ref}\n style={style}\n onClick={(e) => handleClick(e as MouseEvent<HTMLInputElement> & SyntheticBaseEvent)}\n className={clsx([\n prefixCls,\n className,\n {\n noStyle: noStyle,\n [`${prefixCls}-disabled`]: disabled,\n [`${prefixCls}-checked`]: internalChecked\n }\n ])}\n >\n <input\n id={id}\n type={type}\n name={name}\n disabled={disabled}\n tabIndex={tabIndex}\n required={required}\n autoFocus={autoFocus}\n onKeyDown={onKeyDown}\n onKeyPress={onKeyPress}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n />\n\n <span className={`${prefixCls}-box`}>\n <span\n className={`${prefixCls}-check`}\n style={{ opacity: Number(internalChecked) }}\n />\n </span>\n </div>\n\n {children && <span className={`${prefixCls}-label`}>{children}</span>}\n </div>\n )\n})\n\nCheckbox.displayName = \"Checkbox\";\n\nexport default Checkbox;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","clsx","args","flatMap","arg","String","Array","isArray","split","Object","entries","filter","value","Boolean","map","key","join","prefixClsCheckbox","prefixClsButton","Button","variant","color","shape","size","htmlType","className","rootClassName","classNames","customClassNames","styles","prefixCls","iconPosition","disabled","ghost","danger","block","children","href","iconNode","isLoading","restProps","classes","mergedDisabled","content","React","Fragment","icon","undefined","_extends","Checkbox","forwardRef","onClick","onChange","onMouseEnter","onMouseLeave","onKeyPress","onKeyDown","tabIndex","name","id","autoFocus","internalChecked","required","noStyle","setInternalChecked","handleClick","e","stopPropagation","target","opacity","Number","displayName"],"mappings":";;;;AAAA,SAASA,WAAWA,CAACC,GAAG,EAAEC,GAAG,EAAE;EAC7B,IAAKA,GAAG,KAAK,KAAK,CAAC,EAAGA,GAAG,GAAG,EAAE,CAAA;AAC9B,EAAA,IAAIC,QAAQ,GAAGD,GAAG,CAAC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