@kolking/react-ui 1.4.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 (33) 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 +33 -38
  4. package/dist/components/Fields/Checkbox.js +1 -1
  5. package/dist/components/Fields/Field.d.ts +1 -1
  6. package/dist/components/Fields/Field.js +28 -27
  7. package/dist/components/Fields/Input.d.ts +2 -0
  8. package/dist/components/Fields/Input.js +1 -1
  9. package/dist/components/Fields/Numeric.d.ts +4 -0
  10. package/dist/components/Fields/Numeric.js +62 -0
  11. package/dist/components/Fields/Radio.js +1 -1
  12. package/dist/components/Fields/Switch.d.ts +13 -0
  13. package/dist/components/Fields/Switch.js +36 -0
  14. package/dist/components/Fields/index.d.ts +2 -1
  15. package/dist/components/Fields/index.js +13 -11
  16. package/dist/components/Flex/Flex.d.ts +1 -1
  17. package/dist/components/Flex/Flex.js +24 -23
  18. package/dist/components/Segmented/Segmented.js +22 -19
  19. package/dist/components/ToggleButton/ToggleButton.d.ts +5 -0
  20. package/dist/components/ToggleButton/ToggleButton.js +16 -0
  21. package/dist/components/ToggleButton/ToggleGroup.d.ts +12 -0
  22. package/dist/components/ToggleButton/ToggleGroup.js +43 -0
  23. package/dist/components/ToggleButton/index.d.ts +2 -0
  24. package/dist/components/ToggleButton/index.js +6 -0
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +60 -54
  27. package/dist/styles/_theme-default.scss +23 -21
  28. package/dist/styles/style.css +1 -1
  29. package/dist/utils/helpers.d.ts +1 -2
  30. package/dist/utils/helpers.js +21 -23
  31. package/package.json +1 -1
  32. package/dist/components/Fields/Quantity.d.ts +0 -7
  33. package/dist/components/Fields/Quantity.js +0 -61
@@ -1,34 +1,32 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import f from "react";
3
- function u(t, r, e) {
4
- return Math.max(r, Math.min(t, e));
3
+ function p(r, t, e) {
4
+ return Math.max(t, Math.min(r, e));
5
5
  }
6
- const m = (t, r, e, n = !0) => n ? `${t} ${t === 1 ? r : e}` : `${t === 1 ? r : e}`;
7
- function c(t) {
8
- return t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
6
+ function c(r) {
7
+ return r.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
9
8
  }
10
- function i(t, r) {
11
- return typeof r == "number" ? `${r}px` : typeof r == "string" ? r.replace(new RegExp("(?<=^|\\s)([1-4]?xs|sm|md|lg|[1-4]?xl)", "g"), `var(--${t}-$1)`) : r;
9
+ function i(r, t) {
10
+ return typeof t == "number" ? `${t}px` : typeof t == "string" ? t.replace(new RegExp("(?<=^|\\s)([1-4]?xs|sm|md|lg|[1-4]?xl)", "g"), `var(--${r}-$1)`) : t;
12
11
  }
13
- function g(t) {
14
- const r = {};
15
- return Object.keys(t).map((e) => {
16
- const n = c(e), s = i(n, t[e]);
17
- s && (r[`--${n}`] = s);
18
- }), r;
12
+ function m(r) {
13
+ const t = {};
14
+ return Object.keys(r).map((e) => {
15
+ const n = c(e), s = i(n, r[e]);
16
+ s && (t[`--${n}`] = s);
17
+ }), t;
19
18
  }
20
- function $(t, r) {
21
- return typeof t == "string" ? /* @__PURE__ */ o(r, { children: t }) : t;
19
+ function g(r, t) {
20
+ return typeof r == "string" ? /* @__PURE__ */ o(t, { children: r }) : r;
22
21
  }
23
- const l = f.forwardRef;
24
- function x(t) {
25
- return t instanceof Error && t.message ? t.message : typeof t == "string" ? t : "An error occurred";
22
+ function x(r) {
23
+ return r instanceof Error && r.message ? r.message : typeof r == "string" ? r : "An error occurred";
26
24
  }
25
+ const d = f.forwardRef;
27
26
  export {
28
- u as clamp,
29
- g as cssProps,
30
- l as fixedForwardRef,
27
+ p as clamp,
28
+ m as cssProps,
29
+ d as fixedForwardRef,
31
30
  x as getErrorMessage,
32
- m as pluralize,
33
- $ as wrapNode
31
+ g as wrapNode
34
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolking/react-ui",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "React component library for building user interfaces",
5
5
  "author": "Nick Seryakov (https://github.com/kolking)",
6
6
  "license": "MIT",
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- import { BaseInputProps } from './Input';
3
- export type QuantityProps = BaseInputProps;
4
- export declare const Quantity: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
5
- size?: "xs" | "sm" | "md" | "lg" | "xl";
6
- error?: string;
7
- } & React.RefAttributes<HTMLInputElement>>;
@@ -1,61 +0,0 @@
1
- import { jsx as n, jsxs as h } from "react/jsx-runtime";
2
- import v from "classnames";
3
- import * as l from "react";
4
- import w, { forwardRef as d, useRef as y, useImperativeHandle as R, useCallback as o } from "react";
5
- import { cssProps as g } from "../../utils/helpers.js";
6
- import { V as E } from "../../ValidationTooltip-BgSwl0hJ.js";
7
- const _ = (a, e) => /* @__PURE__ */ l.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 6 5", ref: e, ...a }, /* @__PURE__ */ l.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M0 0h6L3 5z" })), x = d(_), q = (a, e) => /* @__PURE__ */ l.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 6 5", ref: e, ...a }, /* @__PURE__ */ l.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M0 5h6L3 0z" })), C = d(q), D = "styles_quantity_JqkoZ", k = "styles_increase_MKRaz", S = "styles_decrease_oD7r3", c = {
8
- quantity: D,
9
- increase: k,
10
- decrease: S
11
- }, j = w.forwardRef(
12
- ({ size: a, error: e, className: u, style: m, ...i }, p) => {
13
- const t = y(null);
14
- R(p, () => t.current);
15
- const b = o(() => {
16
- var r, s;
17
- (r = t.current) == null || r.stepUp(), (s = t.current) == null || s.dispatchEvent(new Event("change", { bubbles: !0 }));
18
- }, []), f = o(() => {
19
- var r, s;
20
- (r = t.current) == null || r.stepDown(), (s = t.current) == null || s.dispatchEvent(new Event("change", { bubbles: !0 }));
21
- }, []);
22
- return /* @__PURE__ */ n(E, { content: e, children: /* @__PURE__ */ h(
23
- "div",
24
- {
25
- "data-input": "quantity",
26
- "data-disabled": i.disabled,
27
- "data-invalid": e ? !0 : void 0,
28
- className: v(c.quantity, u),
29
- style: { ...m, ...g({ size: a }) },
30
- children: [
31
- /* @__PURE__ */ n("input", { ...i, ref: t, type: "number" }),
32
- /* @__PURE__ */ n(
33
- "button",
34
- {
35
- type: "button",
36
- "aria-label": "Increase",
37
- disabled: i.disabled,
38
- className: c.increase,
39
- onClick: b,
40
- children: /* @__PURE__ */ n(C, { "aria-hidden": !0 })
41
- }
42
- ),
43
- /* @__PURE__ */ n(
44
- "button",
45
- {
46
- type: "button",
47
- "aria-label": "Decrease",
48
- disabled: i.disabled,
49
- className: c.decrease,
50
- onClick: f,
51
- children: /* @__PURE__ */ n(x, { "aria-hidden": !0 })
52
- }
53
- )
54
- ]
55
- }
56
- ) });
57
- }
58
- );
59
- export {
60
- j as Quantity
61
- };