@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.
- 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 +34 -38
- package/dist/components/Dialog/useDialog.d.ts +2 -3
- package/dist/components/Dialog/useDialog.js +43 -43
- 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/_utils.scss +12 -5
- 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
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import d from "classnames";
|
|
3
|
-
import { fixedForwardRef as i, cssProps as
|
|
4
|
-
const
|
|
5
|
-
flex:
|
|
3
|
+
import { fixedForwardRef as i, cssProps as F } from "../../utils/helpers.js";
|
|
4
|
+
const u = "Flex_flex_GBHBA", w = {
|
|
5
|
+
flex: u
|
|
6
6
|
};
|
|
7
|
-
function
|
|
8
|
-
as:
|
|
7
|
+
function y({
|
|
8
|
+
as: o,
|
|
9
9
|
direction: e = "row",
|
|
10
|
-
gap:
|
|
11
|
-
align:
|
|
10
|
+
gap: r,
|
|
11
|
+
align: t,
|
|
12
12
|
justify: s,
|
|
13
|
-
wrap:
|
|
14
|
-
marginStart:
|
|
15
|
-
marginEnd:
|
|
16
|
-
className:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
wrap: l,
|
|
14
|
+
marginStart: f,
|
|
15
|
+
marginEnd: n,
|
|
16
|
+
className: x,
|
|
17
|
+
style: m,
|
|
18
|
+
...c
|
|
19
|
+
}, a) {
|
|
20
|
+
return /* @__PURE__ */ p(
|
|
21
|
+
o ?? "div",
|
|
21
22
|
{
|
|
22
|
-
...
|
|
23
|
-
ref:
|
|
23
|
+
...c,
|
|
24
|
+
ref: a,
|
|
24
25
|
"data-flex": e,
|
|
25
|
-
className: d(
|
|
26
|
+
className: d(w.flex, x),
|
|
26
27
|
style: {
|
|
27
|
-
...
|
|
28
|
-
...
|
|
28
|
+
...m,
|
|
29
|
+
...F({ gap: r, align: t, justify: s, direction: e, wrap: l, marginStart: f, marginEnd: n })
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
);
|
|
32
33
|
}
|
|
33
|
-
const
|
|
34
|
+
const v = i(y);
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
v as Flex
|
|
36
37
|
};
|
|
@@ -1,40 +1,43 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import p from "classnames";
|
|
3
3
|
import { cssProps as i } from "../../utils/helpers.js";
|
|
4
4
|
const h = "Segmented_segmented_UOs8Z", S = {
|
|
5
5
|
segmented: h
|
|
6
|
-
},
|
|
7
|
-
size:
|
|
8
|
-
items:
|
|
6
|
+
}, b = ({
|
|
7
|
+
size: n,
|
|
8
|
+
items: o,
|
|
9
9
|
selected: t,
|
|
10
|
-
disabled:
|
|
11
|
-
margin:
|
|
10
|
+
disabled: s,
|
|
11
|
+
margin: m,
|
|
12
12
|
className: g,
|
|
13
|
-
style:
|
|
14
|
-
onSelect:
|
|
15
|
-
...
|
|
16
|
-
}) => /* @__PURE__ */
|
|
13
|
+
style: a,
|
|
14
|
+
onSelect: c,
|
|
15
|
+
...d
|
|
16
|
+
}) => /* @__PURE__ */ r(
|
|
17
17
|
"div",
|
|
18
18
|
{
|
|
19
|
-
...
|
|
19
|
+
...d,
|
|
20
|
+
role: "radiogroup",
|
|
20
21
|
"data-segmented": t,
|
|
21
22
|
className: p(S.segmented, g),
|
|
22
23
|
style: {
|
|
23
|
-
...
|
|
24
|
+
...a,
|
|
24
25
|
...i({
|
|
25
|
-
size:
|
|
26
|
-
margin:
|
|
27
|
-
length:
|
|
26
|
+
size: n,
|
|
27
|
+
margin: m,
|
|
28
|
+
length: o.length.toString(),
|
|
28
29
|
selected: t.toString()
|
|
29
30
|
})
|
|
30
31
|
},
|
|
31
|
-
children:
|
|
32
|
+
children: o.map((l, e) => /* @__PURE__ */ r(
|
|
32
33
|
"button",
|
|
33
34
|
{
|
|
35
|
+
role: "radio",
|
|
34
36
|
type: "button",
|
|
35
|
-
disabled:
|
|
37
|
+
disabled: s,
|
|
38
|
+
"aria-checked": e === t,
|
|
36
39
|
"data-selected": e === t,
|
|
37
|
-
onClick: () => e !== t &&
|
|
40
|
+
onClick: () => e !== t && c(e),
|
|
38
41
|
children: l
|
|
39
42
|
},
|
|
40
43
|
e
|
|
@@ -42,5 +45,5 @@ const h = "Segmented_segmented_UOs8Z", S = {
|
|
|
42
45
|
}
|
|
43
46
|
);
|
|
44
47
|
export {
|
|
45
|
-
|
|
48
|
+
b as Segmented
|
|
46
49
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Button as t } from "../Button/Button.js";
|
|
3
|
+
const n = ({ selected: a = !1, role: o, ...r }) => /* @__PURE__ */ i(
|
|
4
|
+
t,
|
|
5
|
+
{
|
|
6
|
+
...r,
|
|
7
|
+
role: o,
|
|
8
|
+
"aria-checked": o === "radio" ? a : void 0,
|
|
9
|
+
"aria-pressed": o !== "radio" ? a : void 0,
|
|
10
|
+
"data-selected": a,
|
|
11
|
+
variant: a ? "primary" : "secondary"
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
export {
|
|
15
|
+
n as ToggleButton
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ToggleGroupProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {
|
|
3
|
+
variant?: 'inline' | 'block';
|
|
4
|
+
selected: number;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
equalWidth?: boolean;
|
|
7
|
+
children: React.ReactElement[];
|
|
8
|
+
minWidth?: React.CSSProperties['minWidth'];
|
|
9
|
+
maxWidth?: React.CSSProperties['maxWidth'];
|
|
10
|
+
onSelect: (index: number) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const ToggleGroup: ({ variant, selected, disabled, equalWidth, minWidth, maxWidth, className, style, children, onSelect, ...props }: ToggleGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
2
|
+
import e from "react";
|
|
3
|
+
import x from "classnames";
|
|
4
|
+
import { cssProps as h } from "../../utils/helpers.js";
|
|
5
|
+
const k = "ToggleButton_group_yo9Nc", t = {
|
|
6
|
+
group: k
|
|
7
|
+
}, T = ({
|
|
8
|
+
variant: o = "inline",
|
|
9
|
+
selected: l,
|
|
10
|
+
disabled: s,
|
|
11
|
+
equalWidth: c,
|
|
12
|
+
minWidth: p,
|
|
13
|
+
maxWidth: i,
|
|
14
|
+
className: n,
|
|
15
|
+
style: g,
|
|
16
|
+
children: m,
|
|
17
|
+
onSelect: u,
|
|
18
|
+
...d
|
|
19
|
+
}) => {
|
|
20
|
+
const a = o === "block" ? "flex" : void 0, f = c ? "0" : void 0;
|
|
21
|
+
return /* @__PURE__ */ _(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
...d,
|
|
25
|
+
role: "radiogroup",
|
|
26
|
+
"data-toggle-group": !0,
|
|
27
|
+
className: x(t.group, t[o], n),
|
|
28
|
+
style: { ...g, ...h({ display: a, flexBasis: f, minWidth: p, maxWidth: i }) },
|
|
29
|
+
children: e.Children.map(
|
|
30
|
+
m,
|
|
31
|
+
(y, r) => e.cloneElement(y, {
|
|
32
|
+
role: "radio",
|
|
33
|
+
disabled: s,
|
|
34
|
+
selected: r === l,
|
|
35
|
+
onClick: () => u(r)
|
|
36
|
+
})
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
T as ToggleGroup
|
|
43
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export * from './components/Progress';
|
|
|
12
12
|
export * from './components/Segmented';
|
|
13
13
|
export * from './components/Spinner';
|
|
14
14
|
export * from './components/Tag';
|
|
15
|
+
export * from './components/ToggleButton';
|
|
15
16
|
export * from './components/Tooltip';
|
|
16
17
|
export * from './utils/colors';
|
package/dist/index.js
CHANGED
|
@@ -1,62 +1,68 @@
|
|
|
1
1
|
import { Avatar as e } from "./components/Avatar/Avatar.js";
|
|
2
2
|
import { Badge as p } from "./components/Badge/Badge.js";
|
|
3
|
-
import { Button as
|
|
4
|
-
import { Dialog as
|
|
5
|
-
import { useDialog as
|
|
6
|
-
import { withDialog as
|
|
7
|
-
import { Flex as
|
|
8
|
-
import { Checkbox as
|
|
9
|
-
import { Field as
|
|
10
|
-
import { I as
|
|
11
|
-
import {
|
|
12
|
-
import { Radio as
|
|
13
|
-
import { Select as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
3
|
+
import { Button as x } from "./components/Button/Button.js";
|
|
4
|
+
import { Dialog as i, DialogClose as a, DialogContent as l, DialogFooter as g, DialogTitle as n } from "./components/Dialog/Dialog.js";
|
|
5
|
+
import { useDialog as u } from "./components/Dialog/useDialog.js";
|
|
6
|
+
import { withDialog as d } from "./components/Dialog/withDialog.js";
|
|
7
|
+
import { Flex as T } from "./components/Flex/Flex.js";
|
|
8
|
+
import { Checkbox as B } from "./components/Fields/Checkbox.js";
|
|
9
|
+
import { Field as I, FieldDescription as S, FieldLabel as h } from "./components/Fields/Field.js";
|
|
10
|
+
import { I as w } from "./Input-DbQTM4UI.js";
|
|
11
|
+
import { Numeric as N } from "./components/Fields/Numeric.js";
|
|
12
|
+
import { Radio as V } from "./components/Fields/Radio.js";
|
|
13
|
+
import { Select as v } from "./components/Fields/Select.js";
|
|
14
|
+
import { Switch as G } from "./components/Fields/Switch.js";
|
|
15
|
+
import { Textarea as L } from "./components/Fields/Textarea.js";
|
|
16
|
+
import { V as j } from "./ValidationTooltip-BgSwl0hJ.js";
|
|
17
|
+
import { Heading as y } from "./components/Heading/Heading.js";
|
|
18
|
+
import { Icon as E } from "./components/Icon/Icon.js";
|
|
19
|
+
import { Menu as K } from "./components/Menu/Menu.js";
|
|
20
|
+
import { MenuItem as Q } from "./components/Menu/MenuItem.js";
|
|
21
|
+
import { Notice as W } from "./components/Notice/Notice.js";
|
|
22
|
+
import { ProgressBar as Y } from "./components/Progress/ProgressBar.js";
|
|
23
|
+
import { ProgressCircular as _ } from "./components/Progress/ProgressCircular.js";
|
|
24
|
+
import { Segmented as oo } from "./components/Segmented/Segmented.js";
|
|
25
|
+
import { Spinner as eo } from "./components/Spinner/Spinner.js";
|
|
26
|
+
import { Tag as po } from "./components/Tag/Tag.js";
|
|
27
|
+
import { ToggleButton as xo } from "./components/ToggleButton/ToggleButton.js";
|
|
28
|
+
import { ToggleGroup as io } from "./components/ToggleButton/ToggleGroup.js";
|
|
29
|
+
import { Tooltip as lo } from "./components/Tooltip/Tooltip.js";
|
|
30
|
+
import { palette as no } from "./utils/colors.js";
|
|
28
31
|
export {
|
|
29
32
|
e as Avatar,
|
|
30
33
|
p as Badge,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
x as Button,
|
|
35
|
+
B as Checkbox,
|
|
36
|
+
i as Dialog,
|
|
37
|
+
a as DialogClose,
|
|
35
38
|
l as DialogContent,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
g as DialogFooter,
|
|
40
|
+
n as DialogTitle,
|
|
41
|
+
I as Field,
|
|
39
42
|
S as FieldDescription,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Y as
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
43
|
+
h as FieldLabel,
|
|
44
|
+
T as Flex,
|
|
45
|
+
y as Heading,
|
|
46
|
+
E as Icon,
|
|
47
|
+
w as Input,
|
|
48
|
+
K as Menu,
|
|
49
|
+
Q as MenuItem,
|
|
50
|
+
W as Notice,
|
|
51
|
+
N as Numeric,
|
|
52
|
+
Y as ProgressBar,
|
|
53
|
+
_ as ProgressCircular,
|
|
54
|
+
V as Radio,
|
|
55
|
+
oo as Segmented,
|
|
56
|
+
v as Select,
|
|
57
|
+
eo as Spinner,
|
|
58
|
+
G as Switch,
|
|
59
|
+
po as Tag,
|
|
60
|
+
L as Textarea,
|
|
61
|
+
xo as ToggleButton,
|
|
62
|
+
io as ToggleGroup,
|
|
63
|
+
lo as Tooltip,
|
|
64
|
+
j as ValidationTooltip,
|
|
65
|
+
no as palette,
|
|
66
|
+
u as useDialog,
|
|
67
|
+
d as withDialog
|
|
62
68
|
};
|
|
@@ -13,17 +13,17 @@ $font-weight: (
|
|
|
13
13
|
|
|
14
14
|
$font-size: (
|
|
15
15
|
em: 16px,
|
|
16
|
-
xs: 0.750rem,
|
|
17
|
-
sm: 0.875rem,
|
|
18
|
-
md: 1.000rem,
|
|
19
|
-
lg: 1.125rem,
|
|
20
|
-
xl: 1.250rem,
|
|
21
|
-
h6: clamp(1.000rem, 2.25vw, 1.125rem),
|
|
22
|
-
h5: clamp(1.125rem, 2.50vw, 1.250rem),
|
|
23
|
-
h4: clamp(1.250rem, 3.00vw, 1.500rem),
|
|
24
|
-
h3: clamp(1.500rem, 3.50vw, 1.750rem),
|
|
25
|
-
h2: clamp(1.750rem, 4.00vw, 2.000rem),
|
|
26
|
-
h1: clamp(2.000rem, 5.00vw, 2.500rem),
|
|
16
|
+
xs: 0.750rem, // 12
|
|
17
|
+
sm: 0.875rem, // 14
|
|
18
|
+
md: 1.000rem, // 16
|
|
19
|
+
lg: 1.125rem, // 18
|
|
20
|
+
xl: 1.250rem, // 20
|
|
21
|
+
h6: clamp(1.000rem, 2.25vw, 1.125rem), // 16 → 18
|
|
22
|
+
h5: clamp(1.125rem, 2.50vw, 1.250rem), // 18 → 20
|
|
23
|
+
h4: clamp(1.250rem, 3.00vw, 1.500rem), // 20 → 24
|
|
24
|
+
h3: clamp(1.500rem, 3.50vw, 1.750rem), // 24 → 28
|
|
25
|
+
h2: clamp(1.750rem, 4.00vw, 2.000rem), // 28 → 32
|
|
26
|
+
h1: clamp(2.000rem, 5.00vw, 2.500rem), // 32 → 40
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
$line-height: (
|
|
@@ -35,19 +35,21 @@ $line-height: (
|
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
$border-radius: (
|
|
38
|
-
xs: 0.1875rem, //
|
|
39
|
-
sm: 0.3125rem, //
|
|
40
|
-
md: 0.5000rem, //
|
|
41
|
-
lg: 0.7500rem, //
|
|
42
|
-
xl: 1.1250rem, //
|
|
38
|
+
xs: 0.1875rem, // 03
|
|
39
|
+
sm: 0.3125rem, // 05
|
|
40
|
+
md: 0.5000rem, // 08
|
|
41
|
+
lg: 0.7500rem, // 12
|
|
42
|
+
xl: 1.1250rem, // 18
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
$spacing: (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
2xs: clamp(0.500rem, 1.25vw, 0.625rem), // 08 → 10
|
|
47
|
+
xs: clamp(0.750rem, 1.75vw, 0.875rem), // 12 → 14
|
|
48
|
+
sm: clamp(1.000rem, 2.50vw, 1.250rem), // 16 → 20
|
|
49
|
+
md: clamp(1.375rem, 3.50vw, 1.750rem), // 22 → 28
|
|
50
|
+
lg: clamp(1.875rem, 4.75vw, 2.375rem), // 30 → 38
|
|
51
|
+
xl: clamp(2.500rem, 6.25vw, 3.125rem), // 40 → 50
|
|
52
|
+
2xl: clamp(3.250rem, 8.00vw, 4.000rem), // 52 → 64
|
|
51
53
|
);
|
|
52
54
|
|
|
53
55
|
$drop-shadow: (
|
package/dist/styles/_utils.scss
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use 'sass:math';
|
|
3
3
|
@use 'sass:meta';
|
|
4
|
+
@use 'sass:list';
|
|
4
5
|
@use 'sass:color';
|
|
5
6
|
@use 'sass:string';
|
|
6
7
|
|
|
@@ -44,6 +45,17 @@
|
|
|
44
45
|
@return map.merge($colors, color-palette($palette, $bg, $fg));
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
// Returns a list of keys converted into strings,
|
|
49
|
+
// mainly used to get a palette color names as strings
|
|
50
|
+
// to avoid sass interpolation warnings
|
|
51
|
+
@function string-keys($map) {
|
|
52
|
+
$output: ();
|
|
53
|
+
@each $key in map.keys($map) {
|
|
54
|
+
$output: list.append($output, $key + '');
|
|
55
|
+
}
|
|
56
|
+
@return $output;
|
|
57
|
+
}
|
|
58
|
+
|
|
47
59
|
// Shortcut to set an opacity for a CSS variable
|
|
48
60
|
@function color-opacity($hex, $opacity) {
|
|
49
61
|
@return color-mix(in srgb, $hex $opacity, transparent);
|
|
@@ -84,11 +96,6 @@
|
|
|
84
96
|
@return string.unquote('#' + string.slice($ie-hex, 4));
|
|
85
97
|
}
|
|
86
98
|
|
|
87
|
-
// Convert color to string
|
|
88
|
-
@function to-string($color) {
|
|
89
|
-
@return $color + '';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
99
|
@mixin focus-visible($color: var(--color-focus)) {
|
|
93
100
|
outline-width: 3px;
|
|
94
101
|
outline-offset: 2px;
|