asterui 0.12.24 → 0.12.26

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,4 +1,11 @@
1
1
  import { default as React } from 'react';
2
+ export type CardSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
3
+ export type CardVariant = 'default' | 'border' | 'dash' | 'borderless';
4
+ export interface CardTabItem {
5
+ key: string;
6
+ label: React.ReactNode;
7
+ disabled?: boolean;
8
+ }
2
9
  export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
3
10
  children?: React.ReactNode;
4
11
  title?: React.ReactNode;
@@ -6,8 +13,13 @@ export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 't
6
13
  extra?: React.ReactNode;
7
14
  cover?: React.ReactNode;
8
15
  actions?: React.ReactNode;
9
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
16
+ size?: CardSize;
17
+ /** @deprecated Use variant instead */
10
18
  bordered?: boolean;
19
+ /** Card style variant */
20
+ variant?: CardVariant;
21
+ /** Inner card style (nested cards) */
22
+ type?: 'inner';
11
23
  side?: boolean;
12
24
  imageFull?: boolean;
13
25
  actionsJustify?: 'start' | 'center' | 'end';
@@ -15,6 +27,12 @@ export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 't
15
27
  hoverable?: boolean;
16
28
  avatar?: React.ReactNode;
17
29
  description?: React.ReactNode;
30
+ tabList?: CardTabItem[];
31
+ activeTabKey?: string;
32
+ defaultActiveTabKey?: string;
33
+ onTabChange?: (key: string) => void;
34
+ tabBarExtraContent?: React.ReactNode;
35
+ 'data-testid'?: string;
18
36
  }
19
37
  export interface CardMetaProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
20
38
  /** Avatar or icon element */
@@ -23,16 +41,15 @@ export interface CardMetaProps extends Omit<React.HTMLAttributes<HTMLDivElement>
23
41
  title?: React.ReactNode;
24
42
  /** Description content */
25
43
  description?: React.ReactNode;
44
+ 'data-testid'?: string;
26
45
  }
27
46
  export interface CardGridProps extends React.HTMLAttributes<HTMLDivElement> {
28
47
  children: React.ReactNode;
29
48
  hoverable?: boolean;
49
+ 'data-testid'?: string;
30
50
  }
31
- declare function CardGrid({ children, hoverable, className, style, ...rest }: CardGridProps): import("react/jsx-runtime").JSX.Element;
32
- declare function CardMeta({ avatar, title, description, className, ...rest }: CardMetaProps): import("react/jsx-runtime").JSX.Element;
33
- declare function CardRoot({ children, title, extra, cover, actions, className, style, size, bordered, side, imageFull, actionsJustify, loading, hoverable, avatar, description, ...rest }: CardProps): import("react/jsx-runtime").JSX.Element;
34
- export declare const Card: typeof CardRoot & {
35
- Grid: typeof CardGrid;
36
- Meta: typeof CardMeta;
51
+ export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>> & {
52
+ Grid: React.ForwardRefExoticComponent<CardGridProps & React.RefAttributes<HTMLDivElement>>;
53
+ Meta: React.ForwardRefExoticComponent<CardMetaProps & React.RefAttributes<HTMLDivElement>>;
37
54
  };
38
55
  export default Card;
@@ -65,5 +65,7 @@ export interface CascaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>
65
65
  maxTagCount?: number | 'responsive';
66
66
  /** Accessible label */
67
67
  'aria-label'?: string;
68
+ /** Test ID for the component */
69
+ 'data-testid'?: string;
68
70
  }
69
71
  export declare const Cascader: React.ForwardRefExoticComponent<CascaderProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,18 +1,34 @@
1
1
  import { default as React } from 'react';
2
- export interface TagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'> {
2
+ export type TagSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
3
+ export type TagColor = 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error' | 'ghost';
4
+ export type TagVariant = 'filled' | 'outlined' | 'soft' | 'dash';
5
+ export interface TagProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'> {
3
6
  closable?: boolean;
4
7
  closeIcon?: React.ReactNode;
5
8
  onClose?: () => void;
6
- color?: string;
9
+ color?: TagColor | string;
7
10
  icon?: React.ReactNode;
8
- size?: 'xs' | 'sm' | 'md' | 'lg';
11
+ size?: TagSize;
12
+ variant?: TagVariant;
13
+ visible?: boolean;
14
+ disabled?: boolean;
15
+ href?: string;
16
+ target?: string;
9
17
  children?: React.ReactNode;
18
+ 'data-testid'?: string;
19
+ 'aria-label'?: string;
10
20
  }
11
- export interface CheckableTagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onChange'> {
21
+ export interface CheckableTagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onChange' | 'color'> {
12
22
  checked?: boolean;
13
23
  onChange?: (checked: boolean) => void;
14
24
  icon?: React.ReactNode;
25
+ size?: TagSize;
26
+ color?: TagColor;
27
+ disabled?: boolean;
15
28
  children?: React.ReactNode;
29
+ 'data-testid'?: string;
16
30
  }
17
- export declare const Tag: React.FC<TagProps>;
18
- export declare const CheckableTag: React.FC<CheckableTagProps>;
31
+ declare const TagLiveRegion: React.FC;
32
+ export declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLElement>>;
33
+ export declare const CheckableTag: React.ForwardRefExoticComponent<CheckableTagProps & React.RefAttributes<HTMLSpanElement>>;
34
+ export { TagLiveRegion };
@@ -85,6 +85,8 @@ export interface TreeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'o
85
85
  title?: string;
86
86
  children?: string;
87
87
  };
88
+ /** Test ID for the component */
89
+ 'data-testid'?: string;
88
90
  }
89
91
  export interface TreeNodeProps {
90
92
  /** Unique key for the node (uses React's key prop) */
@@ -1,19 +1,28 @@
1
1
  import { default as React } from 'react';
2
2
  import { TreeDataNode } from './Tree';
3
3
  export type TreeSelectSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
- export type TreeSelectColor = 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';
4
+ export type TreeSelectColor = 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error';
5
5
  export type TreeSelectStatus = 'error' | 'warning';
6
+ export type TreeSelectVariant = 'outlined' | 'filled' | 'borderless';
6
7
  export type ShowCheckedStrategy = 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD';
7
8
  export interface TreeSelectFieldNames {
8
9
  label?: string;
9
10
  value?: string;
10
11
  children?: string;
11
12
  }
13
+ /** Value type when labelInValue is true */
14
+ export interface LabeledValue {
15
+ value: string;
16
+ label: React.ReactNode;
17
+ }
12
18
  export interface TreeSelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
13
19
  treeData: TreeDataNode[];
14
- value?: string | string[];
15
- defaultValue?: string | string[];
16
- onChange?: (value: string | string[], labels: React.ReactNode[]) => void;
20
+ value?: string | string[] | LabeledValue | LabeledValue[];
21
+ defaultValue?: string | string[] | LabeledValue | LabeledValue[];
22
+ onChange?: (value: string | string[] | LabeledValue | LabeledValue[], labels: React.ReactNode[], extra?: {
23
+ triggerValue: string;
24
+ triggerNode: TreeDataNode;
25
+ }) => void;
17
26
  multiple?: boolean;
18
27
  treeCheckable?: boolean;
19
28
  treeCheckStrictly?: boolean;
@@ -32,10 +41,26 @@ export interface TreeSelectProps extends Omit<React.HTMLAttributes<HTMLDivElemen
32
41
  size?: TreeSelectSize;
33
42
  color?: TreeSelectColor;
34
43
  status?: TreeSelectStatus;
44
+ /** Visual variant style */
45
+ variant?: TreeSelectVariant;
46
+ /** Ghost style with no background */
47
+ ghost?: boolean;
48
+ /** Maximum number of tags to show (multiple/treeCheckable mode) */
35
49
  maxTagCount?: number | 'responsive';
36
50
  maxTagPlaceholder?: React.ReactNode | ((omittedValues: string[]) => React.ReactNode);
51
+ /** Maximum number of selections allowed */
52
+ maxCount?: number;
53
+ /** Return object with value and label instead of just value */
37
54
  labelInValue?: boolean;
55
+ /** Custom tag render function */
56
+ tagRender?: (props: {
57
+ label: React.ReactNode;
58
+ value: string;
59
+ closable: boolean;
60
+ onClose: () => void;
61
+ }) => React.ReactNode;
38
62
  treeLine?: boolean;
63
+ /** Show tree node icon */
39
64
  treeIcon?: boolean;
40
65
  loadData?: (node: TreeDataNode) => Promise<void>;
41
66
  fieldNames?: TreeSelectFieldNames;
@@ -51,3 +76,9 @@ export interface TreeSelectProps extends Omit<React.HTMLAttributes<HTMLDivElemen
51
76
  'data-testid'?: string;
52
77
  }
53
78
  export declare const TreeSelect: React.ForwardRefExoticComponent<TreeSelectProps & React.RefAttributes<HTMLDivElement>>;
79
+ export declare const TreeSelectComponent: React.ForwardRefExoticComponent<TreeSelectProps & React.RefAttributes<HTMLDivElement>> & {
80
+ SHOW_ALL: "SHOW_ALL";
81
+ SHOW_PARENT: "SHOW_PARENT";
82
+ SHOW_CHILD: "SHOW_CHILD";
83
+ };
84
+ export { TreeSelectComponent as default };
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export type { ChatProps } from './components/Chat';
23
23
  export { ColorPicker } from './components/ColorPicker';
24
24
  export type { ColorPickerProps } from './components/ColorPicker';
25
25
  export { Card } from './components/Card';
26
- export type { CardProps, CardGridProps } from './components/Card';
26
+ export type { CardProps, CardGridProps, CardMetaProps, CardSize, CardVariant, CardTabItem } from './components/Card';
27
27
  export { Cascader } from './components/Cascader';
28
28
  export type { CascaderProps, CascaderOption } from './components/Cascader';
29
29
  export { Chart } from './components/Chart';
@@ -164,8 +164,8 @@ export { Textarea } from './components/Textarea';
164
164
  export type { TextareaProps } from './components/Textarea';
165
165
  export { TextRotate } from './components/TextRotate';
166
166
  export type { TextRotateProps, TextRotateDuration } from './components/TextRotate';
167
- export { Tag, CheckableTag } from './components/Tag';
168
- export type { TagProps, CheckableTagProps } from './components/Tag';
167
+ export { Tag, CheckableTag, TagLiveRegion } from './components/Tag';
168
+ export type { TagProps, CheckableTagProps, TagSize, TagColor, TagVariant } from './components/Tag';
169
169
  export { ThemeController } from './components/ThemeController';
170
170
  export type { ThemeControllerSwapProps, ThemeControllerDropdownProps, ThemeControllerToggleProps } from './components/ThemeController';
171
171
  export { TimePicker } from './components/TimePicker';
@@ -182,8 +182,8 @@ export { Transfer } from './components/Transfer';
182
182
  export type { TransferProps, TransferItem } from './components/Transfer';
183
183
  export { Tree } from './components/Tree';
184
184
  export type { TreeProps, TreeDataNode } from './components/Tree';
185
- export { TreeSelect } from './components/TreeSelect';
186
- export type { TreeSelectProps, TreeSelectSize, TreeSelectColor, TreeSelectStatus, TreeSelectFieldNames, ShowCheckedStrategy, } from './components/TreeSelect';
185
+ export { TreeSelect, TreeSelectComponent } from './components/TreeSelect';
186
+ export type { TreeSelectProps, TreeSelectSize, TreeSelectColor, TreeSelectStatus, TreeSelectVariant, TreeSelectFieldNames, ShowCheckedStrategy, LabeledValue, } from './components/TreeSelect';
187
187
  export { Typography } from './components/Typography';
188
188
  export type { TypographyProps, TitleProps, ParagraphProps, TextProps, TypographyLinkProps, TypographySize, TitleLevel, } from './components/Typography';
189
189
  export { Upload } from './components/Upload';
package/dist/index.js CHANGED
@@ -6,14 +6,14 @@ import { Avatar as n, AvatarGroup as s } from "./index6.js";
6
6
  import { Badge as l } from "./index7.js";
7
7
  import { Breadcrumb as c } from "./index8.js";
8
8
  import { Button as T } from "./index9.js";
9
- import { CopyButton as P } from "./index10.js";
9
+ import { CopyButton as S } from "./index10.js";
10
10
  import { Checkbox as b } from "./index11.js";
11
11
  import { Chat as y } from "./index12.js";
12
12
  import { ColorPicker as h } from "./index13.js";
13
- import { Card as v } from "./index14.js";
14
- import { Cascader as R } from "./index15.js";
13
+ import { Card as w } from "./index14.js";
14
+ import { Cascader as F } from "./index15.js";
15
15
  import { Chart as I } from "./index16.js";
16
- import { Carousel as L } from "./index17.js";
16
+ import { Carousel as A } from "./index17.js";
17
17
  import { Collapse as H } from "./index18.js";
18
18
  import { Container as K } from "./index19.js";
19
19
  import { ContextMenu as N } from "./index20.js";
@@ -32,13 +32,13 @@ import { Flex as io } from "./index32.js";
32
32
  import { FloatButton as so } from "./index33.js";
33
33
  import { Footer as lo } from "./index34.js";
34
34
  import { Form as Co, useFormInstance as To } from "./index35.js";
35
- import { Col as Po, Grid as So, Row as bo } from "./index36.js";
35
+ import { Col as So, Grid as Po, Row as bo } from "./index36.js";
36
36
  import { Hero as yo } from "./index37.js";
37
37
  import { HoverGallery as ho } from "./index38.js";
38
- import { Image as vo } from "./index39.js";
39
- import { Indicator as Ro } from "./index40.js";
38
+ import { Image as wo } from "./index39.js";
39
+ import { Indicator as Fo } from "./index40.js";
40
40
  import { Dropdown as Io } from "./index41.js";
41
- import { Empty as Lo } from "./index42.js";
41
+ import { Empty as Ao } from "./index42.js";
42
42
  import { Input as Ho } from "./index43.js";
43
43
  import { InputNumber as Ko } from "./index44.js";
44
44
  import { Join as No } from "./index45.js";
@@ -58,13 +58,13 @@ import { Modal as ur } from "./index58.js";
58
58
  import { Navbar as dr } from "./index59.js";
59
59
  import { notification as Cr } from "./index60.js";
60
60
  import { OTPInput as gr } from "./index61.js";
61
- import { Pagination as Sr } from "./index62.js";
61
+ import { Pagination as Pr } from "./index62.js";
62
62
  import { PageLayout as kr } from "./index63.js";
63
63
  import { Popconfirm as Dr } from "./index64.js";
64
- import { Popover as wr } from "./index65.js";
65
- import { Progress as Fr } from "./index66.js";
64
+ import { Popover as vr } from "./index65.js";
65
+ import { Progress as Rr } from "./index66.js";
66
66
  import { QRCode as Br } from "./index67.js";
67
- import { Radio as Ar } from "./index68.js";
67
+ import { Radio as Lr } from "./index68.js";
68
68
  import { RadialProgress as Mr } from "./index69.js";
69
69
  import { Range as Gr } from "./index70.js";
70
70
  import { Rating as Wr } from "./index71.js";
@@ -81,31 +81,31 @@ import { Table as pe } from "./index81.js";
81
81
  import { Tabs as fe } from "./index82.js";
82
82
  import { Textarea as ae } from "./index83.js";
83
83
  import { TextRotate as ne } from "./index84.js";
84
- import { CheckableTag as ue, Tag as le } from "./index85.js";
85
- import { ThemeController as ce } from "./index86.js";
86
- import { TimePicker as Te } from "./index87.js";
84
+ import { CheckableTag as ue, Tag as le, TagLiveRegion as de } from "./index85.js";
85
+ import { ThemeController as Ce } from "./index86.js";
86
+ import { TimePicker as ge } from "./index87.js";
87
87
  import { Timeline as Pe } from "./index88.js";
88
- import { Toggle as be } from "./index89.js";
89
- import { Tour as ye } from "./index90.js";
90
- import { Tooltip as he } from "./index91.js";
91
- import { Transfer as ve } from "./index92.js";
92
- import { Tree as Re } from "./index93.js";
93
- import { TreeSelect as Ie } from "./index94.js";
94
- import { Typography as Le } from "./index95.js";
95
- import { Upload as He } from "./index96.js";
96
- import { VirtualList as Ke } from "./index97.js";
97
- import { Watermark as Ne } from "./index98.js";
98
- import { Hide as ze, Show as Ee } from "./index99.js";
99
- import { useBreakpoint as Qe } from "./index100.js";
100
- import { useDisclosure as Ve } from "./index101.js";
101
- import { useClipboard as qe } from "./index102.js";
102
- import { useLocalStorage as Ye } from "./index103.js";
103
- import { useDebounce as _e } from "./index104.js";
104
- import { useClickOutside as ot } from "./index105.js";
105
- import { usePrevious as et } from "./index106.js";
106
- import { useHover as pt } from "./index107.js";
107
- import { useKeyPress as ft, useKeyPressCallback as xt } from "./index108.js";
108
- import { useWindowSize as it } from "./index109.js";
88
+ import { Toggle as ke } from "./index89.js";
89
+ import { Tour as De } from "./index90.js";
90
+ import { Tooltip as ve } from "./index91.js";
91
+ import { Transfer as Re } from "./index92.js";
92
+ import { Tree as Be } from "./index93.js";
93
+ import { TreeSelect as Le, TreeSelectComponent as Ae } from "./index94.js";
94
+ import { Typography as He } from "./index95.js";
95
+ import { Upload as Ke } from "./index96.js";
96
+ import { VirtualList as Ne } from "./index97.js";
97
+ import { Watermark as ze } from "./index98.js";
98
+ import { Hide as Je, Show as Qe } from "./index99.js";
99
+ import { useBreakpoint as Ve } from "./index100.js";
100
+ import { useDisclosure as qe } from "./index101.js";
101
+ import { useClipboard as Ye } from "./index102.js";
102
+ import { useLocalStorage as _e } from "./index103.js";
103
+ import { useDebounce as ot } from "./index104.js";
104
+ import { useClickOutside as et } from "./index105.js";
105
+ import { usePrevious as pt } from "./index106.js";
106
+ import { useHover as ft } from "./index107.js";
107
+ import { useKeyPress as at, useKeyPressCallback as it } from "./index108.js";
108
+ import { useWindowSize as st } from "./index109.js";
109
109
  export {
110
110
  e as Affix,
111
111
  f as Alert,
@@ -117,20 +117,20 @@ export {
117
117
  c as Breadcrumb,
118
118
  pr as Browser,
119
119
  T as Button,
120
- v as Card,
121
- L as Carousel,
122
- R as Cascader,
120
+ w as Card,
121
+ A as Carousel,
122
+ F as Cascader,
123
123
  I as Chart,
124
124
  y as Chat,
125
125
  ue as CheckableTag,
126
126
  b as Checkbox,
127
127
  fr as Code,
128
- Po as Col,
128
+ So as Col,
129
129
  H as Collapse,
130
130
  h as ColorPicker,
131
131
  K as Container,
132
132
  N as ContextMenu,
133
- P as CopyButton,
133
+ S as CopyButton,
134
134
  z as Countdown,
135
135
  J as DatePicker,
136
136
  U as Descriptions,
@@ -139,7 +139,7 @@ export {
139
139
  X as Dock,
140
140
  $ as Drawer,
141
141
  Io as Dropdown,
142
- Lo as Empty,
142
+ Ao as Empty,
143
143
  to as Fieldset,
144
144
  mo as FileInput,
145
145
  xo as Filter,
@@ -147,12 +147,12 @@ export {
147
147
  so as FloatButton,
148
148
  lo as Footer,
149
149
  Co as Form,
150
- So as Grid,
150
+ Po as Grid,
151
151
  yo as Hero,
152
- ze as Hide,
152
+ Je as Hide,
153
153
  ho as HoverGallery,
154
- vo as Image,
155
- Ro as Indicator,
154
+ wo as Image,
155
+ Fo as Indicator,
156
156
  Ho as Input,
157
157
  Ko as InputNumber,
158
158
  No as Join,
@@ -168,21 +168,21 @@ export {
168
168
  dr as Navbar,
169
169
  gr as OTPInput,
170
170
  kr as PageLayout,
171
- Sr as Pagination,
171
+ Pr as Pagination,
172
172
  ar as Phone,
173
173
  Dr as Popconfirm,
174
- wr as Popover,
175
- Fr as Progress,
174
+ vr as Popover,
175
+ Rr as Progress,
176
176
  Br as QRCode,
177
177
  Mr as RadialProgress,
178
- Ar as Radio,
178
+ Lr as Radio,
179
179
  Gr as Range,
180
180
  Wr as Rating,
181
181
  Or as Result,
182
182
  bo as Row,
183
183
  Qr as Segmented,
184
184
  Er as Select,
185
- Ee as Show,
185
+ Qe as Show,
186
186
  ro as SidebarDrawer,
187
187
  Vr as Skeleton,
188
188
  qr as Space,
@@ -193,35 +193,37 @@ export {
193
193
  pe as Table,
194
194
  fe as Tabs,
195
195
  le as Tag,
196
+ de as TagLiveRegion,
196
197
  ne as TextRotate,
197
198
  ae as Textarea,
198
- ce as ThemeController,
199
- Te as TimePicker,
199
+ Ce as ThemeController,
200
+ ge as TimePicker,
200
201
  Pe as Timeline,
201
- be as Toggle,
202
- he as Tooltip,
203
- ye as Tour,
204
- ve as Transfer,
205
- Re as Tree,
206
- Ie as TreeSelect,
207
- Le as Typography,
208
- He as Upload,
209
- Ke as VirtualList,
210
- Ne as Watermark,
202
+ ke as Toggle,
203
+ ve as Tooltip,
204
+ De as Tour,
205
+ Re as Transfer,
206
+ Be as Tree,
207
+ Le as TreeSelect,
208
+ Ae as TreeSelectComponent,
209
+ He as Typography,
210
+ Ke as Upload,
211
+ Ne as VirtualList,
212
+ ze as Watermark,
211
213
  nr as Window,
212
214
  Cr as notification,
213
- Qe as useBreakpoint,
214
- ot as useClickOutside,
215
- qe as useClipboard,
216
- _e as useDebounce,
217
- Ve as useDisclosure,
215
+ Ve as useBreakpoint,
216
+ et as useClickOutside,
217
+ Ye as useClipboard,
218
+ ot as useDebounce,
219
+ qe as useDisclosure,
218
220
  To as useFormInstance,
219
- pt as useHover,
220
- ft as useKeyPress,
221
- xt as useKeyPressCallback,
222
- Ye as useLocalStorage,
223
- et as usePrevious,
221
+ ft as useHover,
222
+ at as useKeyPress,
223
+ it as useKeyPressCallback,
224
+ _e as useLocalStorage,
225
+ pt as usePrevious,
224
226
  Qo as useSiderContext,
225
- it as useWindowSize
227
+ st as useWindowSize
226
228
  };
227
229
  //# sourceMappingURL=index.js.map
package/dist/index11.js CHANGED
@@ -2,49 +2,49 @@ import { jsxs as p, jsx as c } from "react/jsx-runtime";
2
2
  import R, { forwardRef as G, useContext as $, createContext as B } from "react";
3
3
  const y = B(null);
4
4
  function I({
5
- children: f,
6
- value: o,
7
- defaultValue: x,
5
+ children: x,
6
+ value: r,
7
+ defaultValue: b,
8
8
  onChange: d,
9
- disabled: n = !1,
9
+ disabled: a = !1,
10
10
  options: h,
11
- direction: a = "vertical",
11
+ direction: s = "vertical",
12
12
  className: u = ""
13
13
  }) {
14
- const [C, g] = R.useState(x || []), r = o !== void 0 ? o : C, t = {
15
- value: r,
14
+ const [C, g] = R.useState(b || []), l = r !== void 0 ? r : C, t = {
15
+ value: l,
16
16
  onChange: (i, e) => {
17
- const k = e ? [...r, i] : r.filter((b) => b !== i);
18
- o === void 0 && g(k), d?.(k);
17
+ const k = e ? [...l, i] : l.filter((f) => f !== i);
18
+ r === void 0 && g(k), d?.(k);
19
19
  },
20
- disabled: n
20
+ disabled: a
21
21
  };
22
22
  if (h) {
23
- const i = a === "horizontal" ? "flex flex-row flex-wrap gap-4" : "flex flex-col";
24
- return /* @__PURE__ */ c(y.Provider, { value: t, children: /* @__PURE__ */ c("div", { className: `${i} ${u}`.trim(), children: h.map((e) => typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ p("label", { className: "label cursor-pointer justify-start gap-2", children: [
23
+ const i = s === "horizontal" ? "flex flex-row flex-wrap gap-4" : "flex flex-col";
24
+ return /* @__PURE__ */ c(y.Provider, { value: t, children: /* @__PURE__ */ c("div", { className: `${i} ${u}`.trim(), children: h.map((e) => typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ p("label", { className: "flex items-center cursor-pointer gap-2", children: [
25
25
  /* @__PURE__ */ c(m, { value: e }),
26
- /* @__PURE__ */ c("span", { className: "label-text", children: e })
27
- ] }, e) : /* @__PURE__ */ p("label", { className: "label cursor-pointer justify-start gap-2", children: [
26
+ /* @__PURE__ */ c("span", { children: e })
27
+ ] }, e) : /* @__PURE__ */ p("label", { className: "flex items-center cursor-pointer gap-2", children: [
28
28
  /* @__PURE__ */ c(m, { value: e.value, disabled: e.disabled }),
29
- /* @__PURE__ */ c("span", { className: "label-text", children: e.label })
29
+ /* @__PURE__ */ c("span", { children: e.label })
30
30
  ] }, e.value)) }) });
31
31
  }
32
- return /* @__PURE__ */ c(y.Provider, { value: t, children: /* @__PURE__ */ c("div", { className: u, children: f }) });
32
+ return /* @__PURE__ */ c(y.Provider, { value: t, children: /* @__PURE__ */ c("div", { className: u, children: x }) });
33
33
  }
34
34
  const m = G(
35
35
  ({
36
- children: f,
37
- size: o,
38
- color: x,
36
+ children: x,
37
+ size: r,
38
+ color: b,
39
39
  indeterminate: d = !1,
40
- swap: n,
40
+ swap: a,
41
41
  className: h = "",
42
- value: a,
42
+ value: s,
43
43
  checked: u,
44
44
  onChange: C,
45
45
  disabled: g,
46
- ...r
47
- }, l) => {
46
+ ...l
47
+ }, o) => {
48
48
  const t = $(y), i = {
49
49
  xs: "checkbox-xs",
50
50
  sm: "checkbox-sm",
@@ -62,58 +62,58 @@ const m = G(
62
62
  error: "checkbox-error"
63
63
  }, k = [
64
64
  "checkbox",
65
- o && i[o],
66
- x && e[x]
67
- ].filter(Boolean).join(" "), b = t && a !== void 0 && (typeof a == "string" || typeof a == "number") ? t.value?.includes(a) ?? !1 : u, N = t?.disabled || g, v = (s) => {
68
- t && a !== void 0 && (typeof a == "string" || typeof a == "number") && t.onChange?.(a, s.target.checked), C?.(s);
65
+ r && i[r],
66
+ b && e[b]
67
+ ].filter(Boolean).join(" "), f = t && s !== void 0 && (typeof s == "string" || typeof s == "number") ? t.value?.includes(s) ?? !1 : u, v = t?.disabled || g, w = (n) => {
68
+ t && s !== void 0 && (typeof s == "string" || typeof s == "number") && t.onChange?.(s, n.target.checked), C?.(n);
69
69
  }, V = R.useCallback(
70
- (s) => {
71
- s && (s.indeterminate = d), typeof l == "function" ? l(s) : l && (l.current = s);
70
+ (n) => {
71
+ n && (n.indeterminate = d), typeof o == "function" ? o(n) : o && (o.current = n);
72
72
  },
73
- [d, l]
74
- ), j = d ? "indeterminate" : b ? "checked" : "unchecked";
75
- if (n) {
76
- const s = [
73
+ [d, o]
74
+ ), N = d ? "indeterminate" : f ? "checked" : "unchecked";
75
+ if (a) {
76
+ const n = [
77
77
  "swap",
78
- n.effect === "rotate" && "swap-rotate",
79
- n.effect === "flip" && "swap-flip",
78
+ a.effect === "rotate" && "swap-rotate",
79
+ a.effect === "flip" && "swap-flip",
80
80
  h
81
81
  ].filter(Boolean).join(" ");
82
- return /* @__PURE__ */ p("label", { className: s, children: [
82
+ return /* @__PURE__ */ p("label", { className: n, children: [
83
83
  /* @__PURE__ */ c(
84
84
  "input",
85
85
  {
86
- ref: l,
86
+ ref: o,
87
87
  type: "checkbox",
88
- checked: b,
89
- onChange: v,
90
- disabled: N,
91
- "data-state": j,
92
- ...r
88
+ checked: f,
89
+ onChange: w,
90
+ disabled: v,
91
+ "data-state": N,
92
+ ...l
93
93
  }
94
94
  ),
95
- /* @__PURE__ */ c("div", { className: "swap-on", children: n.on }),
96
- /* @__PURE__ */ c("div", { className: "swap-off", children: n.off })
95
+ /* @__PURE__ */ c("div", { className: "swap-on", children: a.on }),
96
+ /* @__PURE__ */ c("div", { className: "swap-off", children: a.off })
97
97
  ] });
98
98
  }
99
- const w = /* @__PURE__ */ c(
99
+ const j = /* @__PURE__ */ c(
100
100
  "input",
101
101
  {
102
102
  ref: V,
103
103
  type: "checkbox",
104
104
  className: k,
105
- value: a,
106
- checked: b,
107
- onChange: v,
108
- disabled: N,
109
- "data-state": j,
110
- ...r
105
+ value: s,
106
+ checked: f,
107
+ onChange: w,
108
+ disabled: v,
109
+ "data-state": N,
110
+ ...l
111
111
  }
112
112
  );
113
- return f ? /* @__PURE__ */ p("label", { className: `label cursor-pointer justify-start gap-2 ${h}`, children: [
114
- w,
115
- /* @__PURE__ */ c("span", { className: "label-text", children: f })
116
- ] }) : w;
113
+ return x ? /* @__PURE__ */ p("label", { className: `flex items-center cursor-pointer gap-2 ${h}`, children: [
114
+ j,
115
+ /* @__PURE__ */ c("span", { children: x })
116
+ ] }) : j;
117
117
  }
118
118
  );
119
119
  m.displayName = "Checkbox";