@pnkx-lib/ui 1.9.166 → 1.9.167

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,5 +1,5 @@
1
1
  import { i as get, j as jsxRuntimeExports, L as Label, t as twMerge, E as ErrorMessage, T as Typography, k as Icon, _ as _extends } from './UploadImage-BRBnjq5U.js';
2
- import { Select as Select$1, Radio, Upload, Image, Switch as Switch$1 } from 'antd';
2
+ import { Select as Select$1, Radio, Upload, Image, Switch as Switch$1, Slider } from 'antd';
3
3
  import * as React from 'react';
4
4
  import { useState } from 'react';
5
5
 
@@ -258,4 +258,104 @@ const Switch = (props) => {
258
258
  ] });
259
259
  };
260
260
 
261
- export { RadioGroup as R, Select as S, UploadField as U, Switch as a };
261
+ const SliderSingle = (props) => {
262
+ //! State
263
+ const {
264
+ field,
265
+ formState,
266
+ label,
267
+ required,
268
+ afterOnChange,
269
+ customStyleContainer,
270
+ customStyleSlider,
271
+ disabled,
272
+ ...restProps
273
+ } = props;
274
+ const { name, value, onChange } = field || {};
275
+ const { touchedFields, errors, isSubmitted } = formState || {};
276
+ const isTouched = get(touchedFields, name);
277
+ const errorMessage = get(errors, name)?.message;
278
+ //! Function
279
+ const handleChange = (sliderValue) => {
280
+ onChange?.(sliderValue);
281
+ afterOnChange?.(sliderValue);
282
+ };
283
+ const renderErrorMessage = () => {
284
+ if (!errorMessage) return null;
285
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
286
+ ErrorMessage,
287
+ {
288
+ errorMessage,
289
+ isTouched,
290
+ isSubmitted
291
+ }
292
+ );
293
+ };
294
+ //! Render
295
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: customStyleContainer, children: [
296
+ label && /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { label, required }),
297
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
298
+ Slider,
299
+ {
300
+ className: twMerge("focus:outline-none", customStyleSlider),
301
+ disabled,
302
+ onChange: handleChange,
303
+ value,
304
+ ...restProps
305
+ }
306
+ ),
307
+ renderErrorMessage()
308
+ ] });
309
+ };
310
+
311
+ const SliderRange = (props) => {
312
+ //! State
313
+ const {
314
+ field,
315
+ formState,
316
+ label,
317
+ required,
318
+ afterOnChange,
319
+ customStyleContainer,
320
+ customStyleSlider,
321
+ disabled,
322
+ ...restProps
323
+ } = props;
324
+ const { name, value, onChange } = field || {};
325
+ const { touchedFields, errors, isSubmitted } = formState || {};
326
+ const isTouched = get(touchedFields, name);
327
+ const errorMessage = get(errors, name)?.message;
328
+ //! Function
329
+ const handleChange = (sliderValue) => {
330
+ onChange?.(sliderValue);
331
+ afterOnChange?.(sliderValue);
332
+ };
333
+ const renderErrorMessage = () => {
334
+ if (!errorMessage) return null;
335
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
336
+ ErrorMessage,
337
+ {
338
+ errorMessage,
339
+ isTouched,
340
+ isSubmitted
341
+ }
342
+ );
343
+ };
344
+ //! Render
345
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: customStyleContainer, children: [
346
+ label && /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { label, required }),
347
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
348
+ Slider,
349
+ {
350
+ className: twMerge("focus:outline-none", customStyleSlider),
351
+ disabled,
352
+ onChange: handleChange,
353
+ value,
354
+ ...restProps
355
+ }
356
+ ),
357
+ renderErrorMessage()
358
+ ] });
359
+ };
360
+
361
+ export { RadioGroup as R, Select as S, UploadField as U, Switch as a, SliderSingle as b, SliderRange as c };
@@ -1,2 +1,2 @@
1
1
  export { C as Checkbox, D as DatePicker, I as Input, P as PnkxField, R as RangePicker, h as Textarea, g as TinyMCE } from '../chunks/UploadImage-BRBnjq5U.js';
2
- export { R as RadioGroup, S as Select, a as Switch, U as UploadField } from '../chunks/Switch-CpLqxgvG.js';
2
+ export { R as RadioGroup, S as Select, c as SliderRange, b as SliderSingle, a as Switch, U as UploadField } from '../chunks/SliderRanger-DD_Z5ULj.js';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { N as ActionRowTable, A as Alert, u as Anchor, v as Appfix, w as AutoComplete, d as Badge, f as Breadcrumb, Y as BreadcrumbHeading, X as BulkActions, B as Button, J as CATEGORY_LIST_ENUM, Z as Card, C as CascaderField, L as CategoryStatus, e as Col, x as Collapse, y as ColorPicker, _ as ConfigProvider, z as ConfirmModal, c as Container, j as Divider, k as Drawer, D as Dropdown, E as Empty, G as ErrorBoundary, F as Flex, H as Heading, I as Image, M as Modal, $ as PageNotFound, g as Pagination, l as Popconfirm, P as Popover, Q as QRCode, n as Rate, m as Result, R as Row, b as SearchFiltersForm, o as Segmented, h as Sidebar, S as Skeleton, p as Statistic, T as Table, a as Tabs, i as Tag, q as Timeline, r as Tour, s as Tree, O as TypeActionRowTable, U as TypeBulkActions, V as TypeStatusTable, W as Watermark, K as badgeStatusCategoryConfig, t as typeColorMap } from './chunks/PageNotFound-D5g7S_k0.js';
2
2
  export { C as Checkbox, D as DatePicker, E as ErrorMessage, I as Input, L as Label, b as Layout, M as Menu, P as PnkxField, R as RangePicker, S as Space, e as Spin, c as Splitter, d as Steps, f as TINY_API, h as Textarea, g as TinyMCE, a as Tooltip, T as Typography, U as UploadImage } from './chunks/UploadImage-BRBnjq5U.js';
3
- export { R as RadioGroup, S as Select, a as Switch, U as UploadField } from './chunks/Switch-CpLqxgvG.js';
3
+ export { R as RadioGroup, S as Select, c as SliderRange, b as SliderSingle, a as Switch, U as UploadField } from './chunks/SliderRanger-DD_Z5ULj.js';
4
4
  export { a as useMessage, u as useToast } from './chunks/useMessage-CUPcOtIS.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.166",
4
+ "version": "1.9.167",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -1,6 +1,6 @@
1
1
  import { ControllerRenderProps, UseFormStateReturn } from 'react-hook-form';
2
2
  import { SliderRangeProps } from 'antd/es/slider';
3
- export interface SliderProps extends Omit<SliderRangeProps, "onChange"> {
3
+ export interface SliderRangesProps extends Omit<SliderRangeProps, "onChange"> {
4
4
  field?: ControllerRenderProps<any, any>;
5
5
  formState?: UseFormStateReturn<any>;
6
6
  label?: string;
@@ -9,4 +9,4 @@ export interface SliderProps extends Omit<SliderRangeProps, "onChange"> {
9
9
  customStyleContainer?: string;
10
10
  customStyleSlider?: string;
11
11
  }
12
- export declare const SliderRange: (props: SliderProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const SliderRange: (props: SliderRangesProps) => import("react/jsx-runtime").JSX.Element;
@@ -9,3 +9,5 @@ export * from './DatePicker';
9
9
  export * from './DateRangePicker';
10
10
  export * from './Upload';
11
11
  export * from './Switch';
12
+ export * from './SliderSingle';
13
+ export * from './SliderRanger';