@cfx-dev/ui-components 4.3.6 → 4.3.7
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/assets/css/Radio.css +1 -1
- package/dist/assets/css/ToggleGroup.css +1 -1
- package/dist/assets/general/global.css +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +16 -4
- package/dist/components/ToggleGroup/ToggleGroup.js +72 -63
- package/dist/components/ToggleGroup/ToggleGroupShowcase.js +56 -19
- package/dist/styles-scss/global.scss +1 -1
- package/dist/styles-scss/tokens.scss +4 -7
- package/package.json +1 -1
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export declare enum ToggleGroupSizeEnum {
|
|
4
|
+
normal = "normal",
|
|
5
|
+
large = "large"
|
|
6
|
+
}
|
|
7
|
+
export type ToggleGroupSizeType = keyof typeof ToggleGroupSizeEnum;
|
|
8
|
+
export interface ToggleGroupOptionType {
|
|
4
9
|
value: string;
|
|
5
10
|
label: React.ReactNode;
|
|
6
11
|
icon?: React.ReactNode;
|
|
7
|
-
description?: string;
|
|
8
12
|
}
|
|
13
|
+
export interface ToggleGroupOptionProps {
|
|
14
|
+
option: ToggleGroupOptionType;
|
|
15
|
+
onClick: (value: string) => void;
|
|
16
|
+
active?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const ToggleGroupOption: React.NamedExoticComponent<ToggleGroupOptionProps>;
|
|
9
20
|
export interface ToggleGroupProps {
|
|
10
21
|
value: string;
|
|
11
|
-
options:
|
|
12
|
-
onChange:
|
|
22
|
+
options: ToggleGroupOptionType[];
|
|
23
|
+
onChange: (value: string) => void;
|
|
13
24
|
className?: string;
|
|
14
25
|
disabled?: boolean;
|
|
15
26
|
multiline?: boolean;
|
|
16
27
|
fullWidth?: boolean;
|
|
28
|
+
size?: ToggleGroupSizeType;
|
|
17
29
|
}
|
|
18
30
|
export declare const ToggleGroup: React.NamedExoticComponent<ToggleGroupProps>;
|
|
@@ -1,68 +1,77 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
root:
|
|
7
|
-
disabled:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { jsxs as m, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import g from "react";
|
|
3
|
+
import { clsx as f } from "../../utils/clsx.js";
|
|
4
|
+
const b = "cfxui__ToggleGroup__unsetAll__6911e", x = "cfxui__ToggleGroup__root__fb460", v = "cfxui__ToggleGroup__disabled__75462", h = "cfxui__ToggleGroup__fullWidth__0c589", G = "cfxui__ToggleGroup__large__ad624", T = "cfxui__ToggleGroup__options__7bc0c", C = "cfxui__ToggleGroup__option__8436c", W = "cfxui__ToggleGroup__active__84da0", k = "cfxui__ToggleGroup__multiline__6b784", o = {
|
|
5
|
+
unsetAll: b,
|
|
6
|
+
root: x,
|
|
7
|
+
disabled: v,
|
|
8
|
+
fullWidth: h,
|
|
9
|
+
large: G,
|
|
10
|
+
options: T,
|
|
11
|
+
option: C,
|
|
12
|
+
active: W,
|
|
13
|
+
multiline: k
|
|
14
|
+
};
|
|
15
|
+
var N = /* @__PURE__ */ ((t) => (t.normal = "normal", t.large = "large", t))(N || {});
|
|
16
|
+
const A = g.memo(function(_) {
|
|
17
|
+
const {
|
|
18
|
+
option: s,
|
|
19
|
+
onClick: e,
|
|
20
|
+
active: c = !1,
|
|
21
|
+
disabled: i = !1
|
|
22
|
+
} = _, {
|
|
23
|
+
value: l,
|
|
24
|
+
label: a,
|
|
25
|
+
icon: n
|
|
26
|
+
} = s, u = g.useCallback(() => {
|
|
27
|
+
e(l);
|
|
28
|
+
}, [e, l]);
|
|
29
|
+
return /* @__PURE__ */ m(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
type: "button",
|
|
33
|
+
className: f(o.unsetAll, o.option, {
|
|
34
|
+
[o.active]: c
|
|
35
|
+
}),
|
|
36
|
+
tabIndex: i ? 0 : 1,
|
|
37
|
+
onClick: u,
|
|
38
|
+
disabled: i,
|
|
39
|
+
children: [
|
|
40
|
+
n || null,
|
|
41
|
+
a
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
l
|
|
45
|
+
);
|
|
46
|
+
}), w = g.memo(function(_) {
|
|
19
47
|
const {
|
|
20
|
-
value:
|
|
21
|
-
options:
|
|
22
|
-
onChange:
|
|
23
|
-
className:
|
|
24
|
-
disabled:
|
|
25
|
-
multiline:
|
|
26
|
-
fullWidth:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, N = () => {
|
|
34
|
-
l(f(e, i));
|
|
35
|
-
}, W = _(o.option, {
|
|
36
|
-
[o.active]: t.value === e
|
|
37
|
-
});
|
|
38
|
-
return /* @__PURE__ */ d(
|
|
39
|
-
C,
|
|
40
|
-
{
|
|
41
|
-
className: W,
|
|
42
|
-
tabIndex: G,
|
|
43
|
-
onClick: T,
|
|
44
|
-
onMouseEnter: b,
|
|
45
|
-
onMouseLeave: N,
|
|
46
|
-
children: [
|
|
47
|
-
t.icon || null,
|
|
48
|
-
t.label
|
|
49
|
-
]
|
|
50
|
-
},
|
|
51
|
-
t.value
|
|
52
|
-
);
|
|
53
|
-
}),
|
|
54
|
-
[e, i, u, l]
|
|
55
|
-
), x = _(o.root, m, {
|
|
56
|
-
[o.disabled]: g,
|
|
57
|
-
[o.descripted]: c,
|
|
58
|
-
[o.multiline]: h,
|
|
59
|
-
[o.fullWidth]: a
|
|
48
|
+
value: s,
|
|
49
|
+
options: e,
|
|
50
|
+
onChange: c,
|
|
51
|
+
className: i = "",
|
|
52
|
+
disabled: l = !1,
|
|
53
|
+
multiline: a = !1,
|
|
54
|
+
fullWidth: n = !1,
|
|
55
|
+
size: u = "normal"
|
|
56
|
+
/* normal */
|
|
57
|
+
} = _, p = f(o.root, o[u], i, {
|
|
58
|
+
[o.disabled]: l,
|
|
59
|
+
[o.multiline]: a,
|
|
60
|
+
[o.fullWidth]: n
|
|
60
61
|
});
|
|
61
|
-
return /* @__PURE__ */ d("div", { className:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
return /* @__PURE__ */ d("div", { className: p, children: /* @__PURE__ */ d("div", { className: f(o.options, { [o.fullWidth]: n }), children: e.map((r) => /* @__PURE__ */ d(
|
|
63
|
+
A,
|
|
64
|
+
{
|
|
65
|
+
option: r,
|
|
66
|
+
onClick: c,
|
|
67
|
+
active: r.value === s,
|
|
68
|
+
disabled: l
|
|
69
|
+
},
|
|
70
|
+
r.value
|
|
71
|
+
)) }) });
|
|
65
72
|
});
|
|
66
73
|
export {
|
|
67
|
-
|
|
74
|
+
w as ToggleGroup,
|
|
75
|
+
A as ToggleGroupOption,
|
|
76
|
+
N as ToggleGroupSizeEnum
|
|
68
77
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import u from "react";
|
|
3
3
|
import r from "../Flex/Flex.js";
|
|
4
|
-
import { Text as
|
|
4
|
+
import { Text as o } from "../Text/Text.js";
|
|
5
5
|
import "../../utils/ui/ui.js";
|
|
6
|
-
import { ToggleGroup as
|
|
7
|
-
const
|
|
6
|
+
import { ToggleGroup as n } from "./ToggleGroup.js";
|
|
7
|
+
const a = [
|
|
8
8
|
{
|
|
9
9
|
value: "weekly",
|
|
10
10
|
label: "Weekly"
|
|
@@ -14,47 +14,84 @@ const n = [
|
|
|
14
14
|
label: "Monthly"
|
|
15
15
|
}
|
|
16
16
|
];
|
|
17
|
-
function
|
|
18
|
-
const [
|
|
17
|
+
function d() {
|
|
18
|
+
const [i, t] = u.useState("weekly");
|
|
19
19
|
return /* @__PURE__ */ l(r, { gap: "large", vertical: !0, children: [
|
|
20
20
|
/* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
|
|
21
|
-
/* @__PURE__ */ e(
|
|
21
|
+
/* @__PURE__ */ e(o, { children: "Default ToggleGroup" }),
|
|
22
22
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
23
|
-
|
|
23
|
+
n,
|
|
24
24
|
{
|
|
25
|
-
value:
|
|
25
|
+
value: i,
|
|
26
26
|
onChange: t,
|
|
27
|
-
options:
|
|
27
|
+
options: a
|
|
28
28
|
}
|
|
29
29
|
) })
|
|
30
30
|
] }),
|
|
31
31
|
/* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
|
|
32
|
-
/* @__PURE__ */ e(
|
|
32
|
+
/* @__PURE__ */ e(o, { children: "Full Width ToggleGroup" }),
|
|
33
33
|
/* @__PURE__ */ e("div", { style: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
34
|
-
|
|
34
|
+
n,
|
|
35
35
|
{
|
|
36
|
-
value:
|
|
36
|
+
value: i,
|
|
37
37
|
onChange: t,
|
|
38
|
-
options:
|
|
38
|
+
options: a,
|
|
39
39
|
fullWidth: !0
|
|
40
40
|
}
|
|
41
41
|
) })
|
|
42
42
|
] }),
|
|
43
43
|
/* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
|
|
44
|
-
/* @__PURE__ */ e(
|
|
44
|
+
/* @__PURE__ */ e(o, { children: "Disabled ToggleGroup" }),
|
|
45
45
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
46
|
-
|
|
46
|
+
n,
|
|
47
47
|
{
|
|
48
|
-
value:
|
|
48
|
+
value: i,
|
|
49
49
|
onChange: t,
|
|
50
|
-
options:
|
|
50
|
+
options: a,
|
|
51
51
|
disabled: !0
|
|
52
52
|
}
|
|
53
53
|
) })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
|
|
56
|
+
/* @__PURE__ */ e(o, { children: "Multiline ToggleGroup" }),
|
|
57
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
58
|
+
n,
|
|
59
|
+
{
|
|
60
|
+
value: i,
|
|
61
|
+
onChange: t,
|
|
62
|
+
options: a,
|
|
63
|
+
multiline: !0
|
|
64
|
+
}
|
|
65
|
+
) })
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
|
|
68
|
+
/* @__PURE__ */ e(o, { children: "Multiline Full Width ToggleGroup" }),
|
|
69
|
+
/* @__PURE__ */ e("div", { style: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
70
|
+
n,
|
|
71
|
+
{
|
|
72
|
+
value: i,
|
|
73
|
+
onChange: t,
|
|
74
|
+
options: a,
|
|
75
|
+
multiline: !0,
|
|
76
|
+
fullWidth: !0
|
|
77
|
+
}
|
|
78
|
+
) })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
|
|
81
|
+
/* @__PURE__ */ e(o, { children: "ToggleGroup Size Large" }),
|
|
82
|
+
/* @__PURE__ */ e("div", { style: { width: "100%" }, children: /* @__PURE__ */ e(
|
|
83
|
+
n,
|
|
84
|
+
{
|
|
85
|
+
value: i,
|
|
86
|
+
onChange: t,
|
|
87
|
+
options: a,
|
|
88
|
+
size: "large"
|
|
89
|
+
}
|
|
90
|
+
) })
|
|
54
91
|
] })
|
|
55
92
|
] });
|
|
56
93
|
}
|
|
57
|
-
const
|
|
94
|
+
const v = u.memo(d);
|
|
58
95
|
export {
|
|
59
|
-
|
|
96
|
+
v as default
|
|
60
97
|
};
|
|
@@ -12,7 +12,7 @@ body {
|
|
|
12
12
|
// initiat tokens
|
|
13
13
|
@include tokens.color-tokens;
|
|
14
14
|
@include tokens.offset-tokens;
|
|
15
|
-
@include tokens.control-
|
|
15
|
+
@include tokens.control-tokens;
|
|
16
16
|
@include tokens.text-tokens;
|
|
17
17
|
@include tokens.border-radius-tokens;
|
|
18
18
|
@include tokens.switch-tokens;
|
|
@@ -79,7 +79,9 @@
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
@mixin control-
|
|
82
|
+
@mixin control-tokens() {
|
|
83
|
+
@include ui.define-color-token('control-focus-outline', ui.color('primary', $alpha: .5));
|
|
84
|
+
|
|
83
85
|
@each $name, $value in ui.$controlHeightsMap {
|
|
84
86
|
@include ui.def('control-height-#{$name}', $value);
|
|
85
87
|
}
|
|
@@ -286,6 +288,7 @@
|
|
|
286
288
|
}
|
|
287
289
|
|
|
288
290
|
/**
|
|
291
|
+
* LEGACY
|
|
289
292
|
* Look for usages by searching for `ui.color-token('name')`
|
|
290
293
|
*/
|
|
291
294
|
@mixin color-tokens() {
|
|
@@ -343,10 +346,4 @@
|
|
|
343
346
|
@include ui.define-color-token('navlist-item-hover-border', transparent);
|
|
344
347
|
@include ui.define-color-token('navlist-item-hover-background', ui.color('main', 950, .2));
|
|
345
348
|
@include ui.define-color-token('overlay-backdrop-background', ui.color('bg', $alpha: .65));
|
|
346
|
-
@include ui.define-color-token('toggle-description-text', ui.color('main', 950, .5));
|
|
347
|
-
@include ui.define-color-token('toggle-border', ui.color('main', 950, .25));
|
|
348
|
-
@include ui.define-color-token('toggle-background', ui.color('main', 950, .1));
|
|
349
|
-
@include ui.define-color-token('toggle-hover-background', ui.color('main', 200));
|
|
350
|
-
@include ui.define-color-token('toggle-active-text', ui.color('main'));
|
|
351
|
-
@include ui.define-color-token('toggle-active-background', ui.color('main', 950, .75));
|
|
352
349
|
}
|