@kolking/react-ui 1.3.0 → 1.5.0

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.
Files changed (36) hide show
  1. package/dist/{Input-DE1QkW7S.js → Input-DbQTM4UI.js} +39 -29
  2. package/dist/components/Dialog/Dialog.d.ts +10 -5
  3. package/dist/components/Dialog/Dialog.js +34 -38
  4. package/dist/components/Dialog/useDialog.d.ts +2 -3
  5. package/dist/components/Dialog/useDialog.js +43 -43
  6. package/dist/components/Fields/Checkbox.js +1 -1
  7. package/dist/components/Fields/Field.d.ts +1 -1
  8. package/dist/components/Fields/Field.js +28 -27
  9. package/dist/components/Fields/Input.d.ts +2 -0
  10. package/dist/components/Fields/Input.js +1 -1
  11. package/dist/components/Fields/Numeric.d.ts +4 -0
  12. package/dist/components/Fields/Numeric.js +62 -0
  13. package/dist/components/Fields/Radio.js +1 -1
  14. package/dist/components/Fields/Switch.d.ts +13 -0
  15. package/dist/components/Fields/Switch.js +36 -0
  16. package/dist/components/Fields/index.d.ts +2 -1
  17. package/dist/components/Fields/index.js +13 -11
  18. package/dist/components/Flex/Flex.d.ts +1 -1
  19. package/dist/components/Flex/Flex.js +24 -23
  20. package/dist/components/Segmented/Segmented.js +22 -19
  21. package/dist/components/ToggleButton/ToggleButton.d.ts +5 -0
  22. package/dist/components/ToggleButton/ToggleButton.js +16 -0
  23. package/dist/components/ToggleButton/ToggleGroup.d.ts +12 -0
  24. package/dist/components/ToggleButton/ToggleGroup.js +43 -0
  25. package/dist/components/ToggleButton/index.d.ts +2 -0
  26. package/dist/components/ToggleButton/index.js +6 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +60 -54
  29. package/dist/styles/_theme-default.scss +23 -21
  30. package/dist/styles/_utils.scss +12 -5
  31. package/dist/styles/style.css +1 -1
  32. package/dist/utils/helpers.d.ts +1 -2
  33. package/dist/utils/helpers.js +21 -23
  34. package/package.json +1 -1
  35. package/dist/components/Fields/Quantity.d.ts +0 -7
  36. package/dist/components/Fields/Quantity.js +0 -61
@@ -1,15 +1,15 @@
1
- import { jsxs as f, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as _, jsx as s } from "react/jsx-runtime";
2
2
  import u from "classnames";
3
- import _ from "react";
3
+ import h from "react";
4
4
  import { cssProps as m } from "./utils/helpers.js";
5
- import { s as t, V as h } from "./ValidationTooltip-BgSwl0hJ.js";
6
- const x = "styles_checkbox_pxrU4", w = "styles_radio_0QV8R", v = "styles_label_K65D1", k = "styles_input_j6Qji", g = {
7
- checkbox: x,
8
- radio: w,
9
- label: v,
10
- input: k
5
+ import { s as t, V as x } from "./ValidationTooltip-BgSwl0hJ.js";
6
+ const w = "styles_checkbox_pxrU4", v = "styles_radio_0QV8R", k = "styles_label_K65D1", g = "styles_input_j6Qji", N = {
7
+ checkbox: w,
8
+ radio: v,
9
+ label: k,
10
+ input: g
11
11
  };
12
- function N(a) {
12
+ function j(e) {
13
13
  return ![
14
14
  "button",
15
15
  "checkbox",
@@ -21,13 +21,13 @@ function N(a) {
21
21
  "range",
22
22
  "reset",
23
23
  "submit"
24
- ].includes(a);
24
+ ].includes(e);
25
25
  }
26
- function p(a) {
27
- switch (a) {
26
+ function p(e) {
27
+ switch (e) {
28
28
  case "checkbox":
29
29
  case "radio":
30
- return g.input;
30
+ return N.input;
31
31
  case "date":
32
32
  case "datetime":
33
33
  case "datetime-local":
@@ -45,21 +45,31 @@ function p(a) {
45
45
  case "image":
46
46
  case "color":
47
47
  case "file":
48
- return t[a];
48
+ return t[e];
49
49
  default:
50
50
  return t.input;
51
51
  }
52
52
  }
53
- const Q = _.forwardRef(
54
- ({ size: a, error: c, type: e = "text", className: o, style: d, prefix: i, children: n, ...r }, l) => {
55
- const b = N(e) && (i || n) ? /* @__PURE__ */ f(
53
+ const C = h.forwardRef(
54
+ ({
55
+ size: e,
56
+ error: c,
57
+ type: a = "text",
58
+ wrapperType: b = a,
59
+ prefix: i,
60
+ className: o,
61
+ style: d,
62
+ children: n,
63
+ ...r
64
+ }, l) => {
65
+ const f = j(a) && (i || n) ? /* @__PURE__ */ _(
56
66
  "div",
57
67
  {
58
- "data-input-wrapper": !0,
68
+ "data-input-wrapper": b,
59
69
  "data-disabled": r.disabled,
60
70
  "data-invalid": c ? !0 : void 0,
61
71
  className: u(t.wrapper, o),
62
- style: { ...d, ...m({ size: a }) },
72
+ style: { ...d, ...m({ size: e }) },
63
73
  children: [
64
74
  i && /* @__PURE__ */ s("div", { "data-input-prefix": !0, className: t.wrapper_prefix, children: i }),
65
75
  /* @__PURE__ */ s(
@@ -67,9 +77,9 @@ const Q = _.forwardRef(
67
77
  {
68
78
  ...r,
69
79
  ref: l,
70
- type: e,
71
- "data-input": e,
72
- className: p(e)
80
+ type: a,
81
+ "data-input": a,
82
+ className: p(a)
73
83
  }
74
84
  ),
75
85
  n && /* @__PURE__ */ s("div", { "data-input-accessory": !0, className: t.wrapper_accessory, children: n })
@@ -80,17 +90,17 @@ const Q = _.forwardRef(
80
90
  {
81
91
  ...r,
82
92
  ref: l,
83
- type: e,
84
- "data-input": e,
93
+ type: a,
94
+ "data-input": a,
85
95
  "data-invalid": c ? !0 : void 0,
86
- className: u(p(e), o),
87
- style: { ...d, ...m({ size: a }) }
96
+ className: u(p(a), o),
97
+ style: { ...d, ...m({ size: e }) }
88
98
  }
89
99
  );
90
- return /* @__PURE__ */ s(h, { content: c, children: b });
100
+ return /* @__PURE__ */ s(x, { content: c, children: f });
91
101
  }
92
102
  );
93
103
  export {
94
- Q as I,
95
- g as s
104
+ C as I,
105
+ N as s
96
106
  };
@@ -1,10 +1,15 @@
1
1
  import { default as React } from 'react';
2
2
  import { ButtonProps } from '../Button';
3
- export type DialogProps = React.HTMLProps<HTMLDialogElement> & {
3
+ import { HeadingProps } from '../Heading';
4
+ export type DialogProps = React.DialogHTMLAttributes<HTMLDialogElement> & {
5
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
6
  width?: React.CSSProperties['width'];
5
7
  };
6
- export declare const Dialog: React.ForwardRefExoticComponent<Omit<DialogProps, "ref"> & React.RefAttributes<HTMLDialogElement>>;
7
- export declare const DialogTitle: ({ className, children, ...props }: React.HTMLProps<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
8
- export declare const DialogContent: ({ className, children, ...props }: React.HTMLProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
9
- export declare const DialogFooter: ({ className, children, ...props }: React.HTMLProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const Dialog: React.ForwardRefExoticComponent<React.DialogHTMLAttributes<HTMLDialogElement> & {
9
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
10
+ width?: React.CSSProperties["width"];
11
+ } & React.RefAttributes<HTMLDialogElement>>;
12
+ export declare const DialogTitle: ({ className, children, ...props }: Omit<HeadingProps, "title">) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const DialogContent: ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const DialogFooter: ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
10
15
  export declare const DialogClose: ({ className, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,57 +1,53 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import d from "react";
3
- import l from "classnames";
4
- import { Icon as g } from "../Icon/Icon.js";
5
- import { Button as m } from "../Button/Button.js";
6
- import { DialogFocusTrap as f } from "./DialogFocusTrap.js";
7
- import { cssProps as p } from "../../utils/helpers.js";
8
- const D = "Dialog_title_2pDPQ", _ = "Dialog_dialog_G3gxL", u = "Dialog_content_7168G", N = "Dialog_footer_N-aEV", v = "Dialog_close_JSEkn", i = {
9
- title: D,
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import g from "react";
3
+ import i from "classnames";
4
+ import { Icon as m } from "../Icon/Icon.js";
5
+ import { Button as p } from "../Button/Button.js";
6
+ import { Heading as f } from "../Heading/Heading.js";
7
+ import { DialogFocusTrap as u } from "./DialogFocusTrap.js";
8
+ import { cssProps as D } from "../../utils/helpers.js";
9
+ const _ = "Dialog_dialog_G3gxL", w = "Dialog_wrapper_BMuhR", v = "Dialog_footer_N-aEV", N = "Dialog_close_JSEkn", e = {
10
10
  dialog: _,
11
- content: u,
12
- footer: N,
13
- close: v
14
- }, G = d.forwardRef(
15
- ({ open: o = !1, width: t, style: a, className: s, children: c, ...r }, n) => /* @__PURE__ */ e(f, { active: o, children: /* @__PURE__ */ e(
11
+ wrapper: w,
12
+ footer: v,
13
+ close: N
14
+ }, F = g.forwardRef(
15
+ ({ open: o = !1, size: a, width: r, style: l, className: s, children: c, ...d }, n) => /* @__PURE__ */ t(u, { active: o, children: /* @__PURE__ */ t(
16
16
  "dialog",
17
17
  {
18
- ...r,
18
+ ...d,
19
19
  ref: n,
20
20
  "data-floating-root": !0,
21
21
  "data-dialog": o ? "open" : "closed",
22
- className: l(i.dialog, s),
23
- style: { ...a, ...p({ width: t }) },
24
- children: c
22
+ className: i(e.dialog, s),
23
+ style: { ...l, ...D({ size: a, width: r }) },
24
+ children: /* @__PURE__ */ t("div", { "data-dialog-wrapper": !0, className: e.wrapper, children: c })
25
25
  }
26
26
  ) })
27
- ), P = ({
27
+ ), T = ({ className: o, children: a, ...r }) => /* @__PURE__ */ t(f, { as: "h4", ...r, "data-dialog-title": !0, title: a, className: o }), j = ({
28
28
  className: o,
29
- children: t,
30
- ...a
31
- }) => /* @__PURE__ */ e("h4", { ...a, "data-dialog-title": !0, className: l(i.title, o), children: t }), R = ({
29
+ children: a,
30
+ ...r
31
+ }) => /* @__PURE__ */ t("div", { ...r, "data-dialog-content": !0, className: o, children: a }), k = ({
32
32
  className: o,
33
- children: t,
34
- ...a
35
- }) => /* @__PURE__ */ e("div", { ...a, "data-dialog-content": !0, className: l(i.content, o), children: t }), T = ({
36
- className: o,
37
- children: t,
38
- ...a
39
- }) => /* @__PURE__ */ e("div", { ...a, "data-dialog-footer": !0, className: l(i.footer, o), children: t }), j = ({ className: o, ...t }) => /* @__PURE__ */ e(
40
- m,
33
+ children: a,
34
+ ...r
35
+ }) => /* @__PURE__ */ t("div", { ...r, "data-dialog-footer": !0, className: i(e.footer, o), children: a }), G = ({ className: o, ...a }) => /* @__PURE__ */ t(
36
+ p,
41
37
  {
42
- ...t,
38
+ ...a,
43
39
  type: "button",
44
40
  variant: "tertiary",
45
41
  "data-dialog-close": !0,
46
42
  "aria-label": "dismiss dialog",
47
- icon: /* @__PURE__ */ e(g, { name: "close" }),
48
- className: l(i.close, o)
43
+ icon: /* @__PURE__ */ t(m, { name: "close" }),
44
+ className: i(e.close, o)
49
45
  }
50
46
  );
51
47
  export {
52
- G as Dialog,
53
- j as DialogClose,
54
- R as DialogContent,
55
- T as DialogFooter,
56
- P as DialogTitle
48
+ F as Dialog,
49
+ G as DialogClose,
50
+ j as DialogContent,
51
+ k as DialogFooter,
52
+ T as DialogTitle
57
53
  };
@@ -11,9 +11,8 @@ export declare function useDialog<T, R>(options?: DialogOptions<T, R>): {
11
11
  open: boolean;
12
12
  };
13
13
  data: T | undefined;
14
- disabled: boolean;
15
14
  show: (values: T) => void;
16
- disable: import('react').Dispatch<import('react').SetStateAction<boolean>>;
17
- confirm: (values: R) => void;
18
15
  cancel: () => void;
16
+ confirm: (values: R) => void;
17
+ preventClose: <T_1>(promise: Promise<T_1>) => Promise<T_1>;
19
18
  };
@@ -1,52 +1,52 @@
1
- import { useRef as k, useState as u, useCallback as f, useEffect as m } from "react";
2
- function b(a) {
3
- const s = k(null), o = k(a), [d, L] = u(!1), [l, v] = u((a == null ? void 0 : a.defaultOpen) ?? !1), [w, E] = u();
4
- o.current = a;
5
- const p = f((e) => {
1
+ import { useRef as v, useState as g, useCallback as u, useEffect as h } from "react";
2
+ function S(o) {
3
+ const a = v(null), i = v(o), s = v(!1), [d, E] = g((o == null ? void 0 : o.defaultOpen) ?? !1), [w, k] = g();
4
+ i.current = o;
5
+ const y = u((e) => {
6
6
  var n, t;
7
- E(e), v(!0), (t = (n = o.current) == null ? void 0 : n.onShow) == null || t.call(n, e);
8
- }, []), c = f(
9
- (e) => {
10
- var n;
11
- l && (v(!1), (n = s.current) == null || n.addEventListener(
12
- "transitionend",
13
- () => {
14
- var t, i, r, h;
15
- e !== void 0 ? (i = (t = o.current) == null ? void 0 : t.onConfirm) == null || i.call(t, e) : (h = (r = o.current) == null ? void 0 : r.onCancel) == null || h.call(r), E(void 0);
16
- },
17
- { once: !0 }
18
- ));
19
- },
20
- [l]
21
- );
22
- return m(() => {
7
+ s.current || (k(e), E(!0), (t = (n = i.current) == null ? void 0 : n.onShow) == null || t.call(n, e));
8
+ }, []), c = u((e) => {
9
+ s.current || E((n) => {
10
+ var t;
11
+ return n && (s.current = !0, (t = a.current) == null || t.addEventListener("transitionend", function r(b) {
12
+ var f, p, l, m;
13
+ b.target === a.current && (e !== void 0 ? (p = (f = i.current) == null ? void 0 : f.onConfirm) == null || p.call(f, e) : (m = (l = i.current) == null ? void 0 : l.onCancel) == null || m.call(l), k(void 0), s.current = !1, this.removeEventListener("transitionend", r));
14
+ })), !1;
15
+ });
16
+ }, []);
17
+ h(() => {
23
18
  var e, n;
24
- l ? (e = s.current) == null || e.showModal() : (n = s.current) == null || n.close();
25
- }, [l]), m(() => {
26
- const e = s.current;
27
- function n(r) {
28
- r.target === r.currentTarget && !d && c();
29
- }
30
- function t(r) {
31
- r.key === "Escape" && d && r.preventDefault();
19
+ d ? (e = a.current) == null || e.showModal() : (n = a.current) == null || n.close();
20
+ }, [d]), h(() => {
21
+ const e = a.current;
22
+ if (e) {
23
+ let n = function(r) {
24
+ r.target === r.currentTarget && c();
25
+ }, t = function(r) {
26
+ r.key === "Escape" && (r.stopPropagation(), r.preventDefault(), c());
27
+ };
28
+ return e.addEventListener("click", n), e.addEventListener("keydown", t), () => {
29
+ e.removeEventListener("click", n), e.removeEventListener("keydown", t);
30
+ };
32
31
  }
33
- function i() {
34
- c();
32
+ }, [c]);
33
+ const L = u(() => c(), [c]), C = u((e) => c(e), [c]), D = u(async (e) => {
34
+ s.current = !0;
35
+ try {
36
+ return await e;
37
+ } finally {
38
+ s.current = !1;
35
39
  }
36
- if (e)
37
- return e.addEventListener("click", n), e.addEventListener("cancel", i), e.addEventListener("keydown", t), () => {
38
- e.removeEventListener("click", n), e.removeEventListener("cancel", i), e.removeEventListener("keydown", t);
39
- };
40
- }, [d, c]), {
41
- props: { ref: s, open: l },
40
+ }, []);
41
+ return {
42
+ props: { ref: a, open: d },
42
43
  data: w,
43
- disabled: d,
44
- show: p,
45
- disable: L,
46
- confirm: f((e) => c(e), [c]),
47
- cancel: f(() => c(), [c])
44
+ show: y,
45
+ cancel: L,
46
+ confirm: C,
47
+ preventClose: D
48
48
  };
49
49
  }
50
50
  export {
51
- b as useDialog
51
+ S as useDialog
52
52
  };
@@ -2,7 +2,7 @@ import { jsxs as i, jsx as l } from "react/jsx-runtime";
2
2
  import p from "classnames";
3
3
  import h, { useRef as x, useImperativeHandle as k, useEffect as b } from "react";
4
4
  import { cssProps as R } from "../../utils/helpers.js";
5
- import { I as y, s as n } from "../../Input-DE1QkW7S.js";
5
+ import { I as y, s as n } from "../../Input-DbQTM4UI.js";
6
6
  const q = h.forwardRef(
7
7
  ({ size: c, error: a, label: t, className: f, style: u, required: m, indeterminate: r, ...s }, d) => {
8
8
  const o = s.checked, e = x(null);
@@ -17,4 +17,4 @@ export declare const FieldLabel: ({ label, required, className, children, ...pro
17
17
  export type FieldDescriptionProps = React.HTMLAttributes<HTMLDivElement>;
18
18
  export declare const FieldDescription: ({ className, children, ...props }: FieldDescriptionProps) => import("react/jsx-runtime").JSX.Element;
19
19
  export type FieldProps = React.HTMLAttributes<HTMLDivElement> & FieldConfig;
20
- export declare const Field: ({ id, label, labelAccessory, help, required, minWidth, maxWidth, className, children, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const Field: ({ id, label, labelAccessory, help, required, minWidth, maxWidth, className, children, style, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,14 @@
1
- import { jsxs as o, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
2
  import d from "classnames";
3
- import h from "react";
4
- import { cssProps as _ } from "../../utils/helpers.js";
5
- const p = "styles_field_hqzKT", u = "styles_header_Iwsz6", b = "styles_label_zRVTS", N = "styles_accessory_S4ccn", F = "styles_description_fZnNW", a = {
6
- field: p,
7
- header: u,
8
- label: b,
9
- accessory: N,
10
- description: F
11
- }, v = ({ label: e, required: s, className: l, children: t, ...c }) => /* @__PURE__ */ o("div", { "data-field-header": !0, className: a.header, children: [
3
+ import _ from "react";
4
+ import { cssProps as p } from "../../utils/helpers.js";
5
+ const u = "styles_field_hqzKT", b = "styles_header_Iwsz6", N = "styles_label_zRVTS", F = "styles_accessory_S4ccn", v = "styles_description_fZnNW", a = {
6
+ field: u,
7
+ header: b,
8
+ label: N,
9
+ accessory: F,
10
+ description: v
11
+ }, x = ({ label: e, required: s, className: l, children: t, ...c }) => /* @__PURE__ */ i("div", { "data-field-header": !0, className: a.header, children: [
12
12
  /* @__PURE__ */ r(
13
13
  "label",
14
14
  {
@@ -19,34 +19,35 @@ const p = "styles_field_hqzKT", u = "styles_header_Iwsz6", b = "styles_label_zRV
19
19
  children: e
20
20
  }
21
21
  ),
22
- h.Children.toArray(t).length > 0 && /* @__PURE__ */ r("div", { "data-field-accessory": !0, className: a.accessory, children: t })
23
- ] }), x = ({ className: e, children: s, ...l }) => /* @__PURE__ */ r("small", { ...l, "data-field-description": !0, className: d(a.description, e), children: s }), S = ({
22
+ _.Children.toArray(t).length > 0 && /* @__PURE__ */ r("div", { "data-field-accessory": !0, className: a.accessory, children: t })
23
+ ] }), z = ({ className: e, children: s, ...l }) => /* @__PURE__ */ r("small", { ...l, "data-field-description": !0, className: d(a.description, e), children: s }), T = ({
24
24
  id: e,
25
25
  label: s,
26
26
  labelAccessory: l,
27
27
  help: t,
28
28
  required: c,
29
- minWidth: n,
30
- maxWidth: f,
31
- className: m,
32
- children: y,
33
- ...i
34
- }) => /* @__PURE__ */ o(
29
+ minWidth: o,
30
+ maxWidth: n,
31
+ className: f,
32
+ children: m,
33
+ style: y,
34
+ ...h
35
+ }) => /* @__PURE__ */ i(
35
36
  "div",
36
37
  {
37
- ...i,
38
+ ...h,
38
39
  "data-field": e || !0,
39
- className: d(a.field, m),
40
- style: { ...i.style, ..._({ minWidth: n, maxWidth: f }) },
40
+ className: d(a.field, f),
41
+ style: { ...y, ...p({ minWidth: o, maxWidth: n }) },
41
42
  children: [
42
- s && /* @__PURE__ */ r(v, { htmlFor: e, label: s, required: c, children: l }),
43
- y,
44
- t && /* @__PURE__ */ r(x, { children: t })
43
+ s && /* @__PURE__ */ r(x, { htmlFor: e, label: s, required: c, children: l }),
44
+ m,
45
+ t && /* @__PURE__ */ r(z, { children: t })
45
46
  ]
46
47
  }
47
48
  );
48
49
  export {
49
- S as Field,
50
- x as FieldDescription,
51
- v as FieldLabel
50
+ T as Field,
51
+ z as FieldDescription,
52
+ x as FieldLabel
52
53
  };
@@ -4,8 +4,10 @@ export type BaseInputProps<T = React.InputHTMLAttributes<HTMLInputElement>> = Om
4
4
  error?: string;
5
5
  };
6
6
  export type InputProps = Omit<BaseInputProps, 'prefix'> & {
7
+ wrapperType?: string;
7
8
  prefix?: React.ReactNode;
8
9
  };
9
10
  export declare const Input: React.ForwardRefExoticComponent<Omit<BaseInputProps<React.InputHTMLAttributes<HTMLInputElement>>, "prefix"> & {
11
+ wrapperType?: string;
10
12
  prefix?: React.ReactNode;
11
13
  } & React.RefAttributes<HTMLInputElement>>;
@@ -3,7 +3,7 @@ import "classnames";
3
3
  import "react";
4
4
  import "../../utils/helpers.js";
5
5
  import "../../ValidationTooltip-BgSwl0hJ.js";
6
- import { I as a } from "../../Input-DE1QkW7S.js";
6
+ import { I as a } from "../../Input-DbQTM4UI.js";
7
7
  export {
8
8
  a as Input
9
9
  };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { InputProps } from './Input';
3
+ export type NumericProps = Omit<InputProps, 'children'>;
4
+ export declare const Numeric: React.ForwardRefExoticComponent<NumericProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,62 @@
1
+ import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
+ import b from "classnames";
3
+ import f, { useRef as y, useImperativeHandle as _, useCallback as c } from "react";
4
+ import { Icon as i } from "../Icon/Icon.js";
5
+ import { Button as o } from "../Button/Button.js";
6
+ import { I as h } from "../../Input-DbQTM4UI.js";
7
+ const v = "styles_numeric_dzUSE", w = "styles_increase_5S-Jo", E = "styles_decrease_j8UR6", s = {
8
+ numeric: v,
9
+ increase: w,
10
+ decrease: E
11
+ }, j = f.forwardRef(
12
+ ({ className: l, ...a }, u) => {
13
+ const e = y(null);
14
+ _(u, () => e.current);
15
+ const m = c(() => {
16
+ var n, r;
17
+ (n = e.current) == null || n.stepUp(), (r = e.current) == null || r.dispatchEvent(new Event("change", { bubbles: !0 }));
18
+ }, []), d = c(() => {
19
+ var n, r;
20
+ (n = e.current) == null || n.stepDown(), (r = e.current) == null || r.dispatchEvent(new Event("change", { bubbles: !0 }));
21
+ }, []);
22
+ return /* @__PURE__ */ p(
23
+ h,
24
+ {
25
+ ...a,
26
+ ref: e,
27
+ type: "number",
28
+ wrapperType: "numeric",
29
+ className: b(s.numeric, l),
30
+ children: [
31
+ /* @__PURE__ */ t(
32
+ o,
33
+ {
34
+ type: "button",
35
+ variant: "secondary",
36
+ "aria-label": "Increase",
37
+ disabled: a.disabled,
38
+ className: s.increase,
39
+ icon: /* @__PURE__ */ t(i, { name: "triangle-up" }),
40
+ onClick: m
41
+ }
42
+ ),
43
+ /* @__PURE__ */ t(
44
+ o,
45
+ {
46
+ type: "button",
47
+ variant: "secondary",
48
+ "aria-label": "Decrease",
49
+ disabled: a.disabled,
50
+ className: s.decrease,
51
+ icon: /* @__PURE__ */ t(i, { name: "triangle-down" }),
52
+ onClick: d
53
+ }
54
+ )
55
+ ]
56
+ }
57
+ );
58
+ }
59
+ );
60
+ export {
61
+ j as Numeric
62
+ };
@@ -2,7 +2,7 @@ import { jsxs as l, jsx as o } from "react/jsx-runtime";
2
2
  import c from "classnames";
3
3
  import f from "react";
4
4
  import { cssProps as n } from "../../utils/helpers.js";
5
- import { I as u, s } from "../../Input-DE1QkW7S.js";
5
+ import { I as u, s } from "../../Input-DbQTM4UI.js";
6
6
  const I = f.forwardRef(
7
7
  ({ size: r, error: t, label: a, className: e, style: i, required: d, ...m }, p) => /* @__PURE__ */ l(
8
8
  "label",
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { BaseInputProps } from './Input';
3
+ export type SwitchProps = BaseInputProps & {
4
+ label?: React.ReactNode;
5
+ checkedColor?: string;
6
+ };
7
+ export declare const Switch: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
8
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
9
+ error?: string;
10
+ } & {
11
+ label?: React.ReactNode;
12
+ checkedColor?: string;
13
+ } & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,36 @@
1
+ import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
+ import m from "react";
3
+ import u from "classnames";
4
+ import { cssProps as h } from "../../utils/helpers.js";
5
+ import { V as f } from "../../ValidationTooltip-BgSwl0hJ.js";
6
+ const _ = "styles_label_p-D4Y", w = "styles_input_VteBP", s = {
7
+ switch: "styles_switch_UNvH8",
8
+ label: _,
9
+ input: w
10
+ }, V = m.forwardRef(
11
+ ({ size: a, error: i, label: e, required: l, checkedColor: o, className: c, style: n, ...r }, p) => /* @__PURE__ */ d(
12
+ "label",
13
+ {
14
+ "data-input": "switch",
15
+ "data-required": l,
16
+ className: u(s.switch, c),
17
+ style: { ...n, ...h({ size: a, checkedColor: o }) },
18
+ children: [
19
+ /* @__PURE__ */ t(f, { content: i, children: /* @__PURE__ */ t(
20
+ "input",
21
+ {
22
+ ...r,
23
+ ref: p,
24
+ type: "checkbox",
25
+ "data-invalid": i ? !0 : void 0,
26
+ className: s.input
27
+ }
28
+ ) }),
29
+ e && /* @__PURE__ */ t("div", { className: s.label, children: e })
30
+ ]
31
+ }
32
+ )
33
+ );
34
+ export {
35
+ V as Switch
36
+ };
@@ -1,8 +1,9 @@
1
1
  export * from './Checkbox';
2
2
  export * from './Field';
3
3
  export * from './Input';
4
- export * from './Quantity';
4
+ export * from './Numeric';
5
5
  export * from './Radio';
6
6
  export * from './Select';
7
+ export * from './Switch';
7
8
  export * from './Textarea';
8
9
  export * from './ValidationTooltip';
@@ -1,20 +1,22 @@
1
- import { Checkbox as r } from "./Checkbox.js";
1
+ import { Checkbox as e } from "./Checkbox.js";
2
2
  import { Field as p, FieldDescription as i, FieldLabel as x } from "./Field.js";
3
- import { I as f } from "../../Input-DE1QkW7S.js";
4
- import { Quantity as l } from "./Quantity.js";
5
- import { Radio as n } from "./Radio.js";
3
+ import { I as f } from "../../Input-DbQTM4UI.js";
4
+ import { Numeric as l } from "./Numeric.js";
5
+ import { Radio as d } from "./Radio.js";
6
6
  import { Select as s } from "./Select.js";
7
- import { Textarea as b } from "./Textarea.js";
8
- import { V as I } from "../../ValidationTooltip-BgSwl0hJ.js";
7
+ import { Switch as b } from "./Switch.js";
8
+ import { Textarea as u } from "./Textarea.js";
9
+ import { V as S } from "../../ValidationTooltip-BgSwl0hJ.js";
9
10
  export {
10
- r as Checkbox,
11
+ e as Checkbox,
11
12
  p as Field,
12
13
  i as FieldDescription,
13
14
  x as FieldLabel,
14
15
  f as Input,
15
- l as Quantity,
16
- n as Radio,
16
+ l as Numeric,
17
+ d as Radio,
17
18
  s as Select,
18
- b as Textarea,
19
- I as ValidationTooltip
19
+ b as Switch,
20
+ u as Textarea,
21
+ S as ValidationTooltip
20
22
  };
@@ -19,4 +19,4 @@ export declare const Flex: <T extends React.ElementType = "div">(props: {
19
19
  wrap?: React.CSSProperties["flexWrap"];
20
20
  marginStart?: React.CSSProperties["marginBlockStart"];
21
21
  marginEnd?: React.CSSProperties["marginBlockEnd"];
22
- } & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "direction" | "as" | "align" | "wrap" | "justify" | "gap" | "marginStart" | "marginEnd"> & React.RefAttributes<unknown>) => React.ReactElement | null;
22
+ } & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "direction" | "as" | "align" | "wrap" | "justify" | "marginStart" | "marginEnd" | "gap"> & React.RefAttributes<unknown>) => React.ReactElement | null;