@pnkx-lib/ui 1.9.0 → 1.9.2

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,4 @@
1
- import { g as get, j as jsxRuntimeExports, L as Label, E as ErrorMessage, T as Typography } from './Switch-za5Skgtp.js';
1
+ import { g as get, j as jsxRuntimeExports, L as Label, E as ErrorMessage, T as Typography } from './Switch-DQm0didM.js';
2
2
  import { Select as Select$1, Radio } from 'antd';
3
3
 
4
4
  const Select = (props) => {
@@ -3495,8 +3495,6 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
3495
3495
  return result;
3496
3496
  };
3497
3497
 
3498
- const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
3499
-
3500
3498
  /**
3501
3499
  * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
3502
3500
  *
@@ -3541,8 +3539,10 @@ function useFormState(props) {
3541
3539
  isValid: false,
3542
3540
  errors: false,
3543
3541
  });
3544
- useIsomorphicLayoutEffect$1(() => control._subscribe({
3545
- name: name,
3542
+ const _name = React__default.useRef(name);
3543
+ _name.current = name;
3544
+ React__default.useEffect(() => control._subscribe({
3545
+ name: _name.current,
3546
3546
  formState: _localProxyFormState.current,
3547
3547
  exact,
3548
3548
  callback: (formState) => {
@@ -3552,7 +3552,7 @@ function useFormState(props) {
3552
3552
  ...formState,
3553
3553
  });
3554
3554
  },
3555
- }), [name, disabled, exact]);
3555
+ }), [control, disabled, exact]);
3556
3556
  React__default.useEffect(() => {
3557
3557
  _localProxyFormState.current.isValid && control._setValid(true);
3558
3558
  }, [control]);
@@ -3592,17 +3592,19 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
3592
3592
  function useWatch(props) {
3593
3593
  const methods = useFormContext();
3594
3594
  const { control = methods.control, name, defaultValue, disabled, exact, } = props || {};
3595
+ const _name = React__default.useRef(name);
3595
3596
  const _defaultValue = React__default.useRef(defaultValue);
3596
- const [value, updateValue] = React__default.useState(control._getWatch(name, _defaultValue.current));
3597
- useIsomorphicLayoutEffect$1(() => control._subscribe({
3598
- name: name,
3597
+ _name.current = name;
3598
+ React__default.useEffect(() => control._subscribe({
3599
+ name: _name.current,
3599
3600
  formState: {
3600
3601
  values: true,
3601
3602
  },
3602
3603
  exact,
3603
3604
  callback: (formState) => !disabled &&
3604
- updateValue(generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current)),
3605
- }), [name, control, disabled, exact]);
3605
+ updateValue(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, _defaultValue.current)),
3606
+ }), [control, disabled, exact]);
3607
+ const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
3606
3608
  React__default.useEffect(() => control._removeUnmounted());
3607
3609
  return value;
3608
3610
  }
@@ -4418,7 +4420,6 @@ function createFormControl(props = {}) {
4418
4420
  let _formState = {
4419
4421
  submitCount: 0,
4420
4422
  isDirty: false,
4421
- isReady: false,
4422
4423
  isLoading: isFunction$1(_options.defaultValues),
4423
4424
  isValidating: false,
4424
4425
  isSubmitted: false,
@@ -4433,7 +4434,7 @@ function createFormControl(props = {}) {
4433
4434
  };
4434
4435
  const _fields = {};
4435
4436
  let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values)
4436
- ? cloneObject(_options.defaultValues || _options.values) || {}
4437
+ ? cloneObject(_options.values || _options.defaultValues) || {}
4437
4438
  : {};
4438
4439
  let _formValues = _options.shouldUnregister
4439
4440
  ? {}
@@ -5484,7 +5485,6 @@ function useForm(props = {}) {
5484
5485
  validatingFields: {},
5485
5486
  errors: props.errors || {},
5486
5487
  disabled: props.disabled || false,
5487
- isReady: false,
5488
5488
  defaultValues: isFunction$1(props.defaultValues)
5489
5489
  ? undefined
5490
5490
  : props.defaultValues,
@@ -5502,37 +5502,12 @@ function useForm(props = {}) {
5502
5502
  }
5503
5503
  const control = _formControl.current.control;
5504
5504
  control._options = props;
5505
- useIsomorphicLayoutEffect$1(() => {
5506
- const sub = control._subscribe({
5507
- formState: control._proxyFormState,
5508
- callback: () => updateFormState({ ...control._formState }),
5509
- reRenderRoot: true,
5510
- });
5511
- updateFormState((data) => ({
5512
- ...data,
5513
- isReady: true,
5514
- }));
5515
- control._formState.isReady = true;
5516
- return sub;
5517
- }, [control]);
5505
+ React__default.useLayoutEffect(() => control._subscribe({
5506
+ formState: control._proxyFormState,
5507
+ callback: () => updateFormState({ ...control._formState }),
5508
+ reRenderRoot: true,
5509
+ }), [control]);
5518
5510
  React__default.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
5519
- React__default.useEffect(() => {
5520
- if (props.mode) {
5521
- control._options.mode = props.mode;
5522
- }
5523
- if (props.reValidateMode) {
5524
- control._options.reValidateMode = props.reValidateMode;
5525
- }
5526
- if (props.errors && !isEmptyObject(props.errors)) {
5527
- control._setErrors(props.errors);
5528
- }
5529
- }, [control, props.errors, props.mode, props.reValidateMode]);
5530
- React__default.useEffect(() => {
5531
- props.shouldUnregister &&
5532
- control._subjects.state.next({
5533
- values: control._getWatch(),
5534
- });
5535
- }, [control, props.shouldUnregister]);
5536
5511
  React__default.useEffect(() => {
5537
5512
  if (control._proxyFormState.isDirty) {
5538
5513
  const isDirty = control._getDirty();
@@ -5552,7 +5527,12 @@ function useForm(props = {}) {
5552
5527
  else {
5553
5528
  control._resetDefaultValues();
5554
5529
  }
5555
- }, [control, props.values]);
5530
+ }, [props.values, control]);
5531
+ React__default.useEffect(() => {
5532
+ if (props.errors && !isEmptyObject(props.errors)) {
5533
+ control._setErrors(props.errors);
5534
+ }
5535
+ }, [props.errors, control]);
5556
5536
  React__default.useEffect(() => {
5557
5537
  if (!control._state.mount) {
5558
5538
  control._setValid();
@@ -5564,6 +5544,12 @@ function useForm(props = {}) {
5564
5544
  }
5565
5545
  control._removeUnmounted();
5566
5546
  });
5547
+ React__default.useEffect(() => {
5548
+ props.shouldUnregister &&
5549
+ control._subjects.state.next({
5550
+ values: control._getWatch(),
5551
+ });
5552
+ }, [props.shouldUnregister, control]);
5567
5553
  _formControl.current.formState = getProxyFormState(formState, control);
5568
5554
  return _formControl.current;
5569
5555
  }
@@ -1,2 +1,2 @@
1
- export { C as CheckboxField, D as DatePickerField, I as Input, P as PnkxField, R as RangePickerField, a as TinyMCE } from '../chunks/Switch-za5Skgtp.js';
2
- export { R as RadioGroup, S as Select } from '../chunks/Radio-D2me1zZ-.js';
1
+ export { C as CheckboxField, D as DatePickerField, I as Input, P as PnkxField, R as RangePickerField, a as TinyMCE } from '../chunks/Switch-DQm0didM.js';
2
+ export { R as RadioGroup, S as Select } from '../chunks/Radio-DA0U4ozV.js';
package/es/index.js CHANGED
@@ -1,6 +1,5 @@
1
- export { 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, 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/ErrorBoundary-CwQo6pE6.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 TinyMCE, T as Typography } from './chunks/Switch-za5Skgtp.js';
3
- import 'react-router-dom';
4
- export { R as RadioGroup, S as Select } from './chunks/Radio-D2me1zZ-.js';
1
+ export { 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, 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/ErrorBoundary-13MGAHnq.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 TinyMCE, T as Typography } from './chunks/Switch-DQm0didM.js';
3
+ export { R as RadioGroup, S as Select } from './chunks/Radio-DA0U4ozV.js';
5
4
  export { u as useToast } from './chunks/cloneDeep-BLYi2V0G.js';
6
5
  export { u as useFiltersHandler, a as useMessage } from './chunks/useMessage-D_-VT5B4.js';
package/es/ui/index.js CHANGED
@@ -1,3 +1,2 @@
1
- export { 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, 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/ErrorBoundary-CwQo6pE6.js';
2
- export { E as ErrorMessage, L as Label, T as Typography } from '../chunks/Switch-za5Skgtp.js';
3
- import 'react-router-dom';
1
+ export { 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, 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/ErrorBoundary-13MGAHnq.js';
2
+ export { E as ErrorMessage, L as Label, T as Typography } from '../chunks/Switch-DQm0didM.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.0",
4
+ "version": "1.9.2",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -85,7 +85,6 @@
85
85
  "antd": "^5.24.4",
86
86
  "react": "^18.3.1",
87
87
  "react-dom": "^18.3.1",
88
- "react-router-dom": "^7.6.0",
89
88
  "tailwindcss": "^4.0.17"
90
89
  },
91
90
  "dependencies": {
@@ -107,6 +106,7 @@
107
106
  "react-datepicker": "^4.16.0",
108
107
  "react-hook-form": "^7.54.2",
109
108
  "react-number-format": "^5.4.3",
109
+ "react-router": "^7.6.0",
110
110
  "tailwind-merge": "^3.3.0",
111
111
  "yup": "^1.6.1",
112
112
  "zustand": "^5.0.3"
package/types/index.d.ts CHANGED
@@ -202,19 +202,20 @@ export declare type BreadcrumbPropsUnion = BaseProps_6 & BreadcrumbProps;
202
202
 
203
203
  export declare type BreadcrumbSeparatorType = BreadcrumbSeparatorType_2;
204
204
 
205
- export declare const BulkAction: ({ quantity, handleRefresh, handleSend, handleSlash, handleProhibit, handleCheck, handleClose, handleDelete, handleUnLock, handleLock, }: BulkActionProps) => JSX.Element;
205
+ export declare const BulkAction: ({ quantity, handleRestore, handleSendApproval, handleCancelSendApproval, handleRefuseApproval, handleApproval, handleCancelApproval, handleDelete, handleActivate, handleInActivate, status, }: BulkActionProps) => JSX.Element;
206
206
 
207
207
  export declare interface BulkActionProps {
208
208
  quantity: number;
209
- handleRefresh?: () => void;
210
- handleSend?: () => void;
211
- handleSlash?: () => void;
212
- handleProhibit?: () => void;
213
- handleCheck?: () => void;
214
- handleClose?: () => void;
209
+ handleRestore?: () => void;
210
+ handleSendApproval?: () => void;
211
+ handleCancelSendApproval?: () => void;
212
+ handleRefuseApproval?: () => void;
213
+ handleApproval?: () => void;
214
+ handleCancelApproval?: () => void;
215
215
  handleDelete?: () => void;
216
- handleUnLock?: () => void;
217
- handleLock?: () => void;
216
+ handleActivate?: () => void;
217
+ handleInActivate?: () => void;
218
+ status?: number;
218
219
  }
219
220
 
220
221
  export declare const Button: default_3.FC<ButtonProps>;
@@ -264,11 +265,13 @@ export declare interface ConfirmModalProps extends ModalProps {
264
265
  content: string;
265
266
  titleCancelBtn?: string;
266
267
  titleSubmitBtn?: string;
267
- typeIcon: "success" | "error" | "warning" | "info";
268
+ typeIcon: ConfirmModalType;
268
269
  handleCancel?: () => void;
269
270
  handleSubmit?: () => void;
270
271
  }
271
272
 
273
+ export declare type ConfirmModalType = "success" | "error" | "warning" | "info";
274
+
272
275
  export declare const Container: default_3.FC<ContainerProps>;
273
276
 
274
277
  export declare interface ContainerProps {
package/types/ui.d.ts CHANGED
@@ -183,19 +183,20 @@ export declare type BreadcrumbPropsUnion = BaseProps_6 & BreadcrumbProps;
183
183
 
184
184
  export declare type BreadcrumbSeparatorType = BreadcrumbSeparatorType_2;
185
185
 
186
- export declare const BulkAction: ({ quantity, handleRefresh, handleSend, handleSlash, handleProhibit, handleCheck, handleClose, handleDelete, handleUnLock, handleLock, }: BulkActionProps) => JSX.Element;
186
+ export declare const BulkAction: ({ quantity, handleRestore, handleSendApproval, handleCancelSendApproval, handleRefuseApproval, handleApproval, handleCancelApproval, handleDelete, handleActivate, handleInActivate, status, }: BulkActionProps) => JSX.Element;
187
187
 
188
188
  export declare interface BulkActionProps {
189
189
  quantity: number;
190
- handleRefresh?: () => void;
191
- handleSend?: () => void;
192
- handleSlash?: () => void;
193
- handleProhibit?: () => void;
194
- handleCheck?: () => void;
195
- handleClose?: () => void;
190
+ handleRestore?: () => void;
191
+ handleSendApproval?: () => void;
192
+ handleCancelSendApproval?: () => void;
193
+ handleRefuseApproval?: () => void;
194
+ handleApproval?: () => void;
195
+ handleCancelApproval?: () => void;
196
196
  handleDelete?: () => void;
197
- handleUnLock?: () => void;
198
- handleLock?: () => void;
197
+ handleActivate?: () => void;
198
+ handleInActivate?: () => void;
199
+ status?: number;
199
200
  }
200
201
 
201
202
  export declare const Button: default_3.FC<ButtonProps>;
@@ -231,11 +232,13 @@ export declare interface ConfirmModalProps extends ModalProps {
231
232
  content: string;
232
233
  titleCancelBtn?: string;
233
234
  titleSubmitBtn?: string;
234
- typeIcon: "success" | "error" | "warning" | "info";
235
+ typeIcon: ConfirmModalType;
235
236
  handleCancel?: () => void;
236
237
  handleSubmit?: () => void;
237
238
  }
238
239
 
240
+ export declare type ConfirmModalType = "success" | "error" | "warning" | "info";
241
+
239
242
  export declare const Container: default_3.FC<ContainerProps>;
240
243
 
241
244
  export declare interface ContainerProps {