@kolking/react-ui 1.8.15 → 1.8.17
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/components/Badge/Badge.js +13 -12
- package/dist/components/Button/Button.js +33 -47
- package/dist/components/Button/ButtonGroup.d.ts +8 -0
- package/dist/components/Button/ButtonGroup.js +25 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +3 -1
- package/dist/components/Fields/Field.d.ts +3 -2
- package/dist/components/Fields/Field.js +33 -32
- package/dist/components/Fields/Numeric.js +12 -11
- package/dist/components/Segmented/Segmented.d.ts +10 -5
- package/dist/components/Segmented/Segmented.js +62 -51
- package/dist/components/Tag/Tag.js +16 -13
- package/dist/components/ToggleButton/ToggleButton.js +13 -11
- package/dist/components/ToggleButton/ToggleGroup.d.ts +4 -5
- package/dist/components/ToggleButton/ToggleGroup.js +35 -31
- package/dist/index.js +75 -73
- package/dist/styles/_theme-default.scss +4 -2
- package/dist/styles/style.css +1 -1
- package/dist/styles.module-q4f7jLJ9.js +19 -0
- package/dist/utils/colors.d.ts +1 -1
- package/dist/utils/colors.js +2 -1
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as h } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as _, useLayoutEffect as w, useEffect as l } from "react";
|
|
3
3
|
import E from "classnames";
|
|
4
|
-
import { wrapNode as P, cssProps as
|
|
5
|
-
const
|
|
6
|
-
badge:
|
|
7
|
-
appear:
|
|
4
|
+
import { wrapNode as P, cssProps as H } from "../../utils/helpers.js";
|
|
5
|
+
const M = "Badge_badge_-mEE7", k = "Badge_appear_LbxbS", x = "Badge_accent_BIYve", L = "Badge_gray_7jA-J", I = "Badge_brown_x1GS7", R = "Badge_red_zPgCR", S = "Badge_orange_EoLmF", X = "Badge_yellow_qvbb6", j = "Badge_green_XX-1c", v = "Badge_teal_VHoFK", C = "Badge_cyan_1ksBn", F = "Badge_blue_YulfT", K = "Badge_indigo_2KXUy", N = "Badge_purple_o55fQ", O = "Badge_pink_T5H--", g = {
|
|
6
|
+
badge: M,
|
|
7
|
+
appear: k,
|
|
8
|
+
accent: x,
|
|
8
9
|
gray: L,
|
|
9
10
|
brown: I,
|
|
10
11
|
red: R,
|
|
@@ -16,9 +17,9 @@ const x = "Badge_badge_-mEE7", H = "Badge_appear_LbxbS", L = "Badge_gray_7jA-J",
|
|
|
16
17
|
blue: F,
|
|
17
18
|
indigo: K,
|
|
18
19
|
purple: N,
|
|
19
|
-
|
|
20
|
+
pink: O
|
|
20
21
|
};
|
|
21
|
-
function
|
|
22
|
+
function T(a) {
|
|
22
23
|
const n = _();
|
|
23
24
|
return l(() => {
|
|
24
25
|
n.current = a;
|
|
@@ -34,7 +35,7 @@ const A = ({
|
|
|
34
35
|
style: f,
|
|
35
36
|
...y
|
|
36
37
|
}) => {
|
|
37
|
-
const e = !o, p =
|
|
38
|
+
const e = !o, p = T(e), t = _(null);
|
|
38
39
|
if (w(() => {
|
|
39
40
|
var r;
|
|
40
41
|
p && !e && ((r = t.current) == null || r.classList.add(g.appear));
|
|
@@ -43,12 +44,12 @@ const A = ({
|
|
|
43
44
|
const r = t.current.clientHeight, d = t.current.parentElement, i = d ? Math.min(
|
|
44
45
|
parseInt(getComputedStyle(d).getPropertyValue("border-radius")),
|
|
45
46
|
d.clientHeight / 2
|
|
46
|
-
) : 0,
|
|
47
|
-
t.current.style.setProperty("--offset", `${
|
|
47
|
+
) : 0, b = i * (1 - Math.sin(45 * Math.PI / 180)), m = (1 + Math.min(i / r, 1)) * (r / 4);
|
|
48
|
+
t.current.style.setProperty("--offset", `${b - m}px`);
|
|
48
49
|
}
|
|
49
50
|
}, [e, s]), e)
|
|
50
51
|
return null;
|
|
51
|
-
const
|
|
52
|
+
const B = typeof o == "number" && c > 0 && o > c;
|
|
52
53
|
return /* @__PURE__ */ h(
|
|
53
54
|
"div",
|
|
54
55
|
{
|
|
@@ -57,8 +58,8 @@ const A = ({
|
|
|
57
58
|
"data-badge": n,
|
|
58
59
|
"data-placement": s,
|
|
59
60
|
className: E(g.badge, g[n], u),
|
|
60
|
-
style: { ...f, ...
|
|
61
|
-
children: P(
|
|
61
|
+
style: { ...f, ...H({ size: a }) },
|
|
62
|
+
children: P(B ? `${c}+` : o, "span")
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
};
|
|
@@ -1,62 +1,48 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { fixedForwardRef as
|
|
1
|
+
import { jsxs as m, jsx as y, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import w from "classnames";
|
|
3
|
+
import { fixedForwardRef as E, wrapNode as i, cssProps as F } from "../../utils/helpers.js";
|
|
4
4
|
import { Spinner as N } from "../Spinner/Spinner.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"secondary-default": "Button_secondary-default_yggNH",
|
|
9
|
-
"tertiary-default": "Button_tertiary-default_qSFa6",
|
|
10
|
-
"primary-negative": "Button_primary-negative_AupXJ",
|
|
11
|
-
"secondary-negative": "Button_secondary-negative_bZbAE",
|
|
12
|
-
"tertiary-negative": "Button_tertiary-negative_7Dh-3",
|
|
13
|
-
"primary-positive": "Button_primary-positive_4Mnfc",
|
|
14
|
-
"secondary-positive": "Button_secondary-positive_h1UJg",
|
|
15
|
-
"tertiary-positive": "Button_tertiary-positive_oTrM5",
|
|
16
|
-
"primary-warning": "Button_primary-warning_9A3NY",
|
|
17
|
-
"secondary-warning": "Button_secondary-warning_mbIUl",
|
|
18
|
-
"tertiary-warning": "Button_tertiary-warning_gM2um"
|
|
19
|
-
};
|
|
20
|
-
function A({
|
|
21
|
-
as: _,
|
|
5
|
+
import { s as l } from "../../styles.module-q4f7jLJ9.js";
|
|
6
|
+
function $({
|
|
7
|
+
as: p,
|
|
22
8
|
variant: r = "primary",
|
|
23
|
-
scheme:
|
|
24
|
-
size:
|
|
25
|
-
minWidth:
|
|
26
|
-
maxWidth:
|
|
9
|
+
scheme: e = "default",
|
|
10
|
+
size: f,
|
|
11
|
+
minWidth: u,
|
|
12
|
+
maxWidth: c,
|
|
27
13
|
busy: t,
|
|
28
|
-
title:
|
|
29
|
-
icon:
|
|
30
|
-
iconPosition:
|
|
31
|
-
children:
|
|
32
|
-
className:
|
|
33
|
-
style:
|
|
34
|
-
...
|
|
35
|
-
},
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
|
|
14
|
+
title: a,
|
|
15
|
+
icon: o,
|
|
16
|
+
iconPosition: s = "start",
|
|
17
|
+
children: d,
|
|
18
|
+
className: b,
|
|
19
|
+
style: x,
|
|
20
|
+
...n
|
|
21
|
+
}, v) {
|
|
22
|
+
return /* @__PURE__ */ m(
|
|
23
|
+
p ?? "button",
|
|
38
24
|
{
|
|
39
|
-
...
|
|
40
|
-
ref:
|
|
25
|
+
...n,
|
|
26
|
+
ref: v,
|
|
41
27
|
"data-busy": t,
|
|
42
28
|
"data-button": r,
|
|
43
|
-
"data-scheme":
|
|
44
|
-
"aria-disabled":
|
|
29
|
+
"data-scheme": e,
|
|
30
|
+
"aria-disabled": n.disabled,
|
|
45
31
|
"aria-live": t ? "polite" : void 0,
|
|
46
|
-
className:
|
|
47
|
-
style: { ...
|
|
32
|
+
className: w(l.button, l[`${r}-${e}`], b),
|
|
33
|
+
style: { ...x, ...F({ size: f, minWidth: u, maxWidth: c }) },
|
|
48
34
|
children: [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
d ? i(d, "span") : /* @__PURE__ */ m(j, { children: [
|
|
36
|
+
s === "start" && o,
|
|
37
|
+
a !== void 0 && i(a, "span"),
|
|
38
|
+
s === "end" && o
|
|
53
39
|
] }),
|
|
54
|
-
t && /* @__PURE__ */
|
|
40
|
+
t && /* @__PURE__ */ y(N, { overlay: !0 })
|
|
55
41
|
]
|
|
56
42
|
}
|
|
57
43
|
);
|
|
58
44
|
}
|
|
59
|
-
const
|
|
45
|
+
const q = E($);
|
|
60
46
|
export {
|
|
61
|
-
|
|
47
|
+
q as Button
|
|
62
48
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ButtonGroupProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
children: React.ReactElement[];
|
|
4
|
+
minWidth?: React.CSSProperties['minWidth'];
|
|
5
|
+
maxWidth?: React.CSSProperties['maxWidth'];
|
|
6
|
+
flexBasis?: React.CSSProperties['flexBasis'];
|
|
7
|
+
};
|
|
8
|
+
export declare const ButtonGroup: ({ minWidth, maxWidth, flexBasis, className, style, children, ...props }: ButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import e from "classnames";
|
|
3
|
+
import { cssProps as i } from "../../utils/helpers.js";
|
|
4
|
+
import { s as c } from "../../styles.module-q4f7jLJ9.js";
|
|
5
|
+
const g = ({
|
|
6
|
+
minWidth: o,
|
|
7
|
+
maxWidth: r,
|
|
8
|
+
flexBasis: t,
|
|
9
|
+
className: s,
|
|
10
|
+
style: m,
|
|
11
|
+
children: p,
|
|
12
|
+
...u
|
|
13
|
+
}) => /* @__PURE__ */ a(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
...u,
|
|
17
|
+
"data-button-group": !0,
|
|
18
|
+
className: e(c.group, s),
|
|
19
|
+
style: { ...m, ...i({ flexBasis: t, minWidth: o, maxWidth: r }) },
|
|
20
|
+
children: p
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
export {
|
|
24
|
+
g as ButtonGroup
|
|
25
|
+
};
|
|
@@ -2,6 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
export interface FieldConfig {
|
|
3
3
|
id?: string;
|
|
4
4
|
label?: React.ReactNode;
|
|
5
|
+
labelId?: string;
|
|
5
6
|
labelAccessory?: React.ReactNode;
|
|
6
7
|
help?: React.ReactNode;
|
|
7
8
|
required?: boolean;
|
|
@@ -14,7 +15,7 @@ export type FieldLabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
|
14
15
|
required?: boolean;
|
|
15
16
|
};
|
|
16
17
|
export declare const FieldLabel: ({ label, required, className, children, ...props }: FieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export type FieldDescriptionProps = React.HTMLAttributes<
|
|
18
|
+
export type FieldDescriptionProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
18
19
|
export declare const FieldDescription: ({ className, children, ...props }: FieldDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export type FieldProps = React.HTMLAttributes<HTMLDivElement> & FieldConfig;
|
|
20
|
-
export declare const Field: ({ id, label, labelAccessory, help, required, minWidth, maxWidth, className, children, style, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const Field: ({ id, label, labelId, labelAccessory, help, required, minWidth, maxWidth, className, children, style, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import d from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import { cssProps as
|
|
5
|
-
const
|
|
6
|
-
field:
|
|
7
|
-
header:
|
|
8
|
-
label:
|
|
9
|
-
accessory:
|
|
10
|
-
description:
|
|
11
|
-
},
|
|
12
|
-
/* @__PURE__ */
|
|
3
|
+
import p from "react";
|
|
4
|
+
import { cssProps as u } from "../../utils/helpers.js";
|
|
5
|
+
const b = "styles_field_hqzKT", N = "styles_header_Iwsz6", F = "styles_label_zRVTS", v = "styles_accessory_S4ccn", x = "styles_description_fZnNW", t = {
|
|
6
|
+
field: b,
|
|
7
|
+
header: N,
|
|
8
|
+
label: F,
|
|
9
|
+
accessory: v,
|
|
10
|
+
description: x
|
|
11
|
+
}, z = ({ label: e, required: s, className: l, children: r, ...c }) => /* @__PURE__ */ i("div", { "data-field-header": !0, className: t.header, children: [
|
|
12
|
+
/* @__PURE__ */ a(
|
|
13
13
|
"label",
|
|
14
14
|
{
|
|
15
15
|
...c,
|
|
16
16
|
"data-field-label": !0,
|
|
17
17
|
"data-required": s,
|
|
18
|
-
className: d(
|
|
18
|
+
className: d(t.label, l),
|
|
19
19
|
children: e
|
|
20
20
|
}
|
|
21
21
|
),
|
|
22
|
-
|
|
23
|
-
] }),
|
|
22
|
+
p.Children.toArray(r).length > 0 && /* @__PURE__ */ a("div", { "data-field-accessory": !0, className: t.accessory, children: r })
|
|
23
|
+
] }), j = ({ className: e, children: s, ...l }) => /* @__PURE__ */ a("small", { ...l, "data-field-description": !0, className: d(t.description, e), children: s }), g = ({
|
|
24
24
|
id: e,
|
|
25
25
|
label: s,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
labelId: l,
|
|
27
|
+
labelAccessory: r,
|
|
28
|
+
help: c,
|
|
29
|
+
required: o,
|
|
30
|
+
minWidth: n,
|
|
31
|
+
maxWidth: f,
|
|
32
|
+
className: m,
|
|
33
|
+
children: y,
|
|
34
|
+
style: h,
|
|
35
|
+
..._
|
|
35
36
|
}) => /* @__PURE__ */ i(
|
|
36
37
|
"div",
|
|
37
38
|
{
|
|
38
|
-
...
|
|
39
|
+
..._,
|
|
39
40
|
"data-field": e || !0,
|
|
40
|
-
className: d(
|
|
41
|
-
style: { ...
|
|
41
|
+
className: d(t.field, m),
|
|
42
|
+
style: { ...h, ...u({ minWidth: n, maxWidth: f }) },
|
|
42
43
|
children: [
|
|
43
|
-
s && /* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
s && /* @__PURE__ */ a(z, { id: l, htmlFor: e, label: s, required: o, children: r }),
|
|
45
|
+
y,
|
|
46
|
+
c && /* @__PURE__ */ a(j, { children: c })
|
|
46
47
|
]
|
|
47
48
|
}
|
|
48
49
|
);
|
|
49
50
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
g as Field,
|
|
52
|
+
j as FieldDescription,
|
|
53
|
+
z as FieldLabel
|
|
53
54
|
};
|
|
@@ -2,20 +2,21 @@ import { jsxs as f, jsx as a } from "react/jsx-runtime";
|
|
|
2
2
|
import y from "classnames";
|
|
3
3
|
import _, { useRef as h, useImperativeHandle as v, useCallback as s } from "react";
|
|
4
4
|
import { Icon as i } from "../Icon/Icon.js";
|
|
5
|
-
import { Button as
|
|
5
|
+
import { Button as o } from "../Button/Button.js";
|
|
6
|
+
import "../../utils/helpers.js";
|
|
6
7
|
import { I as w } from "../../Input-D46mAsdt.js";
|
|
7
8
|
const E = "styles_numeric_dzUSE", R = "styles_increase_5S-Jo", g = "styles_decrease_j8UR6", c = {
|
|
8
9
|
numeric: E,
|
|
9
10
|
increase: R,
|
|
10
11
|
decrease: g
|
|
11
|
-
},
|
|
12
|
-
({ labelIncrease:
|
|
12
|
+
}, C = _.forwardRef(
|
|
13
|
+
({ labelIncrease: l = "increase", labelDecrease: d = "decrease", className: u, ...n }, m) => {
|
|
13
14
|
const e = h(null);
|
|
14
15
|
v(m, () => e.current);
|
|
15
|
-
const
|
|
16
|
+
const p = s(() => {
|
|
16
17
|
var r, t;
|
|
17
18
|
(r = e.current) == null || r.stepUp(), (t = e.current) == null || t.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
18
|
-
}, []),
|
|
19
|
+
}, []), b = s(() => {
|
|
19
20
|
var r, t;
|
|
20
21
|
(r = e.current) == null || r.stepDown(), (t = e.current) == null || t.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
21
22
|
}, []);
|
|
@@ -29,19 +30,19 @@ const E = "styles_numeric_dzUSE", R = "styles_increase_5S-Jo", g = "styles_decre
|
|
|
29
30
|
className: y(c.numeric, u),
|
|
30
31
|
children: [
|
|
31
32
|
/* @__PURE__ */ a(
|
|
32
|
-
|
|
33
|
+
o,
|
|
33
34
|
{
|
|
34
35
|
type: "button",
|
|
35
36
|
variant: "secondary",
|
|
36
|
-
"aria-label":
|
|
37
|
+
"aria-label": l,
|
|
37
38
|
disabled: n.disabled || n.readOnly,
|
|
38
39
|
className: c.increase,
|
|
39
40
|
icon: /* @__PURE__ */ a(i, { name: "triangle-up" }),
|
|
40
|
-
onClick:
|
|
41
|
+
onClick: p
|
|
41
42
|
}
|
|
42
43
|
),
|
|
43
44
|
/* @__PURE__ */ a(
|
|
44
|
-
|
|
45
|
+
o,
|
|
45
46
|
{
|
|
46
47
|
type: "button",
|
|
47
48
|
variant: "secondary",
|
|
@@ -49,7 +50,7 @@ const E = "styles_numeric_dzUSE", R = "styles_increase_5S-Jo", g = "styles_decre
|
|
|
49
50
|
disabled: n.disabled || n.readOnly,
|
|
50
51
|
className: c.decrease,
|
|
51
52
|
icon: /* @__PURE__ */ a(i, { name: "triangle-down" }),
|
|
52
|
-
onClick:
|
|
53
|
+
onClick: b
|
|
53
54
|
}
|
|
54
55
|
)
|
|
55
56
|
]
|
|
@@ -58,5 +59,5 @@ const E = "styles_numeric_dzUSE", R = "styles_increase_5S-Jo", g = "styles_decre
|
|
|
58
59
|
}
|
|
59
60
|
);
|
|
60
61
|
export {
|
|
61
|
-
|
|
62
|
+
C as Numeric
|
|
62
63
|
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type SegmentedItem<T> = {
|
|
2
|
+
value: T;
|
|
3
|
+
label: React.ReactNode;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type SegmentedProps<T> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {
|
|
2
7
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
-
items:
|
|
4
|
-
selected
|
|
8
|
+
items: SegmentedItem<T>[];
|
|
9
|
+
selected?: T;
|
|
5
10
|
disabled?: boolean;
|
|
6
11
|
margin?: React.CSSProperties['margin'];
|
|
7
|
-
onSelect
|
|
12
|
+
onSelect?: (value: T) => void;
|
|
8
13
|
};
|
|
9
|
-
export declare const Segmented: ({ size, items, selected, disabled, margin, children, className, style, onSelect, ...props }: SegmentedProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const Segmented: <T>({ size, items, selected, disabled, margin, children, className, style, onSelect, ...props }: SegmentedProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,53 +1,64 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import { jsxs as f, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import v from "classnames";
|
|
3
|
+
import { useState as h, useEffect as _ } from "react";
|
|
4
|
+
import { Composite as y, CompositeItem as C } from "@floating-ui/react";
|
|
5
|
+
import { cssProps as N, wrapNode as j } from "../../utils/helpers.js";
|
|
6
|
+
const k = "Segmented_button_FPqA0", x = "Segmented_segmented_UOs8Z", l = {
|
|
7
|
+
button: k,
|
|
8
|
+
segmented: x
|
|
9
|
+
}, A = ({
|
|
10
|
+
size: u,
|
|
11
|
+
items: a,
|
|
12
|
+
selected: t = a[0].value,
|
|
13
|
+
disabled: s,
|
|
14
|
+
margin: p,
|
|
15
|
+
children: c,
|
|
16
|
+
className: i,
|
|
17
|
+
style: g,
|
|
18
|
+
onSelect: o,
|
|
19
|
+
...b
|
|
20
|
+
}) => {
|
|
21
|
+
const [r, n] = h(t);
|
|
22
|
+
return _(() => {
|
|
23
|
+
n(t);
|
|
24
|
+
}, [t]), /* @__PURE__ */ f(
|
|
25
|
+
y,
|
|
26
|
+
{
|
|
27
|
+
...b,
|
|
28
|
+
role: "radiogroup",
|
|
29
|
+
orientation: "horizontal",
|
|
30
|
+
"data-segmented": !0,
|
|
31
|
+
"data-disabled": s,
|
|
32
|
+
className: v(l.segmented, i),
|
|
33
|
+
style: { ...g, ...N({ size: u, margin: p }) },
|
|
34
|
+
children: [
|
|
35
|
+
a.map((e, d) => /* @__PURE__ */ m(
|
|
36
|
+
C,
|
|
37
|
+
{
|
|
38
|
+
render: /* @__PURE__ */ m(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
role: "radio",
|
|
42
|
+
type: "button",
|
|
43
|
+
disabled: s || e.disabled,
|
|
44
|
+
"data-segmented-item": d,
|
|
45
|
+
"aria-checked": e.value === r,
|
|
46
|
+
"data-selected": e.value === r,
|
|
47
|
+
className: l.button,
|
|
48
|
+
onClick: () => {
|
|
49
|
+
n(e.value), o == null || o(e.value);
|
|
50
|
+
},
|
|
51
|
+
children: j(e.label, "span")
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
},
|
|
55
|
+
d
|
|
56
|
+
)),
|
|
57
|
+
c
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
};
|
|
51
62
|
export {
|
|
52
|
-
|
|
63
|
+
A as Segmented
|
|
53
64
|
};
|
|
@@ -3,6 +3,9 @@ import T from "classnames";
|
|
|
3
3
|
import { fixedForwardRef as f, wrapNode as c, cssProps as y } from "../../utils/helpers.js";
|
|
4
4
|
const b = "Tag_tag_-ovOm", _ = {
|
|
5
5
|
tag: b,
|
|
6
|
+
"default-accent": "Tag_default-accent_uUXnO",
|
|
7
|
+
"solid-accent": "Tag_solid-accent_bbTSM",
|
|
8
|
+
"plain-accent": "Tag_plain-accent_cqQHI",
|
|
6
9
|
"default-gray": "Tag_default-gray_Ju2wo",
|
|
7
10
|
"solid-gray": "Tag_solid-gray_q6GO4",
|
|
8
11
|
"plain-gray": "Tag_plain-gray_VOC5n",
|
|
@@ -36,41 +39,41 @@ const b = "Tag_tag_-ovOm", _ = {
|
|
|
36
39
|
"default-purple": "Tag_default-purple_oBbek",
|
|
37
40
|
"solid-purple": "Tag_solid-purple_e10WH",
|
|
38
41
|
"plain-purple": "Tag_plain-purple_sVJ5H",
|
|
39
|
-
"default-
|
|
40
|
-
"solid-
|
|
41
|
-
"plain-
|
|
42
|
+
"default-pink": "Tag_default-pink_OAPbj",
|
|
43
|
+
"solid-pink": "Tag_solid-pink_MDD-Z",
|
|
44
|
+
"plain-pink": "Tag_plain-pink_cFBKk"
|
|
42
45
|
};
|
|
43
46
|
function w({
|
|
44
47
|
as: d,
|
|
45
48
|
size: g,
|
|
46
49
|
variant: a = "default",
|
|
47
50
|
scheme: l = "gray",
|
|
48
|
-
title:
|
|
51
|
+
title: i,
|
|
49
52
|
icon: e,
|
|
50
53
|
iconPosition: n = "start",
|
|
51
|
-
className:
|
|
54
|
+
className: o,
|
|
52
55
|
style: t,
|
|
53
56
|
children: r,
|
|
54
|
-
...
|
|
55
|
-
},
|
|
57
|
+
...p
|
|
58
|
+
}, u) {
|
|
56
59
|
return /* @__PURE__ */ s(
|
|
57
60
|
d ?? "span",
|
|
58
61
|
{
|
|
59
|
-
...
|
|
60
|
-
ref:
|
|
62
|
+
...p,
|
|
63
|
+
ref: u,
|
|
61
64
|
"data-tag": a,
|
|
62
65
|
"data-scheme": l,
|
|
63
|
-
className: T(_.tag, _[`${a}-${l}`],
|
|
66
|
+
className: T(_.tag, _[`${a}-${l}`], o),
|
|
64
67
|
style: { ...t, ...y({ size: g }) },
|
|
65
68
|
children: [
|
|
66
69
|
n === "start" && e,
|
|
67
|
-
c(r ||
|
|
70
|
+
c(r || i, "span"),
|
|
68
71
|
n === "end" && e
|
|
69
72
|
]
|
|
70
73
|
}
|
|
71
74
|
);
|
|
72
75
|
}
|
|
73
|
-
const
|
|
76
|
+
const V = f(w);
|
|
74
77
|
export {
|
|
75
|
-
|
|
78
|
+
V as Tag
|
|
76
79
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import d from "react";
|
|
3
|
-
import { Button as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { Button as m } from "../Button/Button.js";
|
|
4
|
+
import "classnames";
|
|
5
|
+
import "../../utils/helpers.js";
|
|
6
|
+
const g = d.forwardRef(
|
|
7
|
+
({ selected: o = !1, role: r, ...a }, t) => /* @__PURE__ */ i(
|
|
8
|
+
m,
|
|
7
9
|
{
|
|
8
|
-
...
|
|
10
|
+
...a,
|
|
9
11
|
ref: t,
|
|
10
|
-
role:
|
|
12
|
+
role: r,
|
|
11
13
|
"data-toggle-button": !0,
|
|
12
|
-
"data-selected":
|
|
13
|
-
variant:
|
|
14
|
-
"aria-checked":
|
|
15
|
-
"aria-pressed":
|
|
14
|
+
"data-selected": o,
|
|
15
|
+
variant: o ? "primary" : "secondary",
|
|
16
|
+
"aria-checked": r === "radio" ? o : void 0,
|
|
17
|
+
"aria-pressed": r !== "radio" ? o : void 0
|
|
16
18
|
}
|
|
17
19
|
)
|
|
18
20
|
);
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
g as ToggleButton
|
|
21
23
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export type ToggleGroupProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {
|
|
3
|
-
|
|
4
|
-
selected: number;
|
|
3
|
+
selected?: number;
|
|
5
4
|
disabled?: boolean;
|
|
6
|
-
equalWidth?: boolean;
|
|
7
5
|
children: React.ReactElement[];
|
|
8
6
|
minWidth?: React.CSSProperties['minWidth'];
|
|
9
7
|
maxWidth?: React.CSSProperties['maxWidth'];
|
|
10
|
-
|
|
8
|
+
flexBasis?: React.CSSProperties['flexBasis'];
|
|
9
|
+
onSelect?: (index: number) => void;
|
|
11
10
|
};
|
|
12
|
-
export declare const ToggleGroup: ({
|
|
11
|
+
export declare const ToggleGroup: ({ selected, disabled, minWidth, maxWidth, flexBasis, className, style, children, onSelect, ...props }: ToggleGroupProps) => import("react/jsx-runtime").JSX.Element;
|