@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.
- package/dist/{Input-DE1QkW7S.js → Input-DbQTM4UI.js} +39 -29
- package/dist/components/Dialog/Dialog.d.ts +10 -5
- package/dist/components/Dialog/Dialog.js +33 -38
- package/dist/components/Fields/Checkbox.js +1 -1
- package/dist/components/Fields/Field.d.ts +1 -1
- package/dist/components/Fields/Field.js +28 -27
- package/dist/components/Fields/Input.d.ts +2 -0
- package/dist/components/Fields/Input.js +1 -1
- package/dist/components/Fields/Numeric.d.ts +4 -0
- package/dist/components/Fields/Numeric.js +62 -0
- package/dist/components/Fields/Radio.js +1 -1
- package/dist/components/Fields/Switch.d.ts +13 -0
- package/dist/components/Fields/Switch.js +36 -0
- package/dist/components/Fields/index.d.ts +2 -1
- package/dist/components/Fields/index.js +13 -11
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/Flex/Flex.js +24 -23
- package/dist/components/Segmented/Segmented.js +22 -19
- package/dist/components/ToggleButton/ToggleButton.d.ts +5 -0
- package/dist/components/ToggleButton/ToggleButton.js +16 -0
- package/dist/components/ToggleButton/ToggleGroup.d.ts +12 -0
- package/dist/components/ToggleButton/ToggleGroup.js +43 -0
- package/dist/components/ToggleButton/index.d.ts +2 -0
- package/dist/components/ToggleButton/index.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +60 -54
- package/dist/styles/_theme-default.scss +23 -21
- package/dist/styles/style.css +1 -1
- package/dist/utils/helpers.d.ts +1 -2
- package/dist/utils/helpers.js +21 -23
- package/package.json +1 -1
- package/dist/components/Fields/Quantity.d.ts +0 -7
- package/dist/components/Fields/Quantity.js +0 -61
package/dist/utils/helpers.js
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import f from "react";
|
|
3
|
-
function
|
|
4
|
-
return Math.max(
|
|
3
|
+
function p(r, t, e) {
|
|
4
|
+
return Math.max(t, Math.min(r, e));
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
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(
|
|
11
|
-
return typeof
|
|
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
|
|
14
|
-
const
|
|
15
|
-
return Object.keys(
|
|
16
|
-
const n = c(e), s = i(n,
|
|
17
|
-
s && (
|
|
18
|
-
}),
|
|
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
|
|
21
|
-
return typeof
|
|
19
|
+
function g(r, t) {
|
|
20
|
+
return typeof r == "string" ? /* @__PURE__ */ o(t, { children: r }) : r;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
p as clamp,
|
|
28
|
+
m as cssProps,
|
|
29
|
+
d as fixedForwardRef,
|
|
31
30
|
x as getErrorMessage,
|
|
32
|
-
|
|
33
|
-
$ as wrapNode
|
|
31
|
+
g as wrapNode
|
|
34
32
|
};
|
package/package.json
CHANGED
|
@@ -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
|
-
};
|