@pnkx-lib/ui 1.9.66 → 1.9.68
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/dist/style.css +1 -1
- package/es/chunks/{Upload-D0erjks6.js → AntdIcon-C_gQ5ue_.js} +2957 -106
- package/es/chunks/Switch-B6W4c5eS.js +259 -0
- package/es/chunks/{index-B349so_8.js → index-DqjSCJir.js} +94 -4698
- package/es/fields/index.js +2 -2
- package/es/index.js +3 -3
- package/es/ui/index.js +2 -2
- package/package.json +1 -1
- package/types/fields.d.ts +4 -1
- package/types/index.d.ts +29 -10
- package/types/ui.d.ts +25 -9
- package/es/chunks/Switch-DQhQEc3A.js +0 -153
package/es/fields/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export { C as CheckboxField, D as DatePickerField, I as Input, P as PnkxField, R as RangePickerField, b as TinyMCE } from '../chunks/
|
2
|
-
export { R as RadioGroup, S as Select, a as Switch } from '../chunks/Switch-
|
1
|
+
export { C as CheckboxField, D as DatePickerField, I as Input, P as PnkxField, R as RangePickerField, b as TinyMCE } from '../chunks/AntdIcon-C_gQ5ue_.js';
|
2
|
+
export { R as RadioGroup, S as Select, a as Switch, U as UploadField } from '../chunks/Switch-B6W4c5eS.js';
|
package/es/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
export { Z as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, Y as CategoryStatus, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, W as Watermark, t as typeColorMap } from './chunks/index-
|
2
|
-
export { C as CheckboxField, D as DatePickerField, E as ErrorMessage, I as Input, L as Label, P as PnkxField, R as RangePickerField, a as TINY_API, b as TinyMCE, T as Typography } from './chunks/
|
1
|
+
export { Z as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, Y as CategoryStatus, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, W as Watermark, t as typeColorMap } from './chunks/index-DqjSCJir.js';
|
2
|
+
export { C as CheckboxField, D as DatePickerField, E as ErrorMessage, I as Input, L as Label, P as PnkxField, R as RangePickerField, a as TINY_API, b as TinyMCE, T as Typography } from './chunks/AntdIcon-C_gQ5ue_.js';
|
3
3
|
import 'react-router';
|
4
4
|
export { P as PAGE_INDEX, b as PAGE_SIZE, c as SORT_BY, d as SORT_DESC, S as START_PAGE, a as START_PAGE_SIZE, T as TypeActionRowTable, u as useToast } from './chunks/table-B28OPA57.js';
|
5
|
-
export { R as RadioGroup, S as Select, a as Switch } from './chunks/Switch-
|
5
|
+
export { R as RadioGroup, S as Select, a as Switch, U as UploadField } from './chunks/Switch-B6W4c5eS.js';
|
6
6
|
export { u as useFiltersHandler, a as useMessage, b as useToggle } from './chunks/useToggle-C5Y4aFUQ.js';
|
package/es/ui/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { Z as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, Y as CategoryStatus, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, W as Watermark, t as typeColorMap } from '../chunks/index-
|
2
|
-
export { E as ErrorMessage, L as Label, a as TINY_API, T as Typography } from '../chunks/
|
1
|
+
export { Z as ActionRowTable, A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, Y as CategoryStatus, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, W as Watermark, t as typeColorMap } from '../chunks/index-DqjSCJir.js';
|
2
|
+
export { E as ErrorMessage, L as Label, a as TINY_API, T as Typography } from '../chunks/AntdIcon-C_gQ5ue_.js';
|
3
3
|
import 'react-router';
|
4
4
|
export { P as PAGE_INDEX, b as PAGE_SIZE, c as SORT_BY, d as SORT_DESC, S as START_PAGE, a as START_PAGE_SIZE, T as TypeActionRowTable } from '../chunks/table-B28OPA57.js';
|
package/package.json
CHANGED
package/types/fields.d.ts
CHANGED
@@ -128,7 +128,8 @@ export declare interface SelectFieldProps extends SelectProps {
|
|
128
128
|
label?: string;
|
129
129
|
required?: boolean;
|
130
130
|
afterOnChange?: (value: any) => void;
|
131
|
-
|
131
|
+
classNameContainer?: string;
|
132
|
+
classNameSelect?: string;
|
132
133
|
}
|
133
134
|
|
134
135
|
export declare const Switch: (props: SwitchProps) => JSX.Element;
|
@@ -179,6 +180,8 @@ declare type TPositionRadio = "before" | "after";
|
|
179
180
|
|
180
181
|
declare type TSize = "small" | "medium" | "large";
|
181
182
|
|
183
|
+
export declare const UploadField: (props: UploadFieldProps) => JSX.Element;
|
184
|
+
|
182
185
|
export declare interface UploadFieldProps extends Omit<UploadProps, "value" | "onChange" | "fileList"> {
|
183
186
|
field?: ControllerRenderProps<any, any>;
|
184
187
|
formState?: UseFormStateReturn<any>;
|
package/types/index.d.ts
CHANGED
@@ -47,7 +47,7 @@ import { JSX as JSX_2 } from 'react';
|
|
47
47
|
import { MenuDividerProps } from 'antd/es/menu';
|
48
48
|
import { MenuItemGroupProps } from 'rc-menu/lib/MenuItemGroup';
|
49
49
|
import { MenuItemProps as MenuItemProps_2 } from 'antd/es/menu';
|
50
|
-
import { MenuProps as
|
50
|
+
import { MenuProps as MenuProps_3 } from 'antd/es/menu';
|
51
51
|
import { ModalProps as ModalProps_2 } from 'antd';
|
52
52
|
import { Pagination as Pagination_2 } from 'antd';
|
53
53
|
import { PaginationFilters as PaginationFilters_2 } from '../../../../../../../../../../../src/components/hooks';
|
@@ -445,20 +445,37 @@ export declare type LayoutProps = BaseProps_8 & BasicProps;
|
|
445
445
|
|
446
446
|
export declare const Menu: CompoundedMenu;
|
447
447
|
|
448
|
-
export declare type MenuComponentProps = ExtraProps &
|
448
|
+
export declare type MenuComponentProps = ExtraProps & MenuProps_2;
|
449
449
|
|
450
450
|
declare const MenuItem: FC<MenuItemProps>;
|
451
451
|
|
452
452
|
export declare type MenuItemProps = MenuItemProps_2;
|
453
453
|
|
454
|
-
export declare type MenuProps =
|
454
|
+
export declare type MenuProps = {
|
455
|
+
name: string;
|
456
|
+
href: string;
|
457
|
+
icon: default_2.ReactNode;
|
458
|
+
current: boolean;
|
459
|
+
subMenu?: Array<{
|
460
|
+
name: string;
|
461
|
+
href: string;
|
462
|
+
icon: default_2.ReactNode;
|
463
|
+
children?: Array<{
|
464
|
+
name: string;
|
465
|
+
href: string;
|
466
|
+
icon?: default_2.ReactNode;
|
467
|
+
}>;
|
468
|
+
}>;
|
469
|
+
};
|
470
|
+
|
471
|
+
declare type MenuProps_2 = MenuProps_3;
|
455
472
|
|
456
|
-
declare type
|
473
|
+
declare type MenuProps_4 = {
|
457
474
|
name: string;
|
458
475
|
href: string;
|
459
476
|
icon: React.ReactNode;
|
460
477
|
current: boolean;
|
461
|
-
subMenu
|
478
|
+
subMenu?: Array<{
|
462
479
|
name: string;
|
463
480
|
href: string;
|
464
481
|
icon: React.ReactNode;
|
@@ -630,14 +647,15 @@ export declare interface SelectFieldProps extends SelectProps {
|
|
630
647
|
label?: string;
|
631
648
|
required?: boolean;
|
632
649
|
afterOnChange?: (value: any) => void;
|
633
|
-
|
650
|
+
classNameContainer?: string;
|
651
|
+
classNameSelect?: string;
|
634
652
|
}
|
635
653
|
|
636
654
|
export declare const Sidebar: ({ children, menu }: SidebarProps) => JSX.Element;
|
637
655
|
|
638
656
|
export declare interface SidebarProps {
|
639
657
|
children?: React.ReactNode;
|
640
|
-
menu: Array<
|
658
|
+
menu: Array<MenuProps_4>;
|
641
659
|
}
|
642
660
|
|
643
661
|
declare type SingleCascaderProps = CascaderProps<DefaultOptionType, string> & {
|
@@ -706,7 +724,7 @@ declare type TabItem = {
|
|
706
724
|
disabled?: boolean;
|
707
725
|
};
|
708
726
|
|
709
|
-
export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey,
|
727
|
+
export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey, editable, onSave, titleSettingTableModal, showSetting, setColumns, renderHeadingSearch, rightHeadingContent, status, schema, menu, initialValueForm, ...rest }: TableCommonProps<T>) => JSX.Element;
|
710
728
|
|
711
729
|
export declare type TableColumnsType<T> = TableColumnsType_2<T> & TableColumnsTypeEditable<T>;
|
712
730
|
|
@@ -729,7 +747,6 @@ export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "column
|
|
729
747
|
onSelect: (newSelectedRowKeys: default_2.Key[]) => void;
|
730
748
|
onRowClick?: (record: T) => void;
|
731
749
|
rowKey?: string | ((record: T) => string);
|
732
|
-
className?: string;
|
733
750
|
editable?: boolean;
|
734
751
|
onSave?: (data: T) => void;
|
735
752
|
titleSettingTableModal?: string;
|
@@ -739,7 +756,7 @@ export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "column
|
|
739
756
|
rightHeadingContent: ReactNode;
|
740
757
|
status?: number;
|
741
758
|
schema?: yup.AnyObjectSchema;
|
742
|
-
|
759
|
+
menu: Array<MenuProps>;
|
743
760
|
initialValueForm?: T;
|
744
761
|
}
|
745
762
|
|
@@ -834,6 +851,8 @@ export declare const Typography: {
|
|
834
851
|
Text: (props: TextProps) => JSX.Element;
|
835
852
|
};
|
836
853
|
|
854
|
+
export declare const UploadField: (props: UploadFieldProps) => JSX.Element;
|
855
|
+
|
837
856
|
export declare interface UploadFieldProps extends Omit<UploadProps, "value" | "onChange" | "fileList"> {
|
838
857
|
field?: ControllerRenderProps<any, any>;
|
839
858
|
formState?: UseFormStateReturn<any>;
|
package/types/ui.d.ts
CHANGED
@@ -38,7 +38,7 @@ import { JSX } from 'react/jsx-runtime';
|
|
38
38
|
import { MenuDividerProps } from 'antd/es/menu';
|
39
39
|
import { MenuItemGroupProps } from 'rc-menu/lib/MenuItemGroup';
|
40
40
|
import { MenuItemProps as MenuItemProps_2 } from 'antd/es/menu';
|
41
|
-
import { MenuProps as
|
41
|
+
import { MenuProps as MenuProps_3 } from 'antd/es/menu';
|
42
42
|
import { ModalProps as ModalProps_2 } from 'antd';
|
43
43
|
import { Pagination as Pagination_2 } from 'antd';
|
44
44
|
import { PaginationFilters } from '../../../../../../../../../../../src/components/hooks';
|
@@ -372,20 +372,37 @@ export declare type LayoutProps = BaseProps_8 & BasicProps;
|
|
372
372
|
|
373
373
|
export declare const Menu: CompoundedMenu;
|
374
374
|
|
375
|
-
export declare type MenuComponentProps = ExtraProps &
|
375
|
+
export declare type MenuComponentProps = ExtraProps & MenuProps_2;
|
376
376
|
|
377
377
|
declare const MenuItem: FC<MenuItemProps>;
|
378
378
|
|
379
379
|
export declare type MenuItemProps = MenuItemProps_2;
|
380
380
|
|
381
|
-
export declare type MenuProps =
|
381
|
+
export declare type MenuProps = {
|
382
|
+
name: string;
|
383
|
+
href: string;
|
384
|
+
icon: default_2.ReactNode;
|
385
|
+
current: boolean;
|
386
|
+
subMenu?: Array<{
|
387
|
+
name: string;
|
388
|
+
href: string;
|
389
|
+
icon: default_2.ReactNode;
|
390
|
+
children?: Array<{
|
391
|
+
name: string;
|
392
|
+
href: string;
|
393
|
+
icon?: default_2.ReactNode;
|
394
|
+
}>;
|
395
|
+
}>;
|
396
|
+
};
|
397
|
+
|
398
|
+
declare type MenuProps_2 = MenuProps_3;
|
382
399
|
|
383
|
-
declare type
|
400
|
+
declare type MenuProps_4 = {
|
384
401
|
name: string;
|
385
402
|
href: string;
|
386
403
|
icon: React.ReactNode;
|
387
404
|
current: boolean;
|
388
|
-
subMenu
|
405
|
+
subMenu?: Array<{
|
389
406
|
name: string;
|
390
407
|
href: string;
|
391
408
|
icon: React.ReactNode;
|
@@ -491,7 +508,7 @@ export declare const Sidebar: ({ children, menu }: SidebarProps) => JSX.Element;
|
|
491
508
|
|
492
509
|
export declare interface SidebarProps {
|
493
510
|
children?: React.ReactNode;
|
494
|
-
menu: Array<
|
511
|
+
menu: Array<MenuProps_4>;
|
495
512
|
}
|
496
513
|
|
497
514
|
declare type SingleCascaderProps = CascaderProps<DefaultOptionType, string> & {
|
@@ -548,7 +565,7 @@ declare type TabItem = {
|
|
548
565
|
disabled?: boolean;
|
549
566
|
};
|
550
567
|
|
551
|
-
export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey,
|
568
|
+
export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey, editable, onSave, titleSettingTableModal, showSetting, setColumns, renderHeadingSearch, rightHeadingContent, status, schema, menu, initialValueForm, ...rest }: TableCommonProps<T>) => JSX.Element;
|
552
569
|
|
553
570
|
export declare type TableColumnsType<T> = TableColumnsType_2<T> & TableColumnsTypeEditable<T>;
|
554
571
|
|
@@ -571,7 +588,6 @@ export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "column
|
|
571
588
|
onSelect: (newSelectedRowKeys: default_2.Key[]) => void;
|
572
589
|
onRowClick?: (record: T) => void;
|
573
590
|
rowKey?: string | ((record: T) => string);
|
574
|
-
className?: string;
|
575
591
|
editable?: boolean;
|
576
592
|
onSave?: (data: T) => void;
|
577
593
|
titleSettingTableModal?: string;
|
@@ -581,7 +597,7 @@ export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "column
|
|
581
597
|
rightHeadingContent: ReactNode;
|
582
598
|
status?: number;
|
583
599
|
schema?: yup.AnyObjectSchema;
|
584
|
-
|
600
|
+
menu: Array<MenuProps>;
|
585
601
|
initialValueForm?: T;
|
586
602
|
}
|
587
603
|
|
@@ -1,153 +0,0 @@
|
|
1
|
-
import { g as get, j as jsxRuntimeExports, L as Label, E as ErrorMessage, T as Typography, c as classNames } from './Upload-D0erjks6.js';
|
2
|
-
import { Select as Select$1, Radio, Switch as Switch$1 } from 'antd';
|
3
|
-
|
4
|
-
const Select = (props) => {
|
5
|
-
//! State
|
6
|
-
const {
|
7
|
-
field,
|
8
|
-
formState,
|
9
|
-
label,
|
10
|
-
required,
|
11
|
-
afterOnChange,
|
12
|
-
customStyleContainer,
|
13
|
-
...restProps
|
14
|
-
} = props;
|
15
|
-
const { name, value, onChange, onBlur } = field || {};
|
16
|
-
const { touchedFields, errors, isSubmitted } = formState || {};
|
17
|
-
const isTouched = get(touchedFields, name);
|
18
|
-
const errorMessage = get(errors, name)?.message;
|
19
|
-
//! Function
|
20
|
-
const handleChange = (val) => {
|
21
|
-
onChange?.(val);
|
22
|
-
afterOnChange?.(val);
|
23
|
-
};
|
24
|
-
const renderErrorMessage = () => {
|
25
|
-
if (!errorMessage) return null;
|
26
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
27
|
-
ErrorMessage,
|
28
|
-
{
|
29
|
-
errorMessage,
|
30
|
-
isTouched,
|
31
|
-
isSubmitted
|
32
|
-
}
|
33
|
-
);
|
34
|
-
};
|
35
|
-
//! Render
|
36
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: customStyleContainer, children: [
|
37
|
-
label && /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { label, required }),
|
38
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
39
|
-
Select$1,
|
40
|
-
{
|
41
|
-
onChange: handleChange,
|
42
|
-
onBlur,
|
43
|
-
value,
|
44
|
-
style: { width: "100%" },
|
45
|
-
optionLabelProp: "label",
|
46
|
-
status: (isTouched || isSubmitted) && Boolean(errorMessage) ? "error" : void 0,
|
47
|
-
...restProps
|
48
|
-
}
|
49
|
-
),
|
50
|
-
renderErrorMessage()
|
51
|
-
] });
|
52
|
-
};
|
53
|
-
|
54
|
-
const RadioGroup = (props) => {
|
55
|
-
//! State
|
56
|
-
const {
|
57
|
-
field,
|
58
|
-
formState,
|
59
|
-
customStyleRadio,
|
60
|
-
customStyleWrap = "",
|
61
|
-
afterOnChange,
|
62
|
-
options,
|
63
|
-
...restProps
|
64
|
-
} = props;
|
65
|
-
const { name, value, onChange } = field || {};
|
66
|
-
const { touchedFields, errors, isSubmitted } = formState || {};
|
67
|
-
const isTouched = get(touchedFields, name);
|
68
|
-
const errorMessage = get(errors, name)?.message;
|
69
|
-
//! Function
|
70
|
-
const handleChange = (e) => {
|
71
|
-
onChange?.(e);
|
72
|
-
afterOnChange?.(e?.target?.value);
|
73
|
-
};
|
74
|
-
const renderErrorMessage = () => {
|
75
|
-
if (!errorMessage) return null;
|
76
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
77
|
-
ErrorMessage,
|
78
|
-
{
|
79
|
-
errorMessage,
|
80
|
-
isTouched,
|
81
|
-
isSubmitted
|
82
|
-
}
|
83
|
-
);
|
84
|
-
};
|
85
|
-
//! Render
|
86
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: customStyleWrap, children: [
|
87
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Group, { onChange: handleChange, value, ...restProps, children: options.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
88
|
-
Radio,
|
89
|
-
{
|
90
|
-
value: item.value,
|
91
|
-
className: customStyleRadio,
|
92
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography.Text, { children: [
|
93
|
-
" ",
|
94
|
-
item.label
|
95
|
-
] })
|
96
|
-
},
|
97
|
-
`${name}-${item.value}`
|
98
|
-
)) }),
|
99
|
-
renderErrorMessage()
|
100
|
-
] });
|
101
|
-
};
|
102
|
-
|
103
|
-
const Switch = (props) => {
|
104
|
-
//! State
|
105
|
-
const {
|
106
|
-
field,
|
107
|
-
formState,
|
108
|
-
label,
|
109
|
-
required,
|
110
|
-
afterOnChange,
|
111
|
-
customStyleContainer,
|
112
|
-
customStyleSwitch,
|
113
|
-
disabled,
|
114
|
-
...restProps
|
115
|
-
} = props;
|
116
|
-
const { name, value, onChange } = field || {};
|
117
|
-
const { touchedFields, errors, isSubmitted } = formState || {};
|
118
|
-
const isTouched = get(touchedFields, name);
|
119
|
-
const errorMessage = get(errors, name)?.message;
|
120
|
-
//! Function
|
121
|
-
const handleChange = (checked) => {
|
122
|
-
onChange?.(checked);
|
123
|
-
afterOnChange?.(checked);
|
124
|
-
};
|
125
|
-
const renderErrorMessage = () => {
|
126
|
-
if (!errorMessage) return null;
|
127
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
128
|
-
ErrorMessage,
|
129
|
-
{
|
130
|
-
errorMessage,
|
131
|
-
isTouched,
|
132
|
-
isSubmitted
|
133
|
-
}
|
134
|
-
);
|
135
|
-
};
|
136
|
-
//! Render
|
137
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: customStyleContainer, children: [
|
138
|
-
label && /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { label, required }),
|
139
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
140
|
-
Switch$1,
|
141
|
-
{
|
142
|
-
checked: !!value,
|
143
|
-
onChange: handleChange,
|
144
|
-
className: classNames("focus:outline-none", customStyleSwitch),
|
145
|
-
disabled,
|
146
|
-
...restProps
|
147
|
-
}
|
148
|
-
),
|
149
|
-
renderErrorMessage()
|
150
|
-
] });
|
151
|
-
};
|
152
|
-
|
153
|
-
export { RadioGroup as R, Select as S, Switch as a };
|